Skip to content

Commit

Permalink
Merge pull request #460 from cakephp/issue-459
Browse files Browse the repository at this point in the history
Generate task tests correctly.
  • Loading branch information
dereuromark authored Aug 17, 2018
2 parents d3a75d7 + db2a029 commit 3c7c701
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/Shell/Task/TestTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,10 +542,8 @@ public function generateConstructor($type, $fullClassName)
$construct = "new {$className}(\$this->io);";
}
if ($type === 'Task') {
$pre = "\$this->io = \$this->getMockBuilder('Cake\Console\ConsoleIo')->getMock();\n";
$construct = "\$this->getMockBuilder('{$fullClassName}')\n";
$construct .= " ->setConstructorArgs([\$this->io])\n";
$construct .= " ->getMock();";
$pre = "\$this->io = \$this->getMockBuilder('Cake\Console\ConsoleIo')->getMock();";
$construct = "new {$className}(\$this->io);";
}
if ($type === 'Cell') {
$pre = "\$this->request = \$this->getMockBuilder('Cake\Http\ServerRequest')->getMock();\n";
Expand Down
5 changes: 1 addition & 4 deletions tests/comparisons/Test/testBakeShellTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ public function setUp()
{
parent::setUp();
$this->io = $this->getMockBuilder('Cake\Console\ConsoleIo')->getMock();

$this->Articles = $this->getMockBuilder('App\Shell\Task\ArticlesTask')
->setConstructorArgs([$this->io])
->getMock();
$this->Articles = new ArticlesTask($this->io);
}

/**
Expand Down

0 comments on commit 3c7c701

Please sign in to comment.