public function test_RedisLock_Exceptions() { $key = static::TEST_KEY; $RedisLock = new RedisLock(static::$Redis, $key); $this->assertSame(true, $RedisLock->acquire(2)); $this->assertSame(true, $RedisLock->isLocked()); static::$Redis->del($key); try { $RedisLock->release(); $this->assertFalse('Expect LostLockException'); } catch (\Exception $Ex) { $this->assertInstanceOf(LostLockException::class, $Ex); } $this->assertSame(false, $RedisLock->isLocked()); $this->assertSame(true, $RedisLock->acquire(2)); $this->assertSame(true, $RedisLock->isLocked()); static::$Redis->del($key); $this->assertSame(false, $RedisLock->isExists()); try { $RedisLock->isLocked(); $this->assertFalse('Expect LostLockException'); } catch (\Exception $Ex) { $this->assertInstanceOf(LostLockException::class, $Ex); } }