mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Commit tests to prove #5866
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8029 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
fdd6ad856e
commit
9122ad72f7
1 changed files with 36 additions and 0 deletions
|
@ -1393,6 +1393,42 @@ class DispatcherTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertEqual($controller->params, $expected);
|
||||
}
|
||||
/**
|
||||
* test Plugin dispatching without controller name and using
|
||||
* plugin short form instead.
|
||||
*
|
||||
* @return void
|
||||
**/
|
||||
function testAutomaticPluginDispatchWithShortAccess() {
|
||||
$_POST = array();
|
||||
$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
|
||||
|
||||
Router::reload();
|
||||
Router::connect('/my_plugin/:controller/:action/*', array('plugin'=>'my_plugin'));
|
||||
$Dispatcher =& new TestDispatcher();
|
||||
|
||||
$Dispatcher->base = false;
|
||||
|
||||
$url = 'my_plugin/my_plugin/add';
|
||||
$controller = $Dispatcher->dispatch($url, array('return' => 1));
|
||||
$this->assertFalse(isset($controller->params['pass'][0]));
|
||||
|
||||
$url = 'my_plugin/my_plugin/add/0';
|
||||
$controller = $Dispatcher->dispatch($url, array('return' => 1));
|
||||
$this->assertTrue(isset($controller->params['pass'][0]));
|
||||
|
||||
$url = 'my_plugin/add';
|
||||
$controller = $Dispatcher->dispatch($url, array('return' => 1));
|
||||
$this->assertFalse(isset($controller->params['pass'][0]));
|
||||
|
||||
$url = 'my_plugin/add/0';
|
||||
$controller = $Dispatcher->dispatch($url, array('return' => 1));
|
||||
$this->assertIdentical('0',$controller->params['pass'][0]);
|
||||
|
||||
$url = 'my_plugin/add/1';
|
||||
$controller = $Dispatcher->dispatch($url, array('return' => 1));
|
||||
$this->assertIdentical('1',$controller->params['pass'][0]);
|
||||
}
|
||||
/**
|
||||
* testAutomaticPluginControllerMissingActionDispatch method
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue