From 5570206d3fbbfbab92abe552e297ba34bf3045f8 Mon Sep 17 00:00:00 2001 From: ADmad Date: Wed, 13 Jun 2018 14:21:11 +0530 Subject: [PATCH] Deprecated View::uuid() as it's unused in core. --- src/View/View.php | 5 ++++- tests/TestCase/View/ViewTest.php | 16 +++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/View/View.php b/src/View/View.php index 5f88bad8fcb..6be70042e47 100644 --- a/src/View/View.php +++ b/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 @@ public function extend($name) * @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); diff --git a/tests/TestCase/View/ViewTest.php b/tests/TestCase/View/ViewTest.php index 23bb75d999e..21b4999877d 100644 --- a/tests/TestCase/View/ViewTest.php +++ b/tests/TestCase/View/ViewTest.php @@ -858,15 +858,17 @@ public function testViewVars() */ 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); + }); } /**