NinjaMutex\Tests\MutexLocksTest::testUnableToAcquireLockHeldByOtherLock PHP Метод

testUnableToAcquireLockHeldByOtherLock() публичный Метод

public testUnableToAcquireLockHeldByOtherLock ( NinjaMutex\Lock\LockInterface $lockImplementor )
$lockImplementor NinjaMutex\Lock\LockInterface
    public function testUnableToAcquireLockHeldByOtherLock(LockInterface $lockImplementor)
    {
        $mutex1 = new Mutex('forfiter', $lockImplementor);
        $mutex1->acquireLock(0);
        $mutex = new Mutex('forfiter', $lockImplementor);
        // We don't acquire lock
        $this->assertFalse($mutex->isAcquired());
        // But it's held by other process
        $this->assertTrue($mutex->isLocked());
        // So we should be unable to acquire lock
        $this->assertFalse($mutex->acquireLock(0));
    }