function LockBackendAbstractTest::testGetLockId

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php \Drupal\Tests\Core\Lock\LockBackendAbstractTest::testGetLockId()
  2. 10 core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php \Drupal\Tests\Core\Lock\LockBackendAbstractTest::testGetLockId()
  3. 11.x core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php \Drupal\Tests\Core\Lock\LockBackendAbstractTest::testGetLockId()

Test the getLockId() method.

File

core/tests/Drupal/Tests/Core/Lock/LockBackendAbstractTest.php, line 54

Class

LockBackendAbstractTest
@coversDefaultClass <a href="/api/drupal/core%21tests%21Drupal%21Tests%21Core%21Lock%21LockBackendAbstractTest.php/class/LockBackendAbstractTest/8.9.x" title="@coversDefaultClass \Drupal\Tests\Core\Lock\LockBackendAbstractTest @group Lock" class="local">\Drupal\Tests\Core\Lock\LockBackendAbstractTest</a> @group Lock

Namespace

Drupal\Tests\Core\Lock

Code

public function testGetLockId() {
    $lock_id = $this->lock
        ->getLockId();
    $this->assertIsString($lock_id);
    // Example lock ID would be '7213141505232b6ee2cb967.27683891'.
    $this->assertRegExp('/[\\da-f]+\\.\\d+/', $lock_id);
    // Test the same lock ID is returned a second time.
    $this->assertSame($lock_id, $this->lock
        ->getLockId());
}

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