コード例 #1
0
 public function testTriggerEventWithTimeout()
 {
     $timeout = $this->getMockBuilder('\\StateMachine\\PayloadTimeout')->disableOriginalConstructor()->getMock();
     $this->payload->expects($this->any())->method('hasChanged')->willReturn(true);
     $this->payloadHandler->expects($this->any())->method('restore')->willReturn($this->payload);
     $this->process->expects($this->any())->method('hasTimeout')->willReturn(true);
     $this->process->expects($this->any())->method('getTimeout')->willReturn($timeout);
     $this->adapter->expects($this->any())->method('getProcess')->willReturn($this->process);
     $this->timeoutHandler->expects($this->once())->method('store')->with($timeout);
     $this->process->expects($this->once())->method('triggerEvent')->with('event', $this->payload);
     $machine = new StateMachine($this->adapter, $this->payloadHandler, $this->timeoutHandler, $this->lockHandler);
     $machine->triggerEvent('event', 'identifier');
 }