izzum\statemachine\Transition::toString PHP Method

toString() public method

public toString ( ) : string
return string
    public function toString()
    {
        return get_class($this) . " '" . $this->getName() . "' [event]: '" . $this->event . "'" . " [rule]: '" . $this->rule . "' [command]: '" . $this->command . "'";
    }

Usage Example

 /**
  * @test
  */
 public function shouldExpectExceptionsWhenCallingPublicMethodsWithNonDefaultConstructorValues()
 {
     $from = new State('a');
     $to = new State('b');
     $rule = 'izzum\\rules\\BOGUS';
     $command = 'izzum\\command\\BOGUS';
     $object = new Context(new Identifier(Identifier::NULL_ENTITY_ID, Identifier::NULL_STATEMACHINE));
     $transition = new Transition($from, $to, null, $rule, $command);
     $this->assertEquals($from . '_to_' . $to, $transition->getName());
     $this->assertEquals($from, $transition->getStateFrom());
     $this->assertEquals($to, $transition->getStateTo());
     $this->assertContains($transition->getName(), $transition->toString());
     try {
         $command = $transition->getCommand($object);
         $this->fail('should not come here');
     } catch (Exception $e) {
         $this->assertEquals(Exception::COMMAND_CREATION_FAILURE, $e->getCode());
     }
     try {
         $rule = $transition->getRule($object);
         $this->fail('should not come here');
     } catch (Exception $e) {
         $this->assertEquals(Exception::RULE_CREATION_FAILURE, $e->getCode());
     }
 }