public function testLockThrowsLockWaitTimeoutException() { $redisClient = $this->getMockBuilder(\Predis\Client::class)->setMethods(['set'])->getMock(); $redisClient->expects($this->at(0))->method('set')->with('dave::LOCK', 'LOCKED', 'PX', 3600, 'NX')->will($this->returnValue(1)); $redisClient->expects($this->any())->method('set')->with('dave::LOCK', 'LOCKED', 'PX', 3600, 'NX')->will($this->returnValue(null)); $this->expectException(\Stiphle\Storage\LockWaitTimeoutException::class); $storage = new Redis($redisClient); $storage->lock('dave'); $storage->lock('dave'); }