izzum\statemachine\TransitionTest::shouldThrowExceptionWhenRuleAndCommandNotCreated PHP Метод

shouldThrowExceptionWhenRuleAndCommandNotCreated() публичный Метод

    public function shouldThrowExceptionWhenRuleAndCommandNotCreated()
    {
        $from = new State('a');
        $to = new State('b');
        $context = new Context(new Identifier(Identifier::NULL_ENTITY_ID, Identifier::NULL_STATEMACHINE));
        $rule = 'izzum\\rules\\ExceptionOnConstructionRule';
        $command = 'izzum\\command\\ExceptionOnConstructionCommand';
        $transition = new Transition($from, $to, null, $rule, $command);
        try {
            $transition->getRule($context);
            $this->fail('rule creation throws exception');
        } catch (Exception $e) {
            $this->assertEquals(Exception::RULE_CREATION_FAILURE, $e->getCode());
        }
        try {
            $transition->getCommand($context);
            $this->fail('command creation throws exception');
        } catch (Exception $e) {
            $this->assertEquals(Exception::COMMAND_CREATION_FAILURE, $e->getCode());
        }
    }