function RollbackTest::testRollbackForInvalidConfig
Same name in this branch
- 10 core/tests/Drupal/KernelTests/Core/Recipe/RollbackTest.php \Drupal\KernelTests\Core\Recipe\RollbackTest::testRollbackForInvalidConfig()
Same name in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Recipe/RollbackTest.php \Drupal\KernelTests\Core\Recipe\RollbackTest::testRollbackForInvalidConfig()
- 11.x core/tests/Drupal/FunctionalTests/Core/Recipe/RollbackTest.php \Drupal\FunctionalTests\Core\Recipe\RollbackTest::testRollbackForInvalidConfig()
@testWith ["invalid_config", "core.date_format.invalid"] ["recipe_depend_on_invalid", "core.date_format.invalid"] ["recipe_depend_on_invalid_config_and_valid_modules", "core.date_format.invalid"]
File
-
core/
tests/ Drupal/ FunctionalTests/ Core/ Recipe/ RollbackTest.php, line 46
Class
- RollbackTest
- @group Recipe
Namespace
Drupal\FunctionalTests\Core\RecipeCode
public function testRollbackForInvalidConfig(string $recipe_fixture, string $expected_invalid_config_name) : void {
$expected_core_extension_modules = $this->config('core.extension')
->get('module');
/** @var string $recipe_fixture */
$recipe_fixture = realpath(__DIR__ . "/../../../../fixtures/recipes/{$recipe_fixture}");
$process = $this->applyRecipe($recipe_fixture, 1);
$this->assertStringContainsString("There were validation errors in {$expected_invalid_config_name}:", $process->getErrorOutput());
$this->assertCheckpointsExist([
"Backup before the '" . Recipe::createFromDirectory($recipe_fixture)->name . "' recipe.",
]);
// @see invalid_config
$date_formats = DateFormat::loadMultiple([
'valid',
'invalid',
]);
$this->assertEmpty($date_formats, "The recipe's imported config was not rolled back.");
// @see recipe_depend_on_invalid_config_and_valid_module
$this->assertSame($expected_core_extension_modules, $this->config('core.extension')
->get('module'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.