function ImportStorageTransformerTest::testTransformLocked
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Config/ImportStorageTransformerTest.php \Drupal\KernelTests\Core\Config\ImportStorageTransformerTest::testTransformLocked()
- 10 core/tests/Drupal/KernelTests/Core/Config/ImportStorageTransformerTest.php \Drupal\KernelTests\Core\Config\ImportStorageTransformerTest::testTransformLocked()
- 11.x core/tests/Drupal/KernelTests/Core/Config/ImportStorageTransformerTest.php \Drupal\KernelTests\Core\Config\ImportStorageTransformerTest::testTransformLocked()
Test that the import transformer throws an exception.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Config/ ImportStorageTransformerTest.php, line 66
Class
- ImportStorageTransformerTest
- Tests the import storage transformer.
Namespace
Drupal\KernelTests\Core\ConfigCode
public function testTransformLocked() {
// Mock the request lock not being available.
$lock = $this->createMock('Drupal\\Core\\Lock\\LockBackendInterface');
$lock->expects($this->at(0))
->method('acquire')
->with(ImportStorageTransformer::LOCK_NAME)
->will($this->returnValue(FALSE));
$lock->expects($this->at(1))
->method('wait')
->with(ImportStorageTransformer::LOCK_NAME);
$lock->expects($this->at(2))
->method('acquire')
->with(ImportStorageTransformer::LOCK_NAME)
->will($this->returnValue(FALSE));
// The import transformer under test.
$transformer = new ImportStorageTransformer($this->container
->get('event_dispatcher'), $this->container
->get('database'), $lock, new NullLockBackend());
$this->expectException(StorageTransformerException::class);
$this->expectExceptionMessage("Cannot acquire config import transformer lock.");
$transformer->transform(new MemoryStorage());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.