Exemplo n.º 1
0
 protected function setUp()
 {
     $s1 = new DefaultState('S1', State::TYPE_INITIAL);
     $s2 = new DefaultState('S2');
     $s3 = new DefaultState('S3');
     $s4 = new DefaultState('S4', State::TYPE_TERMINAL);
     $s1->addTransition('t1', $s2);
     $s1->addTransition('t2', $s3);
     $s2->addTransition('t3', $s4);
     $s4->addTransition('t4', $s4);
     $this->fsm = new SequenceRunner($s1, new Context());
 }
Exemplo n.º 2
0
 protected function setUp()
 {
     $s1 = new DefaultState('S1', State::TYPE_INITIAL);
     $s2 = new DefaultState('S2');
     $s3 = new DefaultState('S3');
     $s4 = new DefaultState('S4');
     $s5 = new DefaultState('S5', State::TYPE_TERMINAL);
     $s1->addTransition('t1', $s2);
     $s1->addTransition('t1', $s3);
     $s2->addTransition('t2', $s4);
     $s3->addTransition('t2', $s5);
     $this->fsm = new BacktrackingRunner($s1, new Context());
 }
Exemplo n.º 3
0
 function it_can_be_copied()
 {
     $t1 = new DefaultTransition('t1', new DefaultState('S2'));
     $t2 = new DefaultTransition('t2', new DefaultState('S3'));
     $this->addTransition($t1);
     $this->addTransition($t2);
     $expect = new DefaultState('State A');
     $expect->addTransition($t1);
     $expect->addTransition($t2);
     $this->copy()->shouldBeLike($expect);
 }