/** * Verifies that we get an exception if there appears to be a key * collision. */ public function testKeyCollision() { $mutex = new Mutex($this); $lockID = $mutex->getLockID(); /* Passing the key manually should cause an error, because the code will know that the first time this key was used, it was automatically derived. */ $this->assertThrows('MutexException', function () use($lockID) { new Mutex($lockID); }, null, 'Instantiating a new Mutex with a value that causes a key collision failed to raise the expected exception.'); }