/** * testRenderMarkdownView * * @return void */ public function testRenderMarkdownView() { $view = new View(TEST_APP . DS . 'views' . DS . 'markdown.md'); $result = $view->render(); $h1 = '/<h1>(.+)<\\/h1>/'; $p = '/<p>(.+)<code>(.+)<\\/code><\\/p>/'; $ul = '/<ul>(.*)<\\/ul>/s'; $li = '/<li>(.+)<\\/li>/'; $this->assertRegExp($h1, $result); $this->assertRegExp($p, $result); $this->assertRegExp($ul, $result); $this->assertRegExp($li, $result); }
/** * Tries rendering the view within the layout, if that fails (i.e., no layout * is defined) it just returns the rendered view * * @param View $view View to render * @return string */ public function renderView(View $view) { $viewContents = $view->render(); try { $layout = new View($this->site . DIRECTORY_SEPARATOR . $this->layout); $layout->set('post', $view->getPost()); $layout->set('title', $view->getTitle()); $layout->set('content', $viewContents); $viewContents = $layout->render(); } catch (\Exception $e) { } return $viewContents; }