public function testGetSetDocument() { $expectedDocument = new IncomingDocument(); $this->page->setDocument($expectedDocument); $this->assertEquals($expectedDocument, $this->page->getDocument()); try { $this->page->setDocument($expectedDocument); } catch (\Exception $e) { $this->assertTrue($e instanceof \LogicException); } }
/** * @param Page $page * * @return Document */ public function addPage(Page $page) { $nextPageNumber = count($this->pages) + 1; $page->setPageNumber($nextPageNumber); $page->setDocument($this); $this->pages->set($nextPageNumber, $page); return $this; }