mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Merge branch '1.3' of github.com:cakephp/cakephp1x into 1.3
This commit is contained in:
commit
9b3a2fd658
2 changed files with 29 additions and 1 deletions
|
@ -278,6 +278,7 @@ class Router {
|
|||
$routeClass = $options['routeClass'];
|
||||
unset($options['routeClass']);
|
||||
}
|
||||
//TODO 2.0 refactor this to use a string class name, throw exception, and then construct.
|
||||
$Route =& new $routeClass($route, $defaults, $options);
|
||||
if ($routeClass !== 'CakeRoute' && !is_subclass_of($Route, 'CakeRoute')) {
|
||||
trigger_error(__('Route classes must extend CakeRoute', true), E_USER_WARNING);
|
||||
|
@ -539,6 +540,7 @@ class Router {
|
|||
$this->connect("/{$prefix}/:plugin/:controller", $indexParams, $match);
|
||||
$this->connect("/{$prefix}/:plugin/:controller/:action/*", $params, $match);
|
||||
}
|
||||
$this->connect('/:plugin/:controller', array('action' => 'index'), $match);
|
||||
$this->connect('/:plugin/:controller/:action/*', array(), $match);
|
||||
}
|
||||
|
||||
|
|
|
@ -1849,7 +1849,7 @@ class RouterTest extends CakeTestCase {
|
|||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function testCurentRoute() {
|
||||
function testCurrentRoute() {
|
||||
$url = array('controller' => 'pages', 'action' => 'display', 'government');
|
||||
Router::connect('/government', $url);
|
||||
Router::parse('/government');
|
||||
|
@ -1924,6 +1924,32 @@ class RouterTest extends CakeTestCase {
|
|||
$this->assertFalse(isset($result['action']));
|
||||
}
|
||||
|
||||
/**
|
||||
* test that the required default routes are connected.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testConnectDefaultRoutes() {
|
||||
App::build(array(
|
||||
'plugins' => array(
|
||||
TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS
|
||||
)
|
||||
), true);
|
||||
App::objects('plugin', null, false);
|
||||
|
||||
$plugins = App::objects('plugin');
|
||||
$plugin = Inflector::underscore($plugins[0]);
|
||||
$result = Router::url(array('plugin' => $plugin, 'controller' => 'js_file', 'action' => 'index'));
|
||||
$this->assertEqual($result, '/plugin_js/js_file');
|
||||
|
||||
$result = Router::parse('/plugin_js/js_file');
|
||||
$expected = array(
|
||||
'plugin' => 'plugin_js', 'controller' => 'js_file', 'action' => 'index',
|
||||
'named' => array(), 'pass' => array()
|
||||
);
|
||||
$this->assertEqual($result, $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* test using a custom route class for route connection
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue