public function testItReleasesLockingOnTheLock() { $this->backend->expects($this->once())->method('acquireLock')->with('test-lock', 23)->willReturn(true); $this->backend->expects($this->once())->method('releaseLock')->with('test-lock')->willReturn(true); $this->timeout->expects($this->any())->method('getValue')->willReturn(23); $lock = new Lock($this->backend, $this->name, $this->timeout); $lock->acquire(); $lock->release(); }
public function testAlreadyLocked() { $this->lock->expects($this->once())->method('acquireLock')->with($this->equalTo('foo'))->will($this->returnValue(false)); $this->setExpectedException('Simgroep\\EventSourcing\\Repository\\Exception\\ConcurrencyException'); $this->createManager()->obtain('foo'); }