Skip to content
Permalink
Browse files

Remove runtime errors for router deprecations.

We'll start with documentation tags for now. In a future release runtime
errors will be added.
  • Loading branch information...
markstory committed Mar 26, 2016
1 parent 9a66879 commit 62683ba557918c86fc2b69197661adb66f89170c
Showing with 0 additions and 31 deletions.
  1. +0 −12 src/Routing/Router.php
  2. +0 −19 tests/TestCase/Routing/RouterTest.php
@@ -223,10 +223,6 @@ public static function connect($route, $defaults = [], $options = [])
*/
public static function redirect($route, $url, $options = [])
{
trigger_error(
'Router::redirect() is deprecated. Use Router::scope() and $routes->redirect() instead.',
E_USER_DEPRECATED
);
$options['routeClass'] = 'Cake\Routing\Route\RedirectRoute';
if (is_string($url)) {
$url = ['redirect' => $url];
@@ -289,10 +285,6 @@ public static function redirect($route, $url, $options = [])
*/
public static function mapResources($controller, $options = [])
{
trigger_error(
'Router::mapResources() is deprecated. Use Router::scope() and $routes->resources() instead.',
E_USER_DEPRECATED
);
foreach ((array)$controller as $name) {
list($plugin, $name) = pluginSplit($name);
@@ -812,10 +804,6 @@ public static function extensions($extensions = null, $merge = true)
*/
public static function parseNamedParams(Request $request, array $options = [])
{
trigger_error(
'Router::parseNamedParams() is deprecated and will be removed in 4.0.',
E_USER_DEPRECATED
);
$options += ['separator' => ':'];
if (empty($request->params['pass'])) {
$request->params['named'] = [];
@@ -134,7 +134,6 @@ public function testRouteDefaultParams()
*/
public function testMapResources()
{
$restore = error_reporting(E_ALL ^ E_USER_DEPRECATED);
Router::mapResources('Posts');
$expected = [
@@ -225,7 +224,6 @@ public function testMapResources()
];
$result = Router::parse('/posts/name', 'PUT');
$this->assertEquals($expected, $result);
error_reporting($restore);
}
/**
@@ -235,7 +233,6 @@ public function testMapResources()
*/
public function testPluginMapResources()
{
$restore = error_reporting(E_ALL ^ E_USER_DEPRECATED);
Router::mapResources('TestPlugin.TestPlugin');
$result = Router::parse('/test_plugin/test_plugin', 'GET');
@@ -258,7 +255,6 @@ public function testPluginMapResources()
'_method' => 'GET',
];
$this->assertEquals($expected, $result);
error_reporting($restore);
}
/**
@@ -268,7 +264,6 @@ public function testPluginMapResources()
*/
public function testMapResourcesWithPrefix()
{
$restore = error_reporting(E_ALL ^ E_USER_DEPRECATED);
Router::mapResources('Posts', ['prefix' => 'api']);
$result = Router::parse('/api/posts', 'GET');
@@ -282,7 +277,6 @@ public function testMapResourcesWithPrefix()
'_method' => 'GET',
];
$this->assertEquals($expected, $result);
error_reporting($restore);
}
/**
@@ -292,7 +286,6 @@ public function testMapResourcesWithPrefix()
*/
public function testMapResourcesWithExtension()
{
$restore = error_reporting(E_ALL ^ E_USER_DEPRECATED);
Router::extensions(['json', 'xml'], false);
Router::mapResources('Posts', ['_ext' => 'json']);
@@ -313,15 +306,13 @@ public function testMapResourcesWithExtension()
$result = Router::parse('/posts.xml', 'GET');
$this->assertArrayNotHasKey('_method', $result, 'Not an extension/resource route.');
error_reporting($restore);
}
/**
* testMapResources with custom connectOptions
*/
public function testMapResourcesConnectOptions()
{
$restore = error_reporting(E_ALL ^ E_USER_DEPRECATED);
Plugin::load('TestPlugin');
Router::mapResources('Posts', [
'connectOptions' => [
@@ -333,7 +324,6 @@ public function testMapResourcesConnectOptions()
$route = $routes[0];
$this->assertInstanceOf('TestPlugin\Routing\Route\TestRoute', $route);
$this->assertEquals('^(bar)$', $route->options['foo']);
error_reporting($restore);
}
/**
@@ -343,7 +333,6 @@ public function testMapResourcesConnectOptions()
*/
public function testPluginMapResourcesWithPrefix()
{
$restore = error_reporting(E_ALL ^ E_USER_DEPRECATED);
Router::mapResources('TestPlugin.TestPlugin', ['prefix' => 'api']);
$result = Router::parse('/api/test_plugin/test_plugin', 'GET');
@@ -369,7 +358,6 @@ public function testPluginMapResourcesWithPrefix()
'prefix' => 'api',
];
$this->assertEquals($expected, $result);
error_reporting($restore);
}
/**
@@ -409,7 +397,6 @@ public function testMultipleResourceRoute()
*/
public function testGenerateUrlResourceRoute()
{
$restore = error_reporting(E_ALL ^ E_USER_DEPRECATED);
Router::mapResources('Posts');
$result = Router::url([
@@ -444,7 +431,6 @@ public function testGenerateUrlResourceRoute()
$result = Router::url(['controller' => 'Posts', 'action' => 'edit', '_method' => 'PATCH', 'id' => 10]);
$expected = '/posts/10';
$this->assertEquals($expected, $result);
error_reporting($restore);
}
/**
@@ -2753,12 +2739,10 @@ public function testPatternOnAction()
*/
public function testRedirect()
{
$restore = error_reporting(E_ALL ^ E_USER_DEPRECATED);
Router::redirect('/mobile', '/', ['status' => 301]);
$routes = Router::routes();
$route = $routes[0];
$this->assertInstanceOf('Cake\Routing\Route\RedirectRoute', $route);
error_reporting($restore);
}
/**
@@ -2768,8 +2752,6 @@ public function testRedirect()
*/
public function testParseNamedParameters()
{
$restore = error_reporting(E_ALL ^ E_USER_DEPRECATED);
$request = new Request();
$request->addParams([
'controller' => 'posts',
@@ -2800,7 +2782,6 @@ public function testParseNamedParameters()
]
];
$this->assertEquals($expected, $request->params);
error_reporting($restore);
}
/**

0 comments on commit 62683ba

Please sign in to comment.
You can’t perform that action at this time.