Skip to content

Commit

Permalink
Adding additional plugin 'shortcut' dispatching tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jan 15, 2010
1 parent 1a8c3fd commit 4f5ce7f
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions cake/tests/cases/dispatcher.test.php
Expand Up @@ -1516,17 +1516,10 @@ function testAutomaticPluginControllerDispatch() {

$controller = $Dispatcher->dispatch($url, array('return' => 1));

$expected = 'my_plugin';
$this->assertIdentical($controller->plugin, $expected);

$expected = 'MyPlugin';
$this->assertIdentical($controller->name, $expected);

$expected = 'add';
$this->assertIdentical($controller->action, $expected);

$expected = array('param' => 'value', 'param2' => 'value2');
$this->assertEqual($controller->params['named'], $expected);
$this->assertIdentical($controller->plugin, 'my_plugin');
$this->assertIdentical($controller->name, 'MyPlugin');
$this->assertIdentical($controller->action, 'add');
$this->assertEqual($controller->params['named'], array('param' => 'value', 'param2' => 'value2'));


Router::reload();
Expand Down Expand Up @@ -1678,6 +1671,8 @@ function testPluginShortCutUrlsWithControllerThatNeedsToBeLoaded() {
App::build(array(
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
), true);
App::objects('plugin', null, false);

$Dispatcher =& new TestDispatcher();
$Dispatcher->base = false;

Expand All @@ -1687,6 +1682,21 @@ function testPluginShortCutUrlsWithControllerThatNeedsToBeLoaded() {
$this->assertEqual($controller->params['plugin'], 'test_plugin');
$this->assertEqual($controller->params['action'], 'index');
$this->assertFalse(isset($controller->params['pass'][0]));

$url = '/test_plugin/tests/index';
$controller = $Dispatcher->dispatch($url, array('return' => 1));
$this->assertEqual($controller->params['controller'], 'tests');
$this->assertEqual($controller->params['plugin'], 'test_plugin');
$this->assertEqual($controller->params['action'], 'index');
$this->assertFalse(isset($controller->params['pass'][0]));

$url = '/test_plugin/tests/index/some_param';
$controller = $Dispatcher->dispatch($url, array('return' => 1));
$this->assertEqual($controller->params['controller'], 'tests');
$this->assertEqual($controller->params['plugin'], 'test_plugin');
$this->assertEqual($controller->params['action'], 'index');
$this->assertEqual($controller->params['pass'][0], 'some_param');

App::build();
}

Expand Down Expand Up @@ -1985,7 +1995,7 @@ function testFullPageCachingDispatch() {
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS),
), true);

$dispatcher =& new Dispatcher();
$dispatcher =& new TestDispatcher();
$dispatcher->base = false;

$url = '/';
Expand Down Expand Up @@ -2119,7 +2129,7 @@ function testCachedRegisteringViewObject() {
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
));

$dispatcher =& new Dispatcher();
$dispatcher =& new TestDispatcher();
$dispatcher->base = false;

$url = 'test_cached_pages/cache_form';
Expand All @@ -2139,6 +2149,7 @@ function testCachedRegisteringViewObject() {

$this->assertEqual($result, $expected);
$filename = $this->__cachePath($dispatcher->here);
@unlink($filename);
ClassRegistry::flush();
}

Expand Down

0 comments on commit 4f5ce7f

Please sign in to comment.