Skip to content

Commit

Permalink
Adding tests for querystring reversal.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Dec 28, 2009
1 parent 886cd9e commit 5b78a66
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cake/libs/router.php
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ function reverse($params) {
unset($params['pass'], $params['named'], $params['url'], $url['url']);
$params = array_merge($params, $pass, $named);
if (!empty($url)) {
$params['q'] = $url;
$params['?'] = $url;
}
return Router::url($params);
}
Expand Down
11 changes: 11 additions & 0 deletions cake/tests/cases/libs/router.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -1980,6 +1980,17 @@ function testRouterReverse() {
);
$result = Router::reverse($params);
$this->assertEqual($result, '/eng/posts/view/1');

$params = array(
'lang' => 'eng',
'controller' => 'posts',
'action' => 'view',
'pass' => array(1),
'named' => array(),
'url' => array('url' => 'eng/posts/view/1', 'foo' => 'bar', 'baz' => 'quu')
);
$result = Router::reverse($params);
$this->assertEqual($result, '/eng/posts/view/1?foo=bar&baz=quu');
}
}

Expand Down

0 comments on commit 5b78a66

Please sign in to comment.