Added a flag to Router::reverse that is passed on to the Router::url call

This commit is contained in:
Joey Trapp 2011-04-04 15:11:47 -05:00
parent fbab7bd9c3
commit 6a8322a272
2 changed files with 13 additions and 2 deletions

View file

@ -1060,7 +1060,7 @@ class Router {
* @access public
* @static
*/
function reverse($params) {
function reverse($params, $full = false) {
$pass = $params['pass'];
$named = $params['named'];
$url = $params['url'];
@ -1072,7 +1072,7 @@ class Router {
if (!empty($url)) {
$params['?'] = $url;
}
return Router::url($params);
return Router::url($params, $full);
}
/**

View file

@ -2147,6 +2147,17 @@ class RouterTest extends CakeTestCase {
);
$result = Router::reverse($params);
$this->assertEqual($result, '/eng/posts/view/1?foo=bar&baz=quu');
$params = array(
'lang' => 'eng',
'controller' => 'posts',
'action' => 'view',
'pass' => array(1),
'named' => array(),
'url' => array('url' => 'eng/posts/view/1')
);
$result = Router::reverse($params, true);
$this->assertPattern('/^http(s)?:\/\//', $result);
}
}