mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Add tests for CakeRoute::match() and trailing * routes.
Add tests for /pages/** routes, and fix coding standards errors. Refs #3581
This commit is contained in:
parent
c622a9dfc2
commit
4362f7bf8b
2 changed files with 19 additions and 3 deletions
|
@ -536,11 +536,10 @@ class CakeRoute {
|
|||
$out = str_replace($search, $replace, $out);
|
||||
}
|
||||
|
||||
if (strpos($this->template, '**')) {
|
||||
if (strpos($this->template, '**') !== false) {
|
||||
$out = str_replace('**', $params['pass'], $out);
|
||||
$out = str_replace('%2F', '/', $out);
|
||||
}
|
||||
elseif (strpos($this->template, '*')) {
|
||||
} elseif (strpos($this->template, '*') !== false) {
|
||||
$out = str_replace('*', $params['pass'], $out);
|
||||
}
|
||||
$out = str_replace('//', '/', $out);
|
||||
|
|
|
@ -873,6 +873,23 @@ class CakeRouteTest extends CakeTestCase {
|
|||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test match() with trailing ** style routes.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testMatchTrailing() {
|
||||
$route = new CakeRoute('/pages/**', array('controller' => 'pages', 'action' => 'display'));
|
||||
$id = 'test/ spaces/漢字/la†în';
|
||||
$result = $route->match(array(
|
||||
'controller' => 'pages',
|
||||
'action' => 'display',
|
||||
$id
|
||||
));
|
||||
$expected = '/pages/test/%20spaces/%E6%BC%A2%E5%AD%97/la%E2%80%A0%C3%AEn';
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* test restructuring args with pass key
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue