/** * Test for missing layouts * * @expectedException MissingLayoutException * @return void */ public function testMissingLayout() { $this->Controller->plugin = null; $this->Controller->name = 'Posts'; $this->Controller->viewPath = 'Posts'; $this->Controller->layout = 'whatever'; $View = new TestView($this->Controller); ob_start(); $View->getLayoutFileName(); ob_get_clean(); $this->ThemeController->plugin = null; $this->ThemeController->name = 'Posts'; $this->ThemeController->viewPath = 'posts'; $this->ThemeController->layout = 'whatever'; $this->ThemeController->theme = 'my_theme'; $View = new TestThemeView($this->ThemeController); $View->getLayoutFileName(); }
/** * testMissingLayout method * * @access public * @return void */ function testMissingLayout() { $this->Controller->plugin = null; $this->Controller->name = 'Posts'; $this->Controller->viewPath = 'posts'; $this->Controller->layout = 'whatever'; $View = new TestView($this->Controller); ob_start(); $result = $View->getLayoutFileName(); $expected = str_replace(array("\t", "\r\n", "\n"), "", ob_get_clean()); $this->assertPattern("/Missing Layout/", $expected); $this->assertPattern("/layouts(\\/|\\\\)whatever.ctp/", $expected); }
/** * testMissingLayout method * * @expectedException MissingLayoutException * @return void */ public function testMissingLayout() { $this->Controller->plugin = null; $this->Controller->name = 'Posts'; $this->Controller->viewPath = 'Posts'; $this->Controller->layout = 'whatever'; $View = new TestView($this->Controller); ob_start(); $result = $View->getLayoutFileName(); $expected = ob_get_clean(); $this->ThemeController->plugin = null; $this->ThemeController->name = 'Posts'; $this->ThemeController->viewPath = 'posts'; $this->ThemeController->layout = 'whatever'; $this->ThemeController->theme = 'my_theme'; $View = new TestThemeView($this->ThemeController); ob_start(); $result = $View->getLayoutFileName(); $expected = ob_get_clean(); $this->assertRegExp("/Missing Layout/", $expected); $this->assertRegExp("/views(\\/|\\\\)themed(\\/|\\\\)my_theme(\\/|\\\\)layouts(\\/|\\\\)whatever.ctp/", $expected); }
/** * testMissingLayout method * * @expectedException MissingLayoutException * @return void */ public function testMissingLayout() { $this->Controller->plugin = null; $this->Controller->name = 'Posts'; $this->Controller->viewPath = 'Posts'; $this->Controller->layout = 'whatever'; $View = new TestView($this->Controller); ob_start(); $result = $View->getLayoutFileName(); $expected = str_replace(array("\t", "\r\n", "\n"), "", ob_get_clean()); }
function testMissingLayout() { $this->Controller->plugin = null; $this->Controller->name = 'Posts'; $this->Controller->viewPath = 'posts'; $this->Controller->layout = 'whatever'; $View = new TestView($this->Controller); $expected = 'missingLayout'; $result = $View->getLayoutFileName(); $this->assertEqual($result, $expected); }