Permalink
Browse files

Updated test. Setting a prefix route param default is now just like s…

…etting any other route param default.
  • Loading branch information...
1 parent 3bb9b64 commit a7b1e34c1b18abd07daaa4d793aef200daffb24c @sam-at-github sam-at-github committed Feb 11, 2014
Showing with 17 additions and 2 deletions.
  1. +17 −2 tests/TestCase/Routing/RouterTest.php
@@ -1846,21 +1846,36 @@ public function testPrefixOverride() {
}
/**
- * Test that setting a prefix to false is ignored, as its generally user error.
+ * Test that setting a prefix to is just like setting any other default route parameter.
*
* @return void
*/
- public function testPrefixFalseIgnored() {
+ public function testPrefixJustADefault() {
Configure::write('Routing.prefixes', array('admin'));
Router::reload();
Router::connect('/cache_css/*', array('prefix' => false, 'controller' => 'asset_compress', 'action' => 'get'));
$url = Router::url(array('controller' => 'asset_compress', 'action' => 'get', 'test'));
+ $expected = '/';
+ $this->assertEquals($expected, $url);
+
+ $url = Router::url(array('prefix' => false, 'controller' => 'asset_compress', 'action' => 'get', 'test'));
$expected = '/cache_css/test';
$this->assertEquals($expected, $url);
+ Router::reload();
+ Router::connect('/cache_css/*', array('prefix' => false, 'anything' => false, 'controller' => 'asset_compress', 'action' => 'get'));
+
+ $url = Router::url(array('controller' => 'asset_compress', 'action' => 'get', 'test'));
+ $expected = '/';
+ $this->assertEquals($expected, $url);
+
$url = Router::url(array('prefix' => false, 'controller' => 'asset_compress', 'action' => 'get', 'test'));
+ $expected = '/';
+ $this->assertEquals($expected, $url);
+
+ $url = Router::url(array('prefix' => false, 'anything' => false, 'controller' => 'asset_compress', 'action' => 'get', 'test'));
$expected = '/cache_css/test';
$this->assertEquals($expected, $url);
}

0 comments on commit a7b1e34

Please sign in to comment.