mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Adding another case that makes false/null to not cause match failure.
This commit is contained in:
parent
456a14cf37
commit
6ef8203d54
2 changed files with 14 additions and 1 deletions
|
@ -280,7 +280,7 @@ class CakeRoute {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// keys that don't exist are different.
|
// keys that don't exist are different.
|
||||||
if (!$keyExists) {
|
if (!$keyExists && !empty($value)) {
|
||||||
$diff[$key] = $value;
|
$diff[$key] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -289,6 +289,19 @@ class CakeRouteTestCase extends CakeTestCase {
|
||||||
$this->assertEqual($result, $expected);
|
$this->assertEqual($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test that falsey values do not interrupt a match.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testMatchWithFalseyValues() {
|
||||||
|
$route = new CakeRoute('/:controller/:action/*', array('plugin' => null));
|
||||||
|
$result = $route->match(array(
|
||||||
|
'controller' => 'posts', 'action' => 'index', 'plugin' => null, 'admin' => false
|
||||||
|
));
|
||||||
|
$this->assertEqual($result, '/posts/index/');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test match() with greedy routes, named parameters and passed args.
|
* test match() with greedy routes, named parameters and passed args.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue