Beispiel #1
0
 public function testCanWithMultipleTransition()
 {
     $definition = $this->createComplexStateMachineDefinition();
     $net = new StateMachine($definition);
     $subject = new \stdClass();
     // If you are in place "b" you should be able to apply "t1" and "t2"
     $subject->marking = 'b';
     $this->assertTrue($net->can($subject, 't2'));
     $this->assertTrue($net->can($subject, 't3'));
 }
Beispiel #2
0
 public function testCanWithMultipleTransition()
 {
     $places = array('a', 'b', 'c');
     $transitions[] = new Transition('t1', 'a', 'b');
     $transitions[] = new Transition('t2', 'a', 'c');
     $definition = new Definition($places, $transitions);
     $net = new StateMachine($definition);
     $subject = new \stdClass();
     // If you are in place "a" you should be able to apply "t1" and "t2"
     $subject->marking = 'a';
     $this->assertTrue($net->can($subject, 't1'));
     $this->assertTrue($net->can($subject, 't2'));
     // The graph looks like:
     //
     // +----+     +----+     +---+
     // | a  | --> | t1 | --> | b |
     // +----+     +----+     +---+
     //   |
     //   |
     //   v
     // +----+     +----+
     // | t2 | --> | c  |
     // +----+     +----+
 }