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