Browse Source

Deprecated View::uuid() as it's unused in core.

ADmad 7 years ago
parent
commit
5570206d3f
2 changed files with 13 additions and 8 deletions
  1. 4 1
      src/View/View.php
  2. 9 7
      tests/TestCase/View/ViewTest.php

+ 4 - 1
src/View/View.php

@@ -198,7 +198,7 @@ class View implements EventDispatcherInterface
      * List of generated DOM UUIDs.
      *
      * @var array
-     * @deprecated 3.7.0 The property is unused and will be removed in 4.0.0.
+     * @deprecated 3.7.0 The property is deprecated and will be removed in 4.0.0.
      */
     public $uuids = [];
 
@@ -1143,9 +1143,12 @@ class View implements EventDispatcherInterface
      * @param string $object Type of object, i.e. 'form' or 'link'
      * @param string $url The object's target URL
      * @return string
+     * @deprecated 3.7.0 This method is deprecated and will be removed in 4.0.0.
      */
     public function uuid($object, $url)
     {
+        deprecationWarning('View::uuid() is deprecated and will be removed in 4.0.0.');
+
         $c = 1;
         $url = Router::url($url);
         $hash = $object . substr(md5($object . $url), 0, 10);

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

@@ -858,15 +858,17 @@ class ViewTest extends TestCase
      */
     public function testUUIDGeneration()
     {
-        Router::connect('/:controller', ['action' => 'index']);
-        $result = $this->View->uuid('form', ['controller' => 'posts', 'action' => 'index']);
-        $this->assertEquals('form5988016017', $result);
+        $this->deprecated(function () {
+            Router::connect('/:controller', ['action' => 'index']);
+            $result = $this->View->uuid('form', ['controller' => 'posts', 'action' => 'index']);
+            $this->assertEquals('form5988016017', $result);
 
-        $result = $this->View->uuid('form', ['controller' => 'posts', 'action' => 'index']);
-        $this->assertEquals('formc3dc6be854', $result);
+            $result = $this->View->uuid('form', ['controller' => 'posts', 'action' => 'index']);
+            $this->assertEquals('formc3dc6be854', $result);
 
-        $result = $this->View->uuid('form', ['controller' => 'posts', 'action' => 'index']);
-        $this->assertEquals('form28f92cc87f', $result);
+            $result = $this->View->uuid('form', ['controller' => 'posts', 'action' => 'index']);
+            $this->assertEquals('form28f92cc87f', $result);
+        });
     }
 
     /**