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:
mark_story 2009-02-13 19:34:25 +00:00
parent fdd6ad856e
commit 9122ad72f7

View file

@ -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
*