izzum\statemachine\TransitionTest::shouldExpectExceptionsWhenCallingPublicMethodsWithNonDefaultConstructorValues PHP Method

shouldExpectExceptionsWhenCallingPublicMethodsWithNonDefaultConstructorValues() public method

    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());
        }
    }