function CheckpointStorageTest::testConfigDelete
Same name in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Config/Storage/Checkpoint/CheckpointStorageTest.php \Drupal\KernelTests\Core\Config\Storage\Checkpoint\CheckpointStorageTest::testConfigDelete()
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Config/ Storage/ Checkpoint/ CheckpointStorageTest.php, line 56
Class
- CheckpointStorageTest
- Tests CheckpointStorage operations.
Namespace
Drupal\KernelTests\Core\Config\Storage\CheckpointCode
public function testConfigDelete() : void {
$checkpoint_storage = $this->container
->get('config.storage.checkpoint');
$check1 = $checkpoint_storage->checkpoint('A');
$this->config('config_test.system')
->delete();
$this->assertFalse($this->container
->get('config.storage')
->exists('config_test.system'));
$this->assertTrue($checkpoint_storage->exists('config_test.system'));
$this->assertSame('bar', $checkpoint_storage->read('config_test.system')['foo']);
$this->assertContains('config_test.system', $checkpoint_storage->listAll());
$this->assertContains('config_test.system', $checkpoint_storage->listAll('config_test.'));
$this->assertNotContains('config_test.system', $checkpoint_storage->listAll('system.'));
// Should not be part of the active storage anymore.
$this->assertNotContains('config_test.system', $this->container
->get('config.storage')
->listAll());
$check2 = $checkpoint_storage->checkpoint('B');
$this->config('config_test.system')
->set('foo', 'foobar')
->save();
$this->assertTrue($this->container
->get('config.storage')
->exists('config_test.system'));
$this->assertTrue($checkpoint_storage->exists('config_test.system'));
$this->assertSame('bar', $checkpoint_storage->read('config_test.system')['foo']);
$checkpoint_storage->setCheckpointToReadFrom($check2);
$this->assertFalse($checkpoint_storage->exists('config_test.system'));
$this->assertFalse($checkpoint_storage->read('config_test.system'));
$this->assertNotContains('config_test.system', $checkpoint_storage->listAll());
$checkpoint_storage->setCheckpointToReadFrom($check1);
$this->assertTrue($checkpoint_storage->exists('config_test.system'));
$this->assertSame('bar', $checkpoint_storage->read('config_test.system')['foo']);
$this->assertContains('config_test.system', $checkpoint_storage->listAll());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.