Skip to content

Commit

Permalink
Remove runtime errors for router deprecations.
Browse files Browse the repository at this point in the history
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 62683ba
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
12 changes: 0 additions & 12 deletions src/Routing/Router.php
Expand Up @@ -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];
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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'] = [];
Expand Down
19 changes: 0 additions & 19 deletions tests/TestCase/Routing/RouterTest.php
Expand Up @@ -134,7 +134,6 @@ public function testRouteDefaultParams()
*/
public function testMapResources()
{
$restore = error_reporting(E_ALL ^ E_USER_DEPRECATED);
Router::mapResources('Posts');

$expected = [
Expand Down Expand Up @@ -225,7 +224,6 @@ public function testMapResources()
];
$result = Router::parse('/posts/name', 'PUT');
$this->assertEquals($expected, $result);
error_reporting($restore);
}

/**
Expand All @@ -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');
Expand All @@ -258,7 +255,6 @@ public function testPluginMapResources()
'_method' => 'GET',
];
$this->assertEquals($expected, $result);
error_reporting($restore);
}

/**
Expand All @@ -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');
Expand All @@ -282,7 +277,6 @@ public function testMapResourcesWithPrefix()
'_method' => 'GET',
];
$this->assertEquals($expected, $result);
error_reporting($restore);
}

/**
Expand All @@ -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']);

Expand All @@ -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' => [
Expand All @@ -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);
}

/**
Expand All @@ -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');
Expand All @@ -369,7 +358,6 @@ public function testPluginMapResourcesWithPrefix()
'prefix' => 'api',
];
$this->assertEquals($expected, $result);
error_reporting($restore);
}

/**
Expand Down Expand Up @@ -409,7 +397,6 @@ public function testMultipleResourceRoute()
*/
public function testGenerateUrlResourceRoute()
{
$restore = error_reporting(E_ALL ^ E_USER_DEPRECATED);
Router::mapResources('Posts');

$result = Router::url([
Expand Down Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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);
}

/**
Expand All @@ -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',
Expand Down Expand Up @@ -2800,7 +2782,6 @@ public function testParseNamedParameters()
]
];
$this->assertEquals($expected, $request->params);
error_reporting($restore);
}

/**
Expand Down

0 comments on commit 62683ba

Please sign in to comment.