izzum\statemachine\loader\JSONTest::shouldLoadTransitionsFromJSONString PHP Method

shouldLoadTransitionsFromJSONString() public method

    public function shouldLoadTransitionsFromJSONString()
    {
        $machine = new StateMachine(new Context(new Identifier('json-test', 'json-machine')));
        $this->assertCount(0, $machine->getTransitions());
        $json = $this->getJSON();
        $loader = new JSON($json);
        $this->assertEquals($this->getJSON(), $loader->getJSON());
        $count = $loader->load($machine);
        $this->assertCount(2, $machine->getTransitions());
        $this->assertEquals(2, $count);
        $tbd = $machine->getTransition('b_to_done');
        $b = $tbd->getStateFrom();
        $d = $tbd->getStateTo();
        $tab = $machine->getTransition('a_to_b');
        $a = $tab->getStateFrom();
        $this->assertEquals($b, $tab->getStateTo());
        $this->assertSame($b, $tab->getStateTo());
        $this->assertTrue($a->isInitial());
        $this->assertTrue($b->isNormal());
        $this->assertTrue($d->isFinal());
    }