Permalink
Browse files

Adding tests for querystring reversal.

  • Loading branch information...
1 parent 886cd9e commit 5b78a662e805b15308530362286d1529f8d5bf13 @markstory markstory committed Dec 28, 2009
Showing with 12 additions and 1 deletion.
  1. +1 −1 cake/libs/router.php
  2. +11 −0 cake/tests/cases/libs/router.test.php
View
@@ -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);
}
@@ -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');
}
}

0 comments on commit 5b78a66

Please sign in to comment.