diff --git a/tests/TestCase/View/ViewTest.php b/tests/TestCase/View/ViewTest.php index 2e7df10fa80..183d20be2f2 100644 --- a/tests/TestCase/View/ViewTest.php +++ b/tests/TestCase/View/ViewTest.php @@ -101,8 +101,8 @@ class TestThemeView extends View { /** * renderElement method * - * @param string $name - * @param array $params + * @param string $name Element name. + * @param array $params Params list. * @return string The given name */ public function renderElement($name, $params = array()) { @@ -195,7 +195,7 @@ class TestBeforeAfterHelper extends Helper { /** * beforeLayout method * - * @param string $viewFile + * @param string $viewFile View file name. * @return void */ public function beforeLayout($viewFile) { @@ -205,7 +205,7 @@ public function beforeLayout($viewFile) { /** * afterLayout method * - * @param string $layoutFile + * @param string $layoutFile Layout file name. * @return void */ public function afterLayout($layoutFile) { @@ -221,6 +221,11 @@ public function afterLayout($layoutFile) { */ class TestObjectWithToString { +/** + * Return string value. + * + * @return string + */ public function __toString() { return "I'm ObjectWithToString"; } @@ -272,7 +277,7 @@ public function setUp() { App::objects('Plugin', null, false); - Plugin::load(array('TestPlugin', 'TestPlugin', 'PluginJs', 'TestTheme')); + Plugin::load(['TestPlugin', 'PluginJs', 'TestTheme', 'Company/TestPluginThree']); Configure::write('debug', true); } @@ -301,7 +306,8 @@ public function testGetTemplate() { $request = $this->getMock('Cake\Network\Request'); $response = $this->getMock('Cake\Network\Response'); - $viewOptions = [ 'plugin' => null, + $viewOptions = [ + 'plugin' => null, 'name' => 'Pages', 'viewPath' => 'Pages' ]; @@ -331,6 +337,13 @@ public function testGetTemplate() { $expected = TEST_APP . 'TestApp' . DS . 'Template' . DS . 'Layout' . DS . 'Email' . DS . 'html' . DS . 'default.ctp'; $result = $ThemeView->getLayoutFileName(); $this->assertPathEquals($expected, $result); + + $ThemeView = new TestThemeView(null, null, null, $viewOptions); + + $ThemeView->theme = 'Company/TestPluginThree'; + $expected = Plugin::path('Company/TestPluginThree') . 'Template' . DS . 'Layout' . DS . 'default.ctp'; + $result = $ThemeView->getLayoutFileName(); + $this->assertPathEquals($expected, $result); } /** @@ -1279,8 +1292,9 @@ public static function blockValueProvider() { /** * Test appending to a block with append. * - * @dataProvider blockValueProvider + * @param mixed $value Value * @return void + * @dataProvider blockValueProvider */ public function testBlockAppend($value) { $this->View->assign('testBlock', 'Block'); @@ -1308,8 +1322,9 @@ public function testBlockAppendObjectWithoutToString() { /** * Test prepending to a block with prepend. * - * @dataProvider blockValueProvider + * @param mixed $value Value * @return void + * @dataProvider blockValueProvider */ public function testBlockPrepend($value) { $this->View->assign('test', 'Block'); diff --git a/tests/test_app/Plugin/Company/TestPluginThree/Template/Layout/default.ctp b/tests/test_app/Plugin/Company/TestPluginThree/Template/Layout/default.ctp new file mode 100644 index 00000000000..fcc83d5e54a --- /dev/null +++ b/tests/test_app/Plugin/Company/TestPluginThree/Template/Layout/default.ctp @@ -0,0 +1,2 @@ +default test_three_theme layout +fetch('content') ?>