function ImportStorageTransformerTest::testTransformWhileImporting
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Config/ImportStorageTransformerTest.php \Drupal\KernelTests\Core\Config\ImportStorageTransformerTest::testTransformWhileImporting()
- 10 core/tests/Drupal/KernelTests/Core/Config/ImportStorageTransformerTest.php \Drupal\KernelTests\Core\Config\ImportStorageTransformerTest::testTransformWhileImporting()
- 11.x core/tests/Drupal/KernelTests/Core/Config/ImportStorageTransformerTest.php \Drupal\KernelTests\Core\Config\ImportStorageTransformerTest::testTransformWhileImporting()
Test the import transformer during a running config import.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Config/ ImportStorageTransformerTest.php, line 97
Class
- ImportStorageTransformerTest
- Tests the import storage transformer.
Namespace
Drupal\KernelTests\Core\ConfigCode
public function testTransformWhileImporting() {
// Set up the database table with the current active config.
// This simulates the config importer having its transformation done.
$storage = $this->container
->get('config.import_transformer')
->transform($this->container
->get('config.storage'));
// Mock the persistent lock being unavailable due to a config import.
$lock = $this->createMock('Drupal\\Core\\Lock\\LockBackendInterface');
$lock->expects($this->at(0))
->method('lockMayBeAvailable')
->with(ConfigImporter::LOCK_NAME)
->will($this->returnValue(FALSE));
// The import transformer under test.
$transformer = new ImportStorageTransformer($this->container
->get('event_dispatcher'), $this->container
->get('database'), new NullLockBackend(), $lock);
// Transform an empty memory storage.
$import = $transformer->transform(new MemoryStorage());
// Assert that the transformed storage is the same as the one used to
// set up the simulated config importer.
$this->assertEquals($storage->listAll(), $import->listAll());
$this->assertNotEmpty($import->read('system.site'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.