display() public method

ビューを表示する
public display ( ) : void
return void
 /**
  * testDisplay method
  *
  * @return void
  */
 public function testDisplay()
 {
     App::build(array('View' => array(CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS)));
     $Pages = new PagesController(new CakeRequest(null, false), new CakeResponse());
     $Pages->viewPath = 'Posts';
     $Pages->display('index');
     $this->assertRegExp('/posts index/', $Pages->response->body());
     $this->assertEquals('index', $Pages->viewVars['page']);
     $Pages->viewPath = 'Themed';
     $Pages->display('TestTheme', 'Posts', 'index');
     $this->assertRegExp('/posts index themed view/', $Pages->response->body());
     $this->assertEquals('TestTheme', $Pages->viewVars['page']);
     $this->assertEquals('Posts', $Pages->viewVars['subpage']);
 }
Esempio n. 2
0
 /**
  * testDisplay method
  *
  * @access public
  * @return void
  */
 function testDisplay()
 {
     App::build(array('views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS, TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS)));
     $Pages = new PagesController(new CakeRequest(null, false));
     $Pages->viewPath = 'posts';
     $Pages->display('index');
     $this->assertPattern('/posts index/', $Pages->getResponse()->body());
     $this->assertEqual($Pages->viewVars['page'], 'index');
     $Pages->viewPath = 'themed';
     $Pages->display('test_theme', 'posts', 'index');
     $this->assertPattern('/posts index themed view/', $Pages->getResponse()->body());
     $this->assertEqual($Pages->viewVars['page'], 'test_theme');
     $this->assertEqual($Pages->viewVars['subpage'], 'posts');
 }
Esempio n. 3
0
 /**
  * testDisplay method
  *
  * @access public
  * @return void
  */
 function testDisplay()
 {
     if ($this->skipIf(defined('APP_CONTROLLER_EXISTS'), '%s Need a non-existent AppController')) {
         return;
     }
     App::build(array('views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS, TEST_CAKE_CORE_INCLUDE_PATH . 'libs' . DS . 'view' . DS)));
     $Pages = new PagesController();
     $Pages->viewPath = 'posts';
     $Pages->display('index');
     $this->assertPattern('/posts index/', $Pages->output);
     $this->assertEqual($Pages->viewVars['page'], 'index');
     $this->assertEqual($Pages->pageTitle, 'Index');
     $Pages->viewPath = 'themed';
     $Pages->display('test_theme', 'posts', 'index');
     $this->assertPattern('/posts index themed view/', $Pages->output);
     $this->assertEqual($Pages->viewVars['page'], 'test_theme');
     $this->assertEqual($Pages->viewVars['subpage'], 'posts');
     $this->assertEqual($Pages->pageTitle, 'Index');
 }
 /**
  * Test that missing view in debug mode renders missing_view error page
  *
  * @expectedException MissingViewException
  * @expectedExceptionCode 500
  * @return void
  */
 public function testMissingViewInDebug()
 {
     Configure::write('debug', 1);
     $Pages = new PagesController(new CakeRequest(null, false), new CakeResponse());
     $Pages->display('non_existing_page');
 }