public function ExportStorageManagerTest::testGetStorageLock in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Config/ExportStorageManagerTest.php \Drupal\KernelTests\Core\Config\ExportStorageManagerTest::testGetStorageLock()
- 9 core/tests/Drupal/KernelTests/Core/Config/ExportStorageManagerTest.php \Drupal\KernelTests\Core\Config\ExportStorageManagerTest::testGetStorageLock()
Tests the export storage when it is locked.
File
- core/
tests/ Drupal/ KernelTests/ Core/ Config/ ExportStorageManagerTest.php, line 80
Class
- ExportStorageManagerTest
- Tests the export storage manager.
Namespace
Drupal\KernelTests\Core\ConfigCode
public function testGetStorageLock() {
$lock = $this
->createMock('Drupal\\Core\\Lock\\LockBackendInterface');
$lock
->expects($this
->exactly(2))
->method('acquire')
->with(ExportStorageManager::LOCK_NAME)
->will($this
->returnValue(FALSE));
$lock
->expects($this
->once())
->method('wait')
->with(ExportStorageManager::LOCK_NAME);
// The export storage manager under test.
$manager = new ExportStorageManager($this->container
->get('config.storage'), $this->container
->get('database'), $this->container
->get('event_dispatcher'), $lock);
$this
->expectException(StorageTransformerException::class);
$this
->expectExceptionMessage("Cannot acquire config export transformer lock.");
$manager
->getStorage();
}