mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
fixes #4874, duplicate base when url is empty
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7186 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
069fb0011c
commit
df2be46b00
2 changed files with 19 additions and 4 deletions
|
@ -871,7 +871,7 @@ class Router extends Object {
|
|||
if (!isset($path['here'])) {
|
||||
$path['here'] = '/';
|
||||
}
|
||||
$output = $base . $path['here'];
|
||||
$output = $path['here'];
|
||||
} elseif (substr($url, 0, 1) == '/') {
|
||||
$output = $base . $url;
|
||||
} else {
|
||||
|
|
|
@ -255,6 +255,21 @@ class RouterTest extends UnitTestCase {
|
|||
*/
|
||||
function testUrlGeneration() {
|
||||
extract(Router::getNamedExpressions());
|
||||
|
||||
Router::setRequestInfo(array(
|
||||
array(
|
||||
'pass' => array(), 'action' => 'index', 'plugin' => null, 'controller' => 'subscribe',
|
||||
'admin' => true, 'url' => array('url' => '')
|
||||
),
|
||||
array(
|
||||
'base' => '/magazine', 'here' => '/magazine',
|
||||
'webroot' => '/magazine/', 'passedArgs' => array('page' => 2), 'namedArgs' => array('page' => 2),
|
||||
)
|
||||
));
|
||||
$result = Router::url();
|
||||
$this->assertEqual('/magazine', $result);
|
||||
|
||||
Router::reload();
|
||||
|
||||
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
|
||||
$out = Router::url(array('controller' => 'pages', 'action' => 'display', 'home'));
|
||||
|
@ -1281,7 +1296,7 @@ class RouterTest extends UnitTestCase {
|
|||
}
|
||||
/**
|
||||
* testParsingWithPrefixes method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -1313,7 +1328,7 @@ class RouterTest extends UnitTestCase {
|
|||
}
|
||||
/**
|
||||
* testPassedArgsOrder method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
@ -1354,7 +1369,7 @@ class RouterTest extends UnitTestCase {
|
|||
}
|
||||
/**
|
||||
* testRegexRouteMatching method
|
||||
*
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue