Skip to content

Commit

Permalink
More tests passing in RouterTest now.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Nov 30, 2009
1 parent 11dd789 commit 3930388
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions cake/libs/router.php
Expand Up @@ -751,6 +751,7 @@ function url($url = null, $full = false) {
unset($url[$prefix]);
}
}

if (array_key_exists('plugin', $url)) {
$params['plugin'] = $url['plugin'];
}
Expand All @@ -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();
Expand Down Expand Up @@ -1355,7 +1357,6 @@ function match($url) {
$this->compile();
}
$defaults = $this->defaults;
$url += $defaults;

if (isset($defaults['prefix'])) {
$prefix = $defaults['prefix'];
Expand All @@ -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;
}

Expand Down Expand Up @@ -1413,7 +1414,6 @@ function match($url) {
}
}
return $this->_writeUrl(array_merge($url, compact('pass', 'named', 'prefix')));

//*/
/*
$defaults = $this->defaults;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion cake/tests/cases/libs/router.test.php
Expand Up @@ -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');

Expand Down

0 comments on commit 3930388

Please sign in to comment.