Example #1
0
 /**
  * testGetPost
  *
  * @return void
  */
 public function testGetPost()
 {
     $view = new View(TEST_APP . DS . 'views' . DS . 'html.php');
     $result = $view->getPost();
     $this->assertFalse($result);
     $view = new View(TEST_APP . DS . 'views' . DS . '2013' . DS . '05' . DS . 'my-may-post.md');
     $result = $view->getPost();
     $this->assertInstanceOf('\\JeremyHarris\\Build\\Blog\\Post', $result);
 }
Example #2
0
 /**
  * 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;
 }