function ExportStorageManagerTest::testGetStorageLock

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Config/ExportStorageManagerTest.php \Drupal\KernelTests\Core\Config\ExportStorageManagerTest::testGetStorageLock()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Config/ExportStorageManagerTest.php \Drupal\KernelTests\Core\Config\ExportStorageManagerTest::testGetStorageLock()
  3. 11.x 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 84

Class

ExportStorageManagerTest
Tests the export storage manager.

Namespace

Drupal\KernelTests\Core\Config

Code

public function testGetStorageLock() : void {
  $lock = $this->createMock('Drupal\\Core\\Lock\\LockBackendInterface');
  $lock->expects($this->exactly(2))
    ->method('acquire')
    ->with(ExportStorageManager::LOCK_NAME)
    ->willReturn(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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.