From 589be7a6c5e9b63ea2380372412aa9cd07189f35 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Thu, 15 Sep 2016 21:47:38 -0400 Subject: [PATCH] Add tests for #9246 Remove a redundant element, and add an element for testing `plugin=>false` mode. --- tests/TestCase/View/ViewTest.php | 11 +++++++---- .../src/Template/Element/plugin_element.ctp | 2 +- .../src/Template/Element/test_plugin_element.ctp | 1 - .../TestApp/Template/Element/plugin_element.ctp | 1 + 4 files changed, 9 insertions(+), 6 deletions(-) delete mode 100644 tests/test_app/Plugin/TestPlugin/src/Template/Element/test_plugin_element.ctp create mode 100644 tests/test_app/TestApp/Template/Element/plugin_element.ctp diff --git a/tests/TestCase/View/ViewTest.php b/tests/TestCase/View/ViewTest.php index 206054b8c39..d6f6ab46708 100644 --- a/tests/TestCase/View/ViewTest.php +++ b/tests/TestCase/View/ViewTest.php @@ -844,7 +844,7 @@ public function testElementExists() $this->assertFalse($result); $this->View->plugin = 'TestPlugin'; - $result = $this->View->elementExists('test_plugin_element'); + $result = $this->View->elementExists('plugin_element'); $this->assertTrue($result); } @@ -859,11 +859,14 @@ public function testElement() $this->assertEquals('this is the test element', $result); $result = $this->View->element('TestPlugin.plugin_element'); - $this->assertEquals('this is the plugin element using params[plugin]', $result); + $this->assertEquals("Element in the TestPlugin\n", $result); $this->View->plugin = 'TestPlugin'; - $result = $this->View->element('test_plugin_element'); - $this->assertEquals('this is the test set using View::$plugin plugin element', $result); + $result = $this->View->element('plugin_element'); + $this->assertEquals("Element in the TestPlugin\n", $result); + + $result = $this->View->element('plugin_element', [], ['plugin' => false]); + $this->assertEquals("Plugin element overridden in app\n", $result); } /** diff --git a/tests/test_app/Plugin/TestPlugin/src/Template/Element/plugin_element.ctp b/tests/test_app/Plugin/TestPlugin/src/Template/Element/plugin_element.ctp index 3fcb903476d..27e4dc015a4 100644 --- a/tests/test_app/Plugin/TestPlugin/src/Template/Element/plugin_element.ctp +++ b/tests/test_app/Plugin/TestPlugin/src/Template/Element/plugin_element.ctp @@ -1 +1 @@ -this is the plugin element using params[plugin] \ No newline at end of file +Element in the TestPlugin diff --git a/tests/test_app/Plugin/TestPlugin/src/Template/Element/test_plugin_element.ctp b/tests/test_app/Plugin/TestPlugin/src/Template/Element/test_plugin_element.ctp deleted file mode 100644 index 99cc002d28c..00000000000 --- a/tests/test_app/Plugin/TestPlugin/src/Template/Element/test_plugin_element.ctp +++ /dev/null @@ -1 +0,0 @@ -this is the test set using View::$plugin plugin element \ No newline at end of file diff --git a/tests/test_app/TestApp/Template/Element/plugin_element.ctp b/tests/test_app/TestApp/Template/Element/plugin_element.ctp new file mode 100644 index 00000000000..a9ce0ad9e4c --- /dev/null +++ b/tests/test_app/TestApp/Template/Element/plugin_element.ctp @@ -0,0 +1 @@ +Plugin element overridden in app