mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 19:16:16 +00:00
Added a flag to Router::reverse that is passed on to the Router::url call
This commit is contained in:
parent
fbab7bd9c3
commit
6a8322a272
2 changed files with 13 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue