mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
updating router test
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5471 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
dee2ea4f68
commit
d6c4229d81
2 changed files with 11 additions and 6 deletions
|
@ -318,9 +318,9 @@ class Router extends Object {
|
|||
if (is_array($defaults)) {
|
||||
foreach ($defaults as $name => $value) {
|
||||
if (preg_match('#[a-zA-Z_\-]#i', $name)) {
|
||||
$out[$name] = $_this->stripEscape($value);
|
||||
$out[$name] = $value;
|
||||
} else {
|
||||
$out['pass'][] = $_this->stripEscape($value);
|
||||
$out['pass'][] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ class Router extends Object {
|
|||
foreach (Set::filter($r, true) as $key => $found) {
|
||||
// if $found is a named url element (i.e. ':action')
|
||||
if (isset($names[$key])) {
|
||||
$out[$names[$key]] = $found;
|
||||
$out[$names[$key]] = $_this->stripEscape($found);
|
||||
} elseif (isset($names[$key]) && empty($names[$key]) && empty($out[$names[$key]])) {
|
||||
break; //leave the default values;
|
||||
} else {
|
||||
|
|
|
@ -254,7 +254,7 @@ class RouterTest extends UnitTestCase {
|
|||
$result = $this->router->parse('/pages/display/home');
|
||||
$expected = array('pass' => array ('home'), 'controller' => 'pages', 'action' => 'display');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
|
||||
$result = $this->router->parse('pages/display/home/');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
|
@ -350,8 +350,13 @@ class RouterTest extends UnitTestCase {
|
|||
|
||||
function testPagesUrlParsing() {
|
||||
$this->router->routes = array();
|
||||
Router::connect('/', array('controller' => 'posts', 'action' => 'index'));
|
||||
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display', 'home'));
|
||||
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
|
||||
Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
|
||||
|
||||
$result = $this->router->parse('/');
|
||||
$expected = array('pass'=>array('home'), 'plugin'=> null, 'controller'=>'pages', 'action'=>'display');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
||||
$result = $this->router->parse('/pages/home/');
|
||||
$expected = array('pass'=>array('home'), 'plugin'=> null, 'controller'=>'pages', 'action'=>'display');
|
||||
$this->assertEqual($result, $expected);
|
||||
|
|
Loading…
Reference in a new issue