Browse Source

Rename folder "Element" to "element".

ADmad 7 years ago
parent
commit
34bd9fddf2
34 changed files with 11 additions and 18 deletions
  1. 3 10
      src/View/View.php
  2. 0 0
      templates/element/auto_table_warning.php
  3. 0 0
      templates/element/exception_stack_trace.php
  4. 0 0
      templates/element/exception_stack_trace_nav.php
  5. 0 0
      templates/element/plugin_class_error.php
  6. 2 2
      tests/TestCase/View/CellTest.php
  7. 6 6
      tests/TestCase/View/ViewTest.php
  8. 0 0
      tests/test_app/Plugin/TestPlugin/templates/Admin/element/plugin_element.php
  9. 0 0
      tests/test_app/Plugin/TestPlugin/templates/Admin/element/test_plugin_element.php
  10. 0 0
      tests/test_app/Plugin/TestPlugin/templates/element/Flash/plugin_element.php
  11. 0 0
      tests/test_app/Plugin/TestPlugin/templates/element/plugin_element.php
  12. 0 0
      tests/test_app/Plugin/TestPlugin/templates/element/sub_dir/sub_element.php
  13. 0 0
      tests/test_app/Plugin/TestPlugin/templates/element/translate.php
  14. 0 0
      tests/test_app/Plugin/TestTheme/templates/element/Flash/default.php
  15. 0 0
      tests/test_app/Plugin/TestTheme/templates/element/test_element.php
  16. 0 0
      tests/test_app/templates/Admin/element/Flash/default.php
  17. 0 0
      tests/test_app/templates/Admin/element/extended_element.php
  18. 0 0
      tests/test_app/templates/Admin/element/prefix_element.php
  19. 0 0
      tests/test_app/templates/Admin/element/test_element.php
  20. 0 0
      tests/test_app/templates/FooPrefix/BarPrefix/element/prefix_element.php
  21. 0 0
      tests/test_app/templates/FooPrefix/element/prefix_element_in_parent.php
  22. 0 0
      tests/test_app/templates/element/Flash/default.php
  23. 0 0
      tests/test_app/templates/element/Flash/error.php
  24. 0 0
      tests/test_app/templates/element/extended_element.php
  25. 0 0
      tests/test_app/templates/element/extended_missing_element.php
  26. 0 0
      tests/test_app/templates/element/flash_classy.php
  27. 0 0
      tests/test_app/templates/element/flash_helper.php
  28. 0 0
      tests/test_app/templates/element/html_call.php
  29. 0 0
      tests/test_app/templates/element/parent_element.php
  30. 0 0
      tests/test_app/templates/element/plugin_element.php
  31. 0 0
      tests/test_app/templates/element/session_helper.php
  32. 0 0
      tests/test_app/templates/element/test_element.php
  33. 0 0
      tests/test_app/templates/element/test_element.xml
  34. 0 0
      tests/test_app/templates/element/type_check.php

+ 3 - 10
src/View/View.php

@@ -282,13 +282,6 @@ class View implements EventDispatcherInterface
     public const TYPE_ELEMENT = 'element';
 
     /**
-     * Constant for name of view file 'Element'
-     *
-     * @var string
-     */
-    public const NAME_ELEMENT = 'Element';
-
-    /**
      * Constant for view file type 'layout'
      *
      * @var string
@@ -603,7 +596,7 @@ class View implements EventDispatcherInterface
         if (empty($options['ignoreMissing'])) {
             list ($plugin, $name) = pluginSplit($name, true);
             $name = str_replace('/', DIRECTORY_SEPARATOR, $name);
-            $file = $plugin . static::NAME_ELEMENT . DIRECTORY_SEPARATOR . $name . $this->_ext;
+            $file = $plugin . static::TYPE_ELEMENT . DIRECTORY_SEPARATOR . $name . $this->_ext;
             throw new MissingElementException([$file]);
         }
     }
@@ -961,7 +954,7 @@ class View implements EventDispatcherInterface
                     if (!$parent) {
                         list($plugin, $name) = $this->pluginSplit($name);
                         $paths = $this->_paths($plugin);
-                        $defaultPath = $paths[0] . static::NAME_ELEMENT . DIRECTORY_SEPARATOR;
+                        $defaultPath = $paths[0] . static::TYPE_ELEMENT . DIRECTORY_SEPARATOR;
                         throw new LogicException(sprintf(
                             'You cannot extend an element which does not exist (%s).',
                             $defaultPath . $name . $this->_ext
@@ -1353,7 +1346,7 @@ class View implements EventDispatcherInterface
         list($plugin, $name) = $this->pluginSplit($name, $pluginCheck);
 
         $paths = $this->_paths($plugin);
-        $elementPaths = $this->_getSubPaths(static::NAME_ELEMENT);
+        $elementPaths = $this->_getSubPaths(static::TYPE_ELEMENT);
 
         foreach ($paths as $path) {
             foreach ($elementPaths as $elementPath) {

templates/Element/auto_table_warning.php → templates/element/auto_table_warning.php


templates/Element/exception_stack_trace.php → templates/element/exception_stack_trace.php


templates/Element/exception_stack_trace_nav.php → templates/element/exception_stack_trace_nav.php


templates/Element/plugin_class_error.php → templates/element/plugin_class_error.php


+ 2 - 2
tests/TestCase/View/CellTest.php

@@ -287,7 +287,7 @@ class CellTest extends TestCase
     public function testPluginCellAlternateTemplate()
     {
         $cell = $this->View->cell('TestPlugin.Dummy::echoThis', ['msg' => 'hello world!']);
-        $cell->viewBuilder()->setTemplate('../../Element/translate');
+        $cell->viewBuilder()->setTemplate('../../element/translate');
         $this->assertContains('This is a translatable string', "{$cell}");
     }
 
@@ -299,7 +299,7 @@ class CellTest extends TestCase
     public function testPluginCellAlternateTemplateRenderParam()
     {
         $cell = $this->View->cell('TestPlugin.Dummy::echoThis', ['msg' => 'hello world!']);
-        $result = $cell->render('../../Element/translate');
+        $result = $cell->render('../../element/translate');
         $this->assertContains('This is a translatable string', $result);
     }
 

+ 6 - 6
tests/TestCase/View/ViewTest.php

@@ -921,7 +921,7 @@ class ViewTest extends TestCase
     public function testElementNonExistent()
     {
         $this->expectException(\Cake\View\Exception\MissingElementException::class);
-        $this->expectExceptionMessageRegExp('#^Element file "Element[\\\\/]non_existent_element\.php" is missing\.$#');
+        $this->expectExceptionMessageRegExp('#^Element file "element[\\\\/]non_existent_element\.php" is missing\.$#');
 
         $this->View->element('non_existent_element');
     }
@@ -934,7 +934,7 @@ class ViewTest extends TestCase
     public function testElementInexistentPluginElement()
     {
         $this->expectException(\Cake\View\Exception\MissingElementException::class);
-        $this->expectExceptionMessageRegExp('#^Element file "test_plugin\.Element[\\\\/]plugin_element\.php" is missing\.$#');
+        $this->expectExceptionMessageRegExp('#^Element file "test_plugin\.element[\\\\/]plugin_element\.php" is missing\.$#');
 
         $this->View->element('test_plugin.plugin_element');
     }
@@ -1394,11 +1394,11 @@ class ViewTest extends TestCase
         $this->PostsController->setPlugin('TestPlugin');
         $this->PostsController->setName('Posts');
         $View = $this->PostsController->createView('Cake\Test\TestCase\View\TestView');
-        $View->setTemplatePath('Element');
+        $View->setTemplatePath('element');
 
         $pluginPath = TEST_APP . 'Plugin' . DS . 'TestPlugin' . DS;
         $result = $View->getViewFileName('sub_dir/sub_element');
-        $expected = $pluginPath . 'templates' . DS . 'Element' . DS . 'sub_dir' . DS . 'sub_element.php';
+        $expected = $pluginPath . 'templates' . DS . 'element' . DS . 'sub_dir' . DS . 'sub_element.php';
         $this->assertPathEquals($expected, $result);
     }
 
@@ -1439,8 +1439,8 @@ class ViewTest extends TestCase
         $result = $View->getViewFileName('/Pages/home');
         $this->assertRegExp('/Pages(\/|\\\)home.php/', $result);
 
-        $result = $View->getViewFileName('../Element/test_element');
-        $this->assertRegExp('/Element(\/|\\\)test_element.php/', $result);
+        $result = $View->getViewFileName('../element/test_element');
+        $this->assertRegExp('/element(\/|\\\)test_element.php/', $result);
 
         $expected = TEST_APP . 'templates' . DS . 'Posts' . DS . 'index.php';
         $result = $View->getViewFileName('../Posts/index');

tests/test_app/Plugin/TestPlugin/templates/Admin/Element/plugin_element.php → tests/test_app/Plugin/TestPlugin/templates/Admin/element/plugin_element.php


tests/test_app/Plugin/TestPlugin/templates/Admin/Element/test_plugin_element.php → tests/test_app/Plugin/TestPlugin/templates/Admin/element/test_plugin_element.php


tests/test_app/Plugin/TestPlugin/templates/Element/Flash/plugin_element.php → tests/test_app/Plugin/TestPlugin/templates/element/Flash/plugin_element.php


tests/test_app/Plugin/TestPlugin/templates/Element/plugin_element.php → tests/test_app/Plugin/TestPlugin/templates/element/plugin_element.php


tests/test_app/Plugin/TestPlugin/templates/Element/sub_dir/sub_element.php → tests/test_app/Plugin/TestPlugin/templates/element/sub_dir/sub_element.php


tests/test_app/Plugin/TestPlugin/templates/Element/translate.php → tests/test_app/Plugin/TestPlugin/templates/element/translate.php


tests/test_app/Plugin/TestTheme/templates/Element/Flash/default.php → tests/test_app/Plugin/TestTheme/templates/element/Flash/default.php


tests/test_app/Plugin/TestTheme/templates/Element/test_element.php → tests/test_app/Plugin/TestTheme/templates/element/test_element.php


tests/test_app/templates/Admin/Element/Flash/default.php → tests/test_app/templates/Admin/element/Flash/default.php


tests/test_app/templates/Admin/Element/extended_element.php → tests/test_app/templates/Admin/element/extended_element.php


tests/test_app/templates/Admin/Element/prefix_element.php → tests/test_app/templates/Admin/element/prefix_element.php


tests/test_app/templates/Admin/Element/test_element.php → tests/test_app/templates/Admin/element/test_element.php


tests/test_app/templates/FooPrefix/BarPrefix/Element/prefix_element.php → tests/test_app/templates/FooPrefix/BarPrefix/element/prefix_element.php


tests/test_app/templates/FooPrefix/Element/prefix_element_in_parent.php → tests/test_app/templates/FooPrefix/element/prefix_element_in_parent.php


tests/test_app/templates/Element/Flash/default.php → tests/test_app/templates/element/Flash/default.php


tests/test_app/templates/Element/Flash/error.php → tests/test_app/templates/element/Flash/error.php


tests/test_app/templates/Element/extended_element.php → tests/test_app/templates/element/extended_element.php


tests/test_app/templates/Element/extended_missing_element.php → tests/test_app/templates/element/extended_missing_element.php


tests/test_app/templates/Element/flash_classy.php → tests/test_app/templates/element/flash_classy.php


tests/test_app/templates/Element/flash_helper.php → tests/test_app/templates/element/flash_helper.php


tests/test_app/templates/Element/html_call.php → tests/test_app/templates/element/html_call.php


tests/test_app/templates/Element/parent_element.php → tests/test_app/templates/element/parent_element.php


tests/test_app/templates/Element/plugin_element.php → tests/test_app/templates/element/plugin_element.php


tests/test_app/templates/Element/session_helper.php → tests/test_app/templates/element/session_helper.php


tests/test_app/templates/Element/test_element.php → tests/test_app/templates/element/test_element.php


tests/test_app/templates/Element/test_element.xml → tests/test_app/templates/element/test_element.xml


tests/test_app/templates/Element/type_check.php → tests/test_app/templates/element/type_check.php