Skip to content
Permalink
Browse files

Add tests for redirect().

  • Loading branch information...
markstory committed Jun 24, 2014
1 parent 353324a commit b7f87e98a4d9d5a9eb1b1a799be43d9809960eca
Showing with 19 additions and 0 deletions.
  1. +19 −0 tests/TestCase/Routing/ScopedRouteCollectionTest.php
@@ -149,4 +149,23 @@ public function testConnectErrorInvalidRouteClass() {
$routes->connect('/:controller', [], ['routeClass' => '\StdClass']);
}
/**
* Test connecting redirect routes.
*
* @return void
*/
public function testRedirect() {
$routes = new ScopedRouteCollection('/');
$routes->redirect('/p/:id', ['controller' => 'posts', 'action' => 'view'], ['status' => 301]);
$route = $routes->routes()[0];
$this->assertInstanceOf('Cake\Routing\Route\RedirectRoute', $route);
$routes->redirect('/old', '/forums', ['status' => 301]);
$route = $routes->routes()[1];
$this->assertInstanceOf('Cake\Routing\Route\RedirectRoute', $route);
$this->assertEquals('/forums', $route->redirect[0]);
}
}

0 comments on commit b7f87e9

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