izzum\statemachine\loader\ArrayLoaderTest::shouldAddToLoader PHP Method

shouldAddToLoader() public method

public shouldAddToLoader ( )
    public function shouldAddToLoader()
    {
        $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(2, $loader->count());
        //add existing transition (not the same instance, but same name)
        $loader->add(new Transition($s1, $s2));
        $this->assertEquals(count($transitions), $loader->count());
        $this->assertEquals(2, $loader->count());
        //add new transition
        $loader->add(new Transition($s2, $s1));
        $this->assertEquals(count($loader->getTransitions()), $loader->count());
        $this->assertEquals(3, $loader->count());
    }