public function testConstructSetsFields() { $title = $this->getMock('Title'); $children = [new Page($this->getMock('Title')), new Page($this->getMock('Title'))]; $page = new Page($title, $children); $this->assertEquals($title, $page->getTitle()); $this->assertEquals($children, $page->getSubPages()); }
private function shouldUseDefault(Page $topLevelPage, $showTopLevelPage) { // Note: this behaviour is not fully correct. // Other parameters that omit results need to be held into account as well. return !$showTopLevelPage && $topLevelPage->getSubPages() === array(); }
/** * @see PageRenderer::renderPage * * @param Page $page * * @return string */ public function renderPage(Page $page) { return '[[' . $page->getTitle()->getFullText() . '|' . $this->getLinkText($page) . ']]'; }
private function renderSubPages(Page $page, $indentationLevel) { $texts = array(); foreach ($this->pageSorter->getSortedPages($page->getSubPages()) as $subPage) { $texts[] = $this->renderPage($subPage, $indentationLevel); } return implode("\n", $texts); }