You are here

public function RedisLockFunctionalTest::testPersistentLock in Redis 8

Tests that the persistent lock is persisted between requests.

Overrides LockFunctionalTest::testPersistentLock

File

tests/src/Functional/Lock/RedisLockFunctionalTest.php, line 76

Class

RedisLockFunctionalTest
Confirm locking works between two separate requests.

Namespace

Drupal\Tests\redis\Functional\Lock

Code

public function testPersistentLock() {
  $redis_interface = self::getRedisInterfaceEnv();
  $persistent_lock = $this->container
    ->get('lock.persistent');
  $this
    ->assertInstanceOf('\\Drupal\\redis\\PersistentLock\\' . $redis_interface, $persistent_lock);

  // Verify that a lock that has never been acquired is marked as available.
  // @todo Remove this line when #3002640 lands.
  // @see https://www.drupal.org/project/drupal/issues/3002640
  $this
    ->assertTrue($persistent_lock
    ->lockMayBeAvailable('lock1'));
  parent::testPersistentLock();
}