Permalink
Browse files

More tests passing in RouterTest now.

  • Loading branch information...
1 parent 11dd789 commit 393038816c7327cd0e9749ac58cbcbf846af54d5 @markstory markstory committed Nov 30, 2009
Showing with 5 additions and 5 deletions.
  1. +4 −4 cake/libs/router.php
  2. +1 −1 cake/tests/cases/libs/router.test.php
@@ -751,6 +751,7 @@ function url($url = null, $full = false) {
unset($url[$prefix]);
}
}
+
if (array_key_exists('plugin', $url)) {
$params['plugin'] = $url['plugin'];
}
@@ -774,6 +775,7 @@ function url($url = null, $full = false) {
if (isset($route->params['persist'], $params)) {
$url = $route->persistParams($url, array_merge($params, $backupUrl));
}
+
if ($match = $route->match($url)) {
$output = trim($match, '/');
$url = array();
@@ -1355,7 +1357,6 @@ function match($url) {
$this->compile();
}
$defaults = $this->defaults;
- $url += $defaults;
if (isset($defaults['prefix'])) {
$prefix = $defaults['prefix'];
@@ -1370,7 +1371,7 @@ function match($url) {
$diff = Set::diff($url, $defaults);
//if a not a greedy route, no extra params are allowed.
- if (!$this->_greedy && array_keys($diff) != $this->keys) {
+ if (!$this->_greedy && array_diff_key($diff, $keyNames) != array()) {
return false;
}
@@ -1413,7 +1414,6 @@ function match($url) {
}
}
return $this->_writeUrl(array_merge($url, compact('pass', 'named', 'prefix')));
-
//*/
/*
$defaults = $this->defaults;
@@ -1446,7 +1446,7 @@ function match($url) {
}
list($named, $params) = Router::getNamedElements($params);
- if (!strpos($this->template, '*') && (!empty($pass) || !empty($named))) {
+ if (!$this->_greedy && (!empty($pass) || !empty($named))) {
return false;
}
$routeParams = $this->keys;
@@ -966,7 +966,7 @@ function testPersistentParameters() {
array('controller' => 'posts', 'action' => 'index'),
array('persist' => array('lang')
));
- Router::connect('/:lang/:color/posts/edit/*', array('controller' => 'posts', 'action' => 'index'));
+ Router::connect('/:lang/:color/posts/edit/*', array('controller' => 'posts', 'action' => 'edit'));
Router::connect('/about', array('controller' => 'pages', 'action' => 'view', 'about'));
Router::parse('/en/red/posts/view/5');

0 comments on commit 3930388

Please sign in to comment.