diff --git a/cake/console/libs/tasks/test.php b/cake/console/libs/tasks/test.php index d90a1eb4a..ed9c7e433 100644 --- a/cake/console/libs/tasks/test.php +++ b/cake/console/libs/tasks/test.php @@ -181,7 +181,20 @@ class TestTask extends BakeTask { * @access public */ function getClassName($objectType) { - $options = App::objects(strtolower($objectType)); + $type = strtolower($objectType); + if ($this->plugin) { + $path = Inflector::pluralize($type); + if ($type === 'helper') { + $path = 'views' . DS . $path; + } elseif ($type === 'component') { + $path = 'controllers' . DS . $path; + } elseif ($type === 'behavior') { + $path = 'models' . DS . $path; + } + $options = App::objects($type, App::pluginPath($this->plugin) . $path, false); + } else { + $options = App::objects($type); + } $this->out(sprintf(__('Choose a %s class', true), $objectType)); $keys = array(); foreach ($options as $key => $option) { diff --git a/cake/tests/cases/console/libs/tasks/test.test.php b/cake/tests/cases/console/libs/tasks/test.test.php index e660cdea8..b6f1e8c2a 100644 --- a/cake/tests/cases/console/libs/tasks/test.test.php +++ b/cake/tests/cases/console/libs/tasks/test.test.php @@ -44,7 +44,7 @@ Mock::generatePartial( ); Mock::generatePartial( 'TestTask', 'MockTestTask', - array('in', '_stop', 'err', 'out', 'createFile', 'isLoadableClass') + array('in', '_stop', 'err', 'out', 'hr', 'createFile', 'isLoadableClass') ); /** @@ -278,6 +278,7 @@ class TestTaskTest extends CakeTestCase { */ function endTest() { ClassRegistry::flush(); + App::build(); } /** @@ -560,6 +561,26 @@ class TestTaskTest extends CakeTestCase { $this->Task->bake('Helper', 'Form'); } +/** + * test interactive with plugins lists from the plugin + * + * @return void + */ + function testInteractiveWithPlugin() { + $testApp = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'plugins' . DS; + App::build(array( + 'plugins' => array($testApp) + ), true); + + $this->Task->plugin = 'TestPlugin'; + $path = $testApp . 'test_plugin' . DS . 'tests' . DS . 'cases' . DS . 'helpers' . DS . 'other_helper.test.php'; + $this->Task->setReturnValueAt(0, 'in', 5); //helper + $this->Task->setReturnValueAt(1, 'in', 1); //OtherHelper + $this->Task->expectAt(0, 'createFile', array($path, '*')); + $this->Task->expectAt(9, 'out', array('1. OtherHelper')); + $this->Task->execute(); + } + /** * Test filename generation for each type + plugins * diff --git a/cake/tests/cases/libs/model/db_acl.test.php b/cake/tests/cases/libs/model/db_acl.test.php index 73e9cf6a6..b970d2332 100644 --- a/cake/tests/cases/libs/model/db_acl.test.php +++ b/cake/tests/cases/libs/model/db_acl.test.php @@ -211,7 +211,8 @@ class DbAroUserTest extends CakeTestModel { * @access public */ var $useTable = 'auth_users'; - /** + +/** * bindNode method * * @param mixed $ref