diff --git a/cake/console/libs/tasks/fixture.php b/cake/console/libs/tasks/fixture.php index 58a5455d0..de374dedc 100644 --- a/cake/console/libs/tasks/fixture.php +++ b/cake/console/libs/tasks/fixture.php @@ -390,7 +390,7 @@ class FixtureTask extends Shell { 'conditions' => $condition, 'recursive' => -1 )); - $db =& $modelObject->getDataSource(); + $db =& ConnectionManager::getDataSource($modelObject->useDbConfig); $schema = $modelObject->schema(); $out = array(); foreach ($records as $record) { diff --git a/cake/console/libs/tasks/test.php b/cake/console/libs/tasks/test.php index 9978c66e4..7b4711e9c 100644 --- a/cake/console/libs/tasks/test.php +++ b/cake/console/libs/tasks/test.php @@ -268,7 +268,7 @@ class TestTask extends Shell { $thisMethods = array_diff($classMethods, $parentMethods); $out = array(); foreach ($thisMethods as $method) { - if (substr($method, 0, 1) != '_') { + if (substr($method, 0, 1) != '_' && $method != strtolower($className)) { $out[] = $method; } } diff --git a/cake/console/libs/tasks/view.php b/cake/console/libs/tasks/view.php index 4e8e34403..b79dc0b4b 100644 --- a/cake/console/libs/tasks/view.php +++ b/cake/console/libs/tasks/view.php @@ -166,7 +166,7 @@ class ViewTask extends Shell { unset($methods[$i]); } } - if ($method[0] === '_') { + if ($method[0] === '_' || $method == strtolower($this->controllerName . 'Controller')) { unset($methods[$i]); } } diff --git a/cake/tests/cases/console/libs/tasks/controller.test.php b/cake/tests/cases/console/libs/tasks/controller.test.php index 7665156de..5328502d4 100644 --- a/cake/tests/cases/console/libs/tasks/controller.test.php +++ b/cake/tests/cases/console/libs/tasks/controller.test.php @@ -100,7 +100,7 @@ class ControllerTaskTest extends CakeTestCase { function startTest() { $this->Dispatcher =& new TestControllerTaskMockShellDispatcher(); $this->Task =& new MockControllerTask($this->Dispatcher); - $this->Task->Dispatch =& new $this->Dispatcher; + $this->Task->Dispatch =& $this->Dispatcher; $this->Task->Dispatch->shellPaths = App::path('shells'); $this->Task->Template =& new TemplateTask($this->Task->Dispatch); $this->Task->Template->params['theme'] = 'default'; diff --git a/cake/tests/cases/console/libs/tasks/db_config.test.php b/cake/tests/cases/console/libs/tasks/db_config.test.php index fee7ad0a9..2c93225f7 100644 --- a/cake/tests/cases/console/libs/tasks/db_config.test.php +++ b/cake/tests/cases/console/libs/tasks/db_config.test.php @@ -82,7 +82,7 @@ class DbConfigTaskTest extends CakeTestCase { function startTest() { $this->Dispatcher =& new TestDbConfigTaskMockShellDispatcher(); $this->Task =& new MockDbConfigTask($this->Dispatcher); - $this->Task->Dispatch =& new $this->Dispatcher; + $this->Task->Dispatch =& $this->Dispatcher; $this->Task->Dispatch->shellPaths = App::path('shells'); $this->Task->params['working'] = rtrim(APP, '/'); diff --git a/cake/tests/cases/console/libs/tasks/fixture.test.php b/cake/tests/cases/console/libs/tasks/fixture.test.php index b4180ac23..4301f71c4 100644 --- a/cake/tests/cases/console/libs/tasks/fixture.test.php +++ b/cake/tests/cases/console/libs/tasks/fixture.test.php @@ -73,7 +73,7 @@ class FixtureTaskTest extends CakeTestCase { $this->Dispatcher =& new TestFixtureTaskMockShellDispatcher(); $this->Task =& new MockFixtureTask(); $this->Task->Model =& new MockFixtureModelTask(); - $this->Task->Dispatch = new $this->Dispatcher; + $this->Task->Dispatch =& $this->Dispatcher; $this->Task->Template =& new TemplateTask($this->Task->Dispatch); $this->Task->Dispatch->shellPaths = App::path('shells'); $this->Task->Template->initialize(); diff --git a/cake/tests/cases/console/libs/tasks/model.test.php b/cake/tests/cases/console/libs/tasks/model.test.php index ec8136079..d4c84a0eb 100644 --- a/cake/tests/cases/console/libs/tasks/model.test.php +++ b/cake/tests/cases/console/libs/tasks/model.test.php @@ -80,7 +80,7 @@ class ModelTaskTest extends CakeTestCase { function startTest() { $this->Dispatcher =& new TestModelTaskMockShellDispatcher(); $this->Task =& new MockModelTask($this->Dispatcher); - $this->Task->Dispatch =& new $this->Dispatcher; + $this->Task->Dispatch =& $this->Dispatcher; $this->Task->Dispatch->shellPaths = App::path('shells'); $this->Task->Template =& new TemplateTask($this->Task->Dispatch); $this->Task->Fixture =& new MockModelTaskFixtureTask(); diff --git a/cake/tests/cases/console/libs/tasks/test.test.php b/cake/tests/cases/console/libs/tasks/test.test.php index 8fd91fcc5..e1cb69b1b 100644 --- a/cake/tests/cases/console/libs/tasks/test.test.php +++ b/cake/tests/cases/console/libs/tasks/test.test.php @@ -182,8 +182,8 @@ class TestTaskTest extends CakeTestCase { **/ function testMethodIntrospection() { $result = $this->Task->getTestableMethods('TestTaskArticle'); - $expected = array('doSomething', 'doSomethingElse'); - $this->assertEqual($result, $expected); + $expected = array('dosomething', 'dosomethingelse'); + $this->assertEqual(array_map('strtolower', $result), $expected); } /** @@ -310,7 +310,8 @@ class TestTaskTest extends CakeTestCase { } /** - * test baking files. + * test baking files. The conditionally run tests are known to fail in PHP4 + * as PHP4 classnames are all lower case, breaking the plugin path inflection. * * @return void **/ @@ -329,17 +330,21 @@ class TestTaskTest extends CakeTestCase { $this->assertPattern('/function endTest\(\)/', $result); $this->assertPattern('/unset\(\$this->TestTaskArticle\)/', $result); - $this->assertPattern('/function testDoSomething\(\)/', $result); - $this->assertPattern('/function testDoSomethingElse\(\)/', $result); + $this->assertPattern('/function testDoSomething\(\)/i', $result); + $this->assertPattern('/function testDoSomethingElse\(\)/i', $result); $this->assertPattern("/'app\.test_task_article'/", $result); - $this->assertPattern("/'plugin\.test_task\.test_task_comment'/", $result); + if (PHP5) { + $this->assertPattern("/'plugin\.test_task\.test_task_comment'/", $result); + } $this->assertPattern("/'app\.test_task_tag'/", $result); $this->assertPattern("/'app\.articles_tag'/", $result); } /** * test baking controller test files, ensure that the stub class is generated. + * Conditional assertion is known to fail on PHP4 as classnames are all lower case + * causing issues with inflection of path name from classname. * * @return void **/ @@ -363,7 +368,9 @@ class TestTaskTest extends CakeTestCase { $this->assertPattern('/unset\(\$this->TestTaskComments\)/', $result); $this->assertPattern("/'app\.test_task_article'/", $result); - $this->assertPattern("/'plugin\.test_task\.test_task_comment'/", $result); + if (PHP5) { + $this->assertPattern("/'plugin\.test_task\.test_task_comment'/", $result); + } $this->assertPattern("/'app\.test_task_tag'/", $result); $this->assertPattern("/'app\.articles_tag'/", $result); }