Adding tests for querystring reversal.

This commit is contained in:
Mark Story 2009-12-27 23:10:29 -05:00
parent 886cd9e719
commit 5b78a662e8
2 changed files with 12 additions and 1 deletions

View file

@ -997,7 +997,7 @@ class Router {
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);
}

View file

@ -1980,6 +1980,17 @@ class RouterTest extends CakeTestCase {
);
$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');
}
}