load() public method

public load ( StateMachine $stateMachine )
$stateMachine izzum\statemachine\StateMachine
 /**
  * @test
  */
 public function shouldLoadAndWriteViaDelegator()
 {
     $loader = XML::createFromFile(__DIR__ . '/../loader/fixture-example.xml');
     $writer = new Memory();
     $identifier = new Identifier('readerwriter-test', 'test-machine');
     $delegator = new ReaderWriterDelegator($loader, $writer);
     $context = new Context($identifier, null, $delegator);
     $machine = new StateMachine($context);
     $this->assertCount(0, $machine->getTransitions());
     $count = $delegator->load($machine);
     //add to the backend
     $this->assertTrue($context->add('a'));
     $this->assertCount(4, $machine->getTransitions(), 'there is a regex transition that adds 2 transitions (a-c and b-c)');
     $this->assertEquals(4, $count);
     $this->assertTrue($machine->ab());
     //get the data from the memory storage facility
     $data = $writer->getStorageFromRegistry($machine->getContext()->getIdentifier());
     $this->assertEquals('b', $data->state);
     $this->assertEquals('b', $machine->getCurrentState()->getName());
     $this->assertTrue($machine->bdone());
     $data = $writer->getStorageFromRegistry($machine->getContext()->getIdentifier());
     $this->assertEquals('done', $data->state);
 }