Skip to content

Commit

Permalink
Fix failing tests in RedirectRoute.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jul 4, 2012
1 parent 18e52d3 commit 84d57e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/Routing/Route/RedirectRoute.php
Expand Up @@ -80,7 +80,7 @@ public function parse($url) {
$redirect = $this->redirect[0];
}
if (isset($this->options['persist']) && is_array($redirect)) {
$redirect += array('named' => $params['named'], 'pass' => $params['pass'], 'url' => array());
$redirect += array('pass' => $params['pass'], 'url' => array());
$redirect = Router::reverse($redirect);
}
$status = 301;
Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/Test/TestCase/Routing/Route/RedirectRouteTest.php
Expand Up @@ -97,14 +97,14 @@ public function testParsing() {
$route = new RedirectRoute('/my_controllers/:action/*', array('controller' => 'tags', 'action' => 'add'), array('persist' => true));
$route->stop = false;
$route->response = $this->getMock('Cake\Network\Response', array('_sendHeader'));
$result = $route->parse('/my_controllers/do_something/passme/named:param');
$result = $route->parse('/my_controllers/do_something/passme');
$header = $route->response->header();
$this->assertEquals(Router::url('/tags/add/passme/named:param', true), $header['Location']);
$this->assertEquals(Router::url('/tags/add/passme', true), $header['Location']);

$route = new RedirectRoute('/my_controllers/:action/*', array('controller' => 'tags', 'action' => 'add'));
$route->stop = false;
$route->response = $this->getMock('Cake\Network\Response', array('_sendHeader'));
$result = $route->parse('/my_controllers/do_something/passme/named:param');
$result = $route->parse('/my_controllers/do_something/passme');
$header = $route->response->header();
$this->assertEquals(Router::url('/tags/add', true), $header['Location']);
}
Expand Down

0 comments on commit 84d57e2

Please sign in to comment.