diff --git a/src/Shell/Task/TestTask.php b/src/Shell/Task/TestTask.php index e84e8d593..a06e48a59 100644 --- a/src/Shell/Task/TestTask.php +++ b/src/Shell/Task/TestTask.php @@ -103,6 +103,7 @@ public function main($type = null, $name = null) { parent::main(); $type = $this->normalize($type); + $name = $this->_getName($name); if (empty($type) && empty($name)) { $this->outputTypeChoices(); diff --git a/tests/TestCase/Shell/Task/TestTaskTest.php b/tests/TestCase/Shell/Task/TestTaskTest.php index 50e21a7ce..f9f480ccb 100644 --- a/tests/TestCase/Shell/Task/TestTaskTest.php +++ b/tests/TestCase/Shell/Task/TestTaskTest.php @@ -163,6 +163,28 @@ public function testExecuteWithTwoArgs() $this->Task->main('Table', 'TestTaskTag'); } + /** + * test execute with plugin syntax + * + * @return void + */ + public function testExecuteWithPluginName() + { + $this->_loadTestPlugin('TestBake'); + + $this->Task + ->expects($this->once())->method('createFile') + ->with( + $this->stringContains( + 'Plugin' . DS . 'TestBake' . DS . 'tests' . DS . 'TestCase' . DS . 'Model' . DS . 'Table' . DS . 'ArticlesTableTest.php' + ), + $this->matchesRegularExpression( + '/namespace TestBake\\\\Test\\\\TestCase\\\\Model\\\\Table;.*?class ArticlesTableTest extends TestCase/s' + ) + ); + $this->Task->main('Table', 'TestBake.Articles'); + } + /** * test execute with type and class name defined *