/** * @test * @expectedException TYPO3\Form\Exception\FormDefinitionConsistencyException */ public function createElementThrowsExceptionIfPageIsNotAttachedToParentForm() { $page = new Page('id'); $page->createElement('myElement', 'TYPO3.Form:MyElementType'); }
/** * Returns the next page of the currently selected one or NULL if there is no next page * * @return \TYPO3\Form\Core\Model\Page * @api */ public function getNextPage() { $nextPageIndex = $this->currentPage->getIndex() + 1; if ($this->formDefinition->hasPageWithIndex($nextPageIndex)) { return $this->formDefinition->getPageByIndex($nextPageIndex); } }
/** * @test */ public function removePageRemovesFormElementsOnPageFromForm() { $formDefinition = new FormDefinition('foo1'); $page1 = new Page('bar1'); $element1 = $this->getMockFormElement('el1'); $page1->addElement($element1); $formDefinition->addPage($page1); $element2 = $this->getMockFormElement('el2'); $page1->addElement($element2); $this->assertSame($element1, $formDefinition->getElementByIdentifier('el1')); $this->assertSame($element2, $formDefinition->getElementByIdentifier('el2')); $formDefinition->removePage($page1); $this->assertNull($formDefinition->getElementByIdentifier('el1')); $this->assertNull($formDefinition->getElementByIdentifier('el2')); }