Skip to content

Commit

Permalink
Add tests for redirect().
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jun 25, 2014
1 parent 353324a commit b7f87e9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/TestCase/Routing/ScopedRouteCollectionTest.php
Expand Up @@ -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.