Skip to content

Commit

Permalink
Updated test. Setting a prefix route param default is now just like s…
Browse files Browse the repository at this point in the history
…etting any other route param default.
  • Loading branch information
sgpinkus committed Feb 11, 2014
1 parent 3bb9b64 commit a7b1e34
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions tests/TestCase/Routing/RouterTest.php
Expand Up @@ -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);
}
Expand Down

0 comments on commit a7b1e34

Please sign in to comment.