From ffe113148597c248f5090facef298b9855fcc089 Mon Sep 17 00:00:00 2001 From: Elias De Vos Date: Tue, 16 Jan 2018 10:46:12 +0100 Subject: [PATCH] add use at top and use assertNull --- src/Routing/Router.php | 3 ++- tests/TestCase/Routing/RouterTest.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Routing/Router.php b/src/Routing/Router.php index 3aaadeecc11..099bbf8160c 100644 --- a/src/Routing/Router.php +++ b/src/Routing/Router.php @@ -17,6 +17,7 @@ use Cake\Core\Configure; use Cake\Http\ServerRequest; use Cake\Utility\Inflector; +use Cake\Routing\Exception\MissingRouteException; use Psr\Http\Message\ServerRequestInterface; /** @@ -725,7 +726,7 @@ public static function urlOrNull($url = null, $full = false) { try { return static::url($url, $full); - } catch (\Cake\Routing\Exception\MissingRouteException $e) { + } catch (MissingRouteException $e) { return null; } } diff --git a/tests/TestCase/Routing/RouterTest.php b/tests/TestCase/Routing/RouterTest.php index d81e33b5f89..69bb078175e 100644 --- a/tests/TestCase/Routing/RouterTest.php +++ b/tests/TestCase/Routing/RouterTest.php @@ -139,7 +139,7 @@ public function testRouteUrlOrNull() Router::connect('/:controller/:action', ['controller' => 'posts']); $this->assertEquals(Router::urlOrNull(['action' => 'view']), '/view'); - $this->assertEquals(Router::urlOrNull(['action' => 'view', 'controller' => 'users', 'plugin' => 'test']), null); + $this->assertNull(Router::urlOrNull(['action' => 'view', 'controller' => 'users', 'plugin' => 'test'])); } /**