/** * Returns the core content this page will display * * @param \r8\Page\Context $context A context object which is used by this * page to communicate with the root page * @return \r8\Template\Collection Returns a template collection */ public function getContent(\r8\Page\Context $context) { $tpl = new \r8\Template\Collection(); foreach ($this->pages as $page) { $content = $page->getContent($context); if (!$content instanceof \r8\iface\Template) { $content = new \r8\Template\Raw($content); } $tpl->add($content); } return $tpl; }
public function testDisplay() { $this->expectOutputString("Lorem Ipsum"); $tpl = new \r8\Template\Collection(); $mock = $this->getMockTpl(); $mock->expects($this->once())->method('display')->will($this->returnCallback(function () { echo "Lorem"; })); $tpl->add($mock); $mock2 = $this->getMockTpl(); $mock2->expects($this->once())->method('display')->will($this->returnCallback(function () { echo " Ipsum"; })); $tpl->add($mock2); $this->assertSame($tpl, $tpl->display()); }