/** * New states are added to the end only * * @return void */ public function testNewStatesAreAddedToTheEnd() { $stateMachine = new StateMachine(); $stateMachine->addState("<?xml version=\"1.0\"?><listofitems><item id=\"1\" index=\"1\">First</item><item id=\"2\">Second</item></listofitems>"); $stateMachine->addState("<?xml version=\"1.0\"?><listofitems><item id=\"2\">second</item><item id=\"3\">Third</item></listofitems>"); $stateMachine->addState("<?xml version=\"1.0\"?><listofitems><item id=\"1\" index=\"1\">First</item><item id=\"2\">Second</item></listofitems>"); $stateMachine->addState("<?xml version=\"1.0\"?><listofitems><item id=\"4\">Fourth</item></listofitems>"); $this->assertEquals(true, $stateMachine->verifyIntegrity()); $stateMachine->addState("<?xml version=\"1.0\"?><listofitems><item id=\"5\">fifth</item><item id=\"3\">Third</item></listofitems>"); $this->assertXmlStringEqualsXmlString("<?xml version=\"1.0\"?><listofitems><item id=\"2\">second</item><item id=\"3\">Third</item></listofitems>", $stateMachine->getState(2)); $this->assertEquals(true, $stateMachine->verifyIntegrity()); }