mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Fixing string-based URL generation inside plugins (Ticket #2588)
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5123 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
d2fb7d89ed
commit
540b1052d8
2 changed files with 20 additions and 1 deletions
|
@ -555,7 +555,10 @@ class Router extends Object {
|
|||
if (defined('CAKE_ADMIN') && isset($params[CAKE_ADMIN])) {
|
||||
$output .= CAKE_ADMIN . '/';
|
||||
}
|
||||
$output .= strtolower($params['controller']) . '/' . $url;
|
||||
if (!empty($params['plugin'])) {
|
||||
$output .= Inflector::underscore($params['plugin']) . '/';
|
||||
}
|
||||
$output .= Inflector::underscore($params['controller']) . '/' . $url;
|
||||
}
|
||||
$output = str_replace('//', '/', $output);
|
||||
}
|
||||
|
|
|
@ -158,6 +158,22 @@ class RouterTest extends UnitTestCase {
|
|||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
function testPluginUrlGeneration() {
|
||||
$this->router->setRequestInfo(array(
|
||||
array(
|
||||
'controller' => 'controller', 'action' => 'index', 'form' => array(),
|
||||
'url' => array (), 'bare' => 0, 'webservices' => null, 'plugin' => 'test'
|
||||
),
|
||||
array (
|
||||
'base' => '/base', 'here' => '/clients/sage/portal/donations', 'webroot' => '/base/',
|
||||
'passedArgs' => array (), 'argSeparator' => ':', 'namedArgs' => array (), 'webservices' => null
|
||||
)
|
||||
));
|
||||
|
||||
$this->assertEqual($this->router->url('read/1'), '/base/test/controller/read/1');
|
||||
$this->router->reload();
|
||||
}
|
||||
|
||||
function testUrlParsing() {
|
||||
extract($this->router->getNamedExpressions());
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue