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

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

    public function shouldWorkWhenCallingPublicMethods()
    {
        $from = new State('a');
        $to = new State('b');
        $rule = 'izzum\\rules\\TrueRule';
        $command = 'izzum\\command\\NullCommand';
        $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());
        $command = $transition->getCommand($object);
        $rule = $transition->getRule($object);
        $this->assertTrue(is_a($command, 'izzum\\command\\Composite'), get_class($command));
        $this->assertTrue(is_a($rule, 'izzum\\rules\\AndRule'));
        $this->assertNotNull($transition->toString());
        $this->assertNotNull($transition->__toString());
        $this->assertEquals('', $transition->getDescription());
        $description = 'test description';
        $transition->setDescription($description);
        $this->assertEquals($description, $transition->getDescription());
        $this->assertEquals($transition->getName(), $transition->getEvent());
        $event = 'anEvent';
        $this->assertFalse($transition->isTriggeredBy($event));
        $transition->setEvent($event);
        $this->assertEquals($event, $transition->getEvent());
        $this->assertTrue($transition->isTriggeredBy($event));
        $transition->setEvent(null);
        $this->assertEquals($transition->getName(), $transition->getEvent());
        $transition->setEvent('');
        $this->assertEquals($transition->getName(), $transition->getEvent());
    }