Allowing routes to set an extension when Router::parseExtension() is

being used.  Fixes 

Signed-off-by: Mark Story <mark@mark-story.com>
This commit is contained in:
Juan Basso 2010-03-20 17:57:01 -03:00 committed by Mark Story
parent cc59b04ad3
commit 5e8665cd8d
2 changed files with 8 additions and 1 deletions
cake
libs
tests/cases/libs

View file

@ -497,7 +497,7 @@ class Router {
} }
} }
if (!empty($ext)) { if (!empty($ext) && !isset($out['url']['ext'])) {
$out['url']['ext'] = $ext; $out['url']['ext'] = $ext;
} }
return $out; return $out;

View file

@ -1212,6 +1212,13 @@ class RouterTest extends CakeTestCase {
$result = Router::parse('/controller/action'); $result = Router::parse('/controller/action');
$expected = array('controller' => 'controller', 'action' => 'action', 'plugin' => null, 'url' => array('ext' => 'rss'), 'named' => array(), 'pass' => array()); $expected = array('controller' => 'controller', 'action' => 'action', 'plugin' => null, 'url' => array('ext' => 'rss'), 'named' => array(), 'pass' => array());
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
Router::reload();
Router::parseExtensions('rss');
Router::connect('/controller/action', array('controller' => 'controller', 'action' => 'action', 'url' => array('ext' => 'rss')));
$result = Router::parse('/controller/action');
$expected = array('controller' => 'controller', 'action' => 'action', 'plugin' => null, 'url' => array('ext' => 'rss'), 'named' => array(), 'pass' => array());
$this->assertEqual($result, $expected);
} }
/** /**