function CheckpointStorageTest::testRevert
Same name in other branches
- 10 core/tests/Drupal/KernelTests/Core/Config/Storage/Checkpoint/CheckpointStorageTest.php \Drupal\KernelTests\Core\Config\Storage\Checkpoint\CheckpointStorageTest::testRevert()
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Config/ Storage/ Checkpoint/ CheckpointStorageTest.php, line 166
Class
- CheckpointStorageTest
- Tests CheckpointStorage operations.
Namespace
Drupal\KernelTests\Core\Config\Storage\CheckpointCode
public function testRevert() : void {
$checkpoint_storage = $this->container
->get('config.storage.checkpoint');
$check1 = $checkpoint_storage->checkpoint('A');
$this->assertTrue($this->container
->get('module_installer')
->uninstall([
'config_test',
]));
$checkpoint_storage = $this->container
->get('config.storage.checkpoint');
$check2 = $checkpoint_storage->checkpoint('B');
$importer = $this->getConfigImporter($checkpoint_storage);
$config_changelist = $importer->getStorageComparer()
->createChangelist()
->getChangelist();
$this->assertContains('config_test.dynamic.dotted.default', $config_changelist['create']);
$this->assertSame([
'core.extension',
], $config_changelist['update']);
$this->assertSame([], $config_changelist['delete']);
$this->assertSame([], $config_changelist['rename']);
$importer->import();
$this->assertSame([], $importer->getErrors());
$this->assertTrue($this->container
->get('module_handler')
->moduleExists('config_test'));
$checkpoint_storage = $this->container
->get('config.storage.checkpoint');
$checkpoint_storage->setCheckpointToReadFrom($check2);
$importer = $this->getConfigImporter($checkpoint_storage);
$config_changelist = $importer->getStorageComparer()
->createChangelist()
->getChangelist();
$this->assertContains('config_test.dynamic.dotted.default', $config_changelist['delete']);
$this->assertSame([
'core.extension',
], $config_changelist['update']);
$this->assertSame([], $config_changelist['create']);
$this->assertSame([], $config_changelist['rename']);
$importer->import();
$this->assertFalse($this->container
->get('module_handler')
->moduleExists('config_test'));
$checkpoint_storage->setCheckpointToReadFrom($check1);
$importer = $this->getConfigImporter($checkpoint_storage);
$importer->getStorageComparer()
->createChangelist();
$importer->import();
$this->assertTrue($this->container
->get('module_handler')
->moduleExists('config_test'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.