izzum\statemachine\loader\ArrayLoaderTest::shouldLoadStateMachine PHP Метод

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

    public function shouldLoadStateMachine()
    {
        $transitions = array();
        $s1 = new State("1");
        $s2 = new State("2");
        $s3 = new State("3");
        $transitions[] = new Transition($s1, $s2);
        $transitions[] = new Transition($s2, $s3);
        $loader = new LoaderArray($transitions);
        $this->assertEquals(count($transitions), $loader->count());
        $this->assertEquals(count($loader->getTransitions()), $loader->count());
        $context = new Context(new Identifier(Identifier::NULL_ENTITY_ID, Identifier::NULL_STATEMACHINE));
        $machine = new StateMachine($context);
        $count = $loader->load($machine);
        $this->assertEquals(2, $count);
        $this->assertCount(2, $machine->getTransitions());
        $this->assertCount(3, $machine->getStates());
    }