// Even through the previous stage was destroyed, we cannot create a new one
// because the failure marker is still there.
$stage=$this->createStage();
try{
$stage->create();
$this->fail('Expected an exception.');
}
catch(FailureMarkerExistsException$e){
$this->assertMatchesRegularExpression('/^Staged changes failed to apply, and the site is in an indeterminate state. It is strongly recommended to restore the code and database from a backup. Caused by Exception, with this message: '.$thrown_message."\nBacktrace:\n#0 .*/",$e->getMessage());
$this->assertFalse($stage->isApplying());
}
// If the failure marker is cleared, we should be able to create the stage
$expected_message="/^Staged changes failed to apply, and the site is in an indeterminate state. It is strongly recommended to restore the code and database from a backup. Caused by Exception, with this message: $expected_message\nBacktrace:\n#0 .*/";
}
else{
$expected_message="/^$expected_message$/";
}
$stage=$this->createStage();
try{
$stage->create();
$stage->require(['ext-json:*']);
$stage->apply();
$this->fail('Expected an exception to be thrown, but it was not.');
// Even through the previous stage was destroyed, we cannot create a new one
// because the failure marker is still there.
$stage=$this->createStage();
try{
$stage->create();
$this->fail('Expected an exception.');
}
catch(FailureMarkerExistsException$e){
$this->assertMatchesRegularExpression('/^Staged changes failed to apply, and the site is in an indeterminate state. It is strongly recommended to restore the code and database from a backup. Caused by Exception, with this message: '.$thrown_message."\nBacktrace:\n#0 .*/",$e->getMessage());
$this->assertFalse($stage->isApplying());
}
// If the failure marker is cleared, we should be able to create the stage
$expected_message="/^Staged changes failed to apply, and the site is in an indeterminate state. It is strongly recommended to restore the code and database from a backup. Caused by Exception, with this message: $expected_message\nBacktrace:\n#0 .*/";
}
else{
$expected_message="/^$expected_message$/";
}
$stage=$this->createStage();
try{
$stage->create();
$stage->require(['ext-json:*']);
$stage->apply();
$this->fail('Expected an exception to be thrown, but it was not.');