Browse Source

Add tests for #9246

Remove a redundant element, and add an element for testing
`plugin=>false` mode.
Mark Story 9 years ago
parent
commit
589be7a6c5

+ 7 - 4
tests/TestCase/View/ViewTest.php

@@ -844,7 +844,7 @@ class ViewTest extends TestCase
         $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 @@ class ViewTest extends TestCase
         $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);
     }
 
     /**

+ 1 - 1
tests/test_app/Plugin/TestPlugin/src/Template/Element/plugin_element.ctp

@@ -1 +1 @@
-this is the plugin element using params[plugin]
+Element in the TestPlugin

+ 0 - 1
tests/test_app/Plugin/TestPlugin/src/Template/Element/test_plugin_element.ctp

@@ -1 +0,0 @@
-this is the test set using View::$plugin plugin element

+ 1 - 0
tests/test_app/TestApp/Template/Element/plugin_element.ctp

@@ -0,0 +1 @@
+Plugin element overridden in app