Skip to content

Commit

Permalink
Added support for new CommandRunner
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyharris committed Jun 23, 2017
1 parent 2e3ca9c commit 477a800
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/TestSuite/ConsoleIntegrationTestCase.php
Expand Up @@ -16,6 +16,7 @@
use Cake\Console\CommandRunner;
use Cake\Console\ConsoleInput;
use Cake\Console\ConsoleIo;
use Cake\Core\Configure;
use Cake\TestSuite\Stub\ConsoleOutput;

/**
Expand Down Expand Up @@ -85,7 +86,7 @@ public function exec($command, array $input = [])
->will($this->returnValue($in));
}

$args = $this->_commandStringToArgs("bin/cake $command");
$args = $this->_commandStringToArgs("cake $command");

$io = new ConsoleIo($this->_out, $this->_err, $this->_in);

Expand Down Expand Up @@ -163,8 +164,8 @@ public function assertErrorContains($expected)
protected function _makeRunner()
{
if ($this->_useCommandRunner) {
// not implemented yet
return;
$applicationClassName = Configure::read('App.namespace') . '\Application';
return new CommandRunner(new $applicationClassName([CONFIG]));
}

return new LegacyCommandRunner();
Expand Down
15 changes: 15 additions & 0 deletions tests/TestCase/TestSuite/ConsoleIntegrationTestCaseTest.php
Expand Up @@ -20,6 +20,21 @@ public function setUp()
Configure::write('App.namespace', 'TestApp');
}

/**
* tests exec when using the command runner
*
* @return void
*/
public function testExecWithCommandRunner()
{
$this->enableCommandRunner();

$this->exec('routes');

$this->assertOutputContains('Welcome to CakePHP');
$this->assertExitCode(Shell::CODE_SUCCESS);
}

/**
* tests exec
*
Expand Down

0 comments on commit 477a800

Please sign in to comment.