You are here

public function Redis_Tests_Lock_LockingUnitTestCase::testReleaseAll in Redis 7.3

File

lib/Redis/Tests/Lock/LockingUnitTestCase.php, line 75

Class

Redis_Tests_Lock_LockingUnitTestCase

Code

public function testReleaseAll() {
  $b1 = $this
    ->createLockBackend();
  $b2 = $this
    ->createLockBackend();
  $b1
    ->lockAcquire('test1', 200);
  $b1
    ->lockAcquire('test2', 2000);
  $b1
    ->lockAcquire('test3', 20000);
  $s = $b2
    ->lockAcquire('test2');
  $this
    ->assertFalse($s, "Lock test2 could not be released by another thread");
  $s = $b2
    ->lockAcquire('test3');
  $this
    ->assertFalse($s, "Lock test4 could not be released by another thread");
  $b1
    ->lockReleaseAll();
  $s = $b2
    ->lockAcquire('test1');
  $this
    ->assertTrue($s, "Lock test1 has been released");
  $s = $b2
    ->lockAcquire('test2');
  $this
    ->assertTrue($s, "Lock test2 has been released");
  $s = $b2
    ->lockAcquire('test3');
  $this
    ->assertTrue($s, "Lock test3 has been released");
  $b2
    ->lockReleaseAll();
}