/** * testMissingView method * * @access public * @return void */ function testMissingView() { $this->Controller->plugin = null; $this->Controller->name = 'Pages'; $this->Controller->viewPath = 'pages'; $this->Controller->action = 'display'; $this->Controller->theme = 'my_theme'; $this->Controller->params['pass'] = array('home'); restore_error_handler(); $View = new TestThemeView($this->Controller); ob_start(); $result = $View->getViewFileName('does_not_exist'); $expected = str_replace(array("\t", "\r\n", "\n"), "", ob_get_clean()); set_error_handler('simpleTestErrorHandler'); $this->assertPattern("/PagesController::/", $expected); $this->assertPattern("/views(\\/|\\\\)themed(\\/|\\\\)my_theme(\\/|\\\\)pages(\\/|\\\\)does_not_exist.ctp/", $expected); }
function testMissingView() { $this->Controller->plugin = null; $this->Controller->name = 'Pages'; $this->Controller->viewPath = 'pages'; $this->Controller->action = 'display'; $this->Controller->params['pass'] = array('home'); $ThemeView = new TestThemeView($this->Controller); $expected = 'missingView'; $result = $ThemeView->getViewFileName('does_not_exist'); $this->assertEqual($result, $expected); }
/** * Test for missing views * * @expectedException MissingViewException * @return void */ public function testMissingView() { $this->Controller->plugin = null; $this->Controller->name = 'Pages'; $this->Controller->viewPath = 'Pages'; $this->Controller->action = 'display'; $this->Controller->params['pass'] = array('home'); $View = new TestView($this->Controller); ob_start(); $View->getViewFileName('does_not_exist'); $this->ThemeController->plugin = null; $this->ThemeController->name = 'Pages'; $this->ThemeController->viewPath = 'Pages'; $this->ThemeController->action = 'display'; $this->ThemeController->theme = 'my_theme'; $this->ThemeController->params['pass'] = array('home'); $View = new TestThemeView($this->ThemeController); $View->getViewFileName('does_not_exist'); }
/** * testMissingView method * * @expectedException MissingViewException * @return void */ public function testMissingView() { $this->Controller->plugin = null; $this->Controller->name = 'Pages'; $this->Controller->viewPath = 'Pages'; $this->Controller->action = 'display'; $this->Controller->params['pass'] = array('home'); $View = new TestView($this->Controller); ob_start(); $result = $View->getViewFileName('does_not_exist'); $this->ThemeController->plugin = null; $this->ThemeController->name = 'Pages'; $this->ThemeController->viewPath = 'Pages'; $this->ThemeController->action = 'display'; $this->ThemeController->theme = 'my_theme'; $this->ThemeController->params['pass'] = array('home'); $View = new TestThemeView($this->ThemeController); ob_start(); $result = $View->getViewFileName('does_not_exist'); $expected = ob_get_clean(); $this->assertRegExp("/PagesController::/", $expected); $this->assertRegExp("/views(\\/|\\\\)themed(\\/|\\\\)my_theme(\\/|\\\\)pages(\\/|\\\\)does_not_exist.ctp/", $expected); }