Skip to content

Commit

Permalink
Merge pull request #457 from ndm2/issue/bake-test-with-plugin-syntax
Browse files Browse the repository at this point in the history
Adds missing plugin syntax support for the test bake shell.
  • Loading branch information
markstory authored Jul 22, 2018
2 parents b57ff1d + a5d9467 commit d3a75d7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Shell/Task/TestTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
22 changes: 22 additions & 0 deletions tests/TestCase/Shell/Task/TestTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit d3a75d7

Please sign in to comment.