Merge branch '1.3' of github.com:cakephp/cakephp1x into 1.3

This commit is contained in:
ADmad 2010-01-16 03:34:14 +05:30
commit 4c0a6d952f
3 changed files with 30 additions and 24 deletions

View file

@ -167,16 +167,6 @@ class Dispatcher extends Object {
if (!empty($this->params['bare'])) { if (!empty($this->params['bare'])) {
$controller->autoLayout = false; $controller->autoLayout = false;
} }
if (array_key_exists('layout', $this->params)) {
if (empty($this->params['layout'])) {
$controller->autoLayout = false;
} else {
$controller->layout = $this->params['layout'];
}
}
if (isset($this->params['viewPath'])) {
$controller->viewPath = $this->params['viewPath'];
}
return $this->_invoke($controller, $this->params); return $this->_invoke($controller, $this->params);
} }

View file

@ -1516,17 +1516,10 @@ class DispatcherTest extends CakeTestCase {
$controller = $Dispatcher->dispatch($url, array('return' => 1)); $controller = $Dispatcher->dispatch($url, array('return' => 1));
$expected = 'my_plugin'; $this->assertIdentical($controller->plugin, 'my_plugin');
$this->assertIdentical($controller->plugin, $expected); $this->assertIdentical($controller->name, 'MyPlugin');
$this->assertIdentical($controller->action, 'add');
$expected = 'MyPlugin'; $this->assertEqual($controller->params['named'], array('param' => 'value', 'param2' => 'value2'));
$this->assertIdentical($controller->name, $expected);
$expected = 'add';
$this->assertIdentical($controller->action, $expected);
$expected = array('param' => 'value', 'param2' => 'value2');
$this->assertEqual($controller->params['named'], $expected);
Router::reload(); Router::reload();
@ -1678,6 +1671,8 @@ class DispatcherTest extends CakeTestCase {
App::build(array( App::build(array(
'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS) 'plugins' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS)
), true); ), true);
App::objects('plugin', null, false);
$Dispatcher =& new TestDispatcher(); $Dispatcher =& new TestDispatcher();
$Dispatcher->base = false; $Dispatcher->base = false;
@ -1687,6 +1682,21 @@ class DispatcherTest extends CakeTestCase {
$this->assertEqual($controller->params['plugin'], 'test_plugin'); $this->assertEqual($controller->params['plugin'], 'test_plugin');
$this->assertEqual($controller->params['action'], 'index'); $this->assertEqual($controller->params['action'], 'index');
$this->assertFalse(isset($controller->params['pass'][0])); $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(); App::build();
} }
@ -1985,7 +1995,7 @@ class DispatcherTest extends CakeTestCase {
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS), 'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS),
), true); ), true);
$dispatcher =& new Dispatcher(); $dispatcher =& new TestDispatcher();
$dispatcher->base = false; $dispatcher->base = false;
$url = '/'; $url = '/';
@ -2119,7 +2129,7 @@ class DispatcherTest extends CakeTestCase {
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS) 'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views'. DS)
)); ));
$dispatcher =& new Dispatcher(); $dispatcher =& new TestDispatcher();
$dispatcher->base = false; $dispatcher->base = false;
$url = 'test_cached_pages/cache_form'; $url = 'test_cached_pages/cache_form';
@ -2139,6 +2149,7 @@ class DispatcherTest extends CakeTestCase {
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
$filename = $this->__cachePath($dispatcher->here); $filename = $this->__cachePath($dispatcher->here);
@unlink($filename);
ClassRegistry::flush(); ClassRegistry::flush();
} }

View file

@ -662,7 +662,9 @@ class ObjectTest extends CakeTestCase {
'models' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'models' . DS), 'models' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'models' . DS),
'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS), 'views' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'views' . DS),
'controllers' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'controllers' . DS) 'controllers' => array(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'controllers' . DS)
), true); ));
App::objects('plugin', null, false);
Router::reload();
$result = $this->object->requestAction('/tests_apps/index', array('return')); $result = $this->object->requestAction('/tests_apps/index', array('return'));
$expected = 'This is the TestsAppsController index view'; $expected = 'This is the TestsAppsController index view';
@ -716,6 +718,9 @@ class ObjectTest extends CakeTestCase {
$result = $this->object->requestAction(array('controller'=>'request_action', 'action'=>'paginate_request_action'), array('pass' => array(5), 'named' => array('param' => 'value'))); $result = $this->object->requestAction(array('controller'=>'request_action', 'action'=>'paginate_request_action'), array('pass' => array(5), 'named' => array('param' => 'value')));
$this->assertTrue($result); $this->assertTrue($result);
App::build();
App::objects('plugin', null, false);
} }
/** /**