示例#1
0
 function it_should_transition(GraphStructure $structure, State $state)
 {
     $state->getId()->shouldBecalled()->willReturn('state');
     $state->onExit($state)->shouldBeCalled()->willReturn(true);
     $state->onEnter($state)->shouldBeCalled()->willReturn(true);
     $state->getBoundEvents()->shouldBeCalled()->willReturn([]);
     $this->setState($state);
     $structure->canTransitionFrom('state', 'newstate')->shouldBeCalled()->willReturn(true);
     $structure->getState('newstate')->shouldBeCalled()->willReturn($state);
     $structure->getState('state')->shouldBeCalled()->willReturn($state);
     $this->setStructure($structure);
     $this->transition('newstate');
 }
示例#2
0
 /**
  * Add a new transition
  *
  * @param $fromId
  * @param $toId
  * @param int $undirected
  * @return $this
  */
 public function transition($fromId, $toId, $undirected = 0)
 {
     $this->graph->addTransition($fromId, $toId, $undirected);
     return $this;
 }