public function testAcquireTooFewKeys($count, $available) { $mutex = $this->buildRedisMutex($count); $i = 0; $mutex->expects($this->any())->method("add")->willReturnCallback(function () use(&$i, $available) { $i++; return $i <= $available; }); $mutex->synchronized(function () { $this->fail("Code should not be executed"); }); }