session */ function setUp() { $this->form = new MultiFormTestClass(new Controller(), 'Form'); } /** * Tests initialising a new instance of a test class. * * @TODO Write some decent tests! The current assertions are very basic, and are * nowhere near touching on the more advanced concepts of MultiForm, such * as the form actions (prev/next), session handling, and step handling * through {@link MultiFormStep->getPreviousStep()} and * {@link MultiFormStep->getNextStep()} for example. */ function testInitialisingForm() { $this->assertTrue(is_numeric($this->form->getCurrentStep()->ID) && ($this->form->getCurrentStep()->ID > 0)); $this->assertTrue(is_numeric($this->form->session->ID) && ($this->form->session->ID > 0)); $this->assertEquals('MultiFormTestStepOne', $this->form->getStartStep()); } /** * Test that the 2nd step is correct to what we expect it to be. */ function testSecondStep() { $this->assertEquals('MultiFormTestStepTwo', $this->form->getCurrentStep()->getNextStep()); } /** * Test that the amount of steps we have has been calculated correctly. */ function testTotalStepCount() { $this->assertEquals(3, $this->form->getAllStepsLinear()->Count()); } /** * Remove the session data that was created. Note: This should delete all the * dependencies such as MultiFormStep instances that are related directly to * this session. These directives can be found on {@link MultiFormSession->onBeforeWrite()} */ function tearDown() { $this->form->session->delete(); } } ?>