assertTrue($lock->tryLock()); $lock->release(); $this->assertTrue($lock2->tryLock()); $lock2->release(); } public function testBusyLock() { $lock = new FileLock('test'); $lock2 = new FileLock('test'); $data = ['foo' => '42']; $this->assertTrue($lock->tryLock($data)); // test updating a lock $data = ['foo' => 'bar']; $this->assertTrue($lock->tryLock($data)); // aquiring the lock should fail $data = []; $this->assertFalse($lock2->tryLock($data)); $this->assertEquals('bar', $data['foo']); $lock->release(); } }