public function testResolveTimeoutsWithPayloadInCorrectState() { $timeout = $this->getMockBuilder('\\StateMachine\\PayloadTimeout')->disableOriginalConstructor()->getMock(); $timeout->expects($this->any())->method('getState')->willReturn('timeout'); $this->timeoutHandler->expects($this->any())->method('getExpired')->willReturn([$timeout]); $this->payload->expects($this->any())->method('getState')->willReturn('timeout'); $this->payloadHandler->expects($this->any())->method('restore')->willReturn($this->payload); $this->adapter->expects($this->any())->method('getProcess')->willReturn($this->process); $this->process->expects($this->once())->method('triggerEvent'); $this->timeoutHandler->expects($this->once())->method('remove'); $machine = new StateMachine($this->adapter, $this->payloadHandler, $this->timeoutHandler, $this->lockHandler); $machine->resolveTimeouts(); }