mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
fixes #3260, Router generating wrong url
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5684 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
15e943fff8
commit
643da0ab97
2 changed files with 24 additions and 11 deletions
|
@ -722,13 +722,13 @@ class Router extends Object {
|
|||
|
||||
$urlOut = Set::filter(array($url['controller'], $url['action']));
|
||||
|
||||
if($admin && isset($url['admin'])) {
|
||||
array_unshift($urlOut, $admin);
|
||||
}
|
||||
|
||||
if (isset($url['plugin']) && $url['plugin'] != $url['controller']) {
|
||||
array_unshift($urlOut, $url['plugin']);
|
||||
}
|
||||
|
||||
if($admin && isset($url['admin'])) {
|
||||
array_unshift($urlOut, $admin);
|
||||
}
|
||||
$output = join('/', $urlOut) . '/';
|
||||
}
|
||||
|
||||
|
|
|
@ -458,6 +458,19 @@ class RouterTest extends UnitTestCase {
|
|||
$result = $this->router->url(array('plugin' => null, 'controller' => 'pages', 'action' => 'edit', 'id' => '284'));
|
||||
$expected = '/admin/pages/edit/284';
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$this->router->reload();
|
||||
$this->router->setRequestInfo(array(
|
||||
array ('plugin' => 'shows', 'controller' => 'show_tickets', 'action' => 'admin_edit', 'pass' =>
|
||||
array (0 => '6'), 'prefix' => 'admin', 'admin' => true, 'form' => array (), 'url' =>
|
||||
array ('url' => 'admin/shows/show_tickets/edit/6'), 'bare' => 0, 'webservices' => NULL),
|
||||
array ('plugin' => NULL, 'controller' => NULL, 'action' => NULL, 'base' => '', 'here' => '/admin/shows/show_tickets/edit/6', 'webroot' => '/')));
|
||||
|
||||
$this->router->parse('/');
|
||||
|
||||
$result = $this->router->url(array ( 'plugin' => 'shows', 'controller' => 'show_tickets', 'action' => 'edit', 'id' => '6', 'admin' => true, 'prefix' => 'admin', ));
|
||||
$expected = '/admin/shows/show_tickets/edit/6';
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
function testUrlGenerationWithExtensions() {
|
||||
|
|
Loading…
Reference in a new issue