public function ImportStorageTransformerTest::testTransformWhileImporting in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Config/ImportStorageTransformerTest.php \Drupal\KernelTests\Core\Config\ImportStorageTransformerTest::testTransformWhileImporting()
- 9 core/tests/Drupal/KernelTests/Core/Config/ImportStorageTransformerTest.php \Drupal\KernelTests\Core\Config\ImportStorageTransformerTest::testTransformWhileImporting()
Tests the import transformer during a running config import.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Config/ ImportStorageTransformerTest.php, line 93
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
->once())
->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'));
}