mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-28 14:56:23 +00:00
Allowing routes to set an extension when Router::parseExtension() is
being used. Fixes #492 Signed-off-by: Mark Story <mark@mark-story.com>
This commit is contained in:
parent
cc59b04ad3
commit
5e8665cd8d
2 changed files with 8 additions and 1 deletions
cake
|
@ -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;
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue