You are here

public function RedisLockFunctionalTest::testLockAcquire in Redis 8

Confirms that we can acquire and release locks in two parallel requests.

Overrides LockFunctionalTest::testLockAcquire

File

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

Class

RedisLockFunctionalTest
Confirm locking works between two separate requests.

Namespace

Drupal\Tests\redis\Functional\Lock

Code

public function testLockAcquire() {
  $redis_interface = self::getRedisInterfaceEnv();
  $lock = $this->container
    ->get('lock');
  $this
    ->assertInstanceOf('\\Drupal\\redis\\Lock\\' . $redis_interface, $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($lock
    ->lockMayBeAvailable('system_test_lock_acquire'));
  parent::testLockAcquire();
}