Skip to content

Commit

Permalink
prepend call to the commands on windows for PHPUnitTest and CodeCepti…
Browse files Browse the repository at this point in the history
…onTest
  • Loading branch information
pscheit committed Mar 31, 2015
1 parent 516e52d commit 28cf105
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
11 changes: 9 additions & 2 deletions tests/unit/CodeceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@ class CodeceptionTest extends \Codeception\TestCase\Test
*/
protected $codecept;

/**
* @var string
*/
protected $command;

protected function _before()
{
$isWindows = defined('PHP_WINDOWS_VERSION_MAJOR');
$this->command = $isWindows ? 'call vendor/bin/codecept run' : 'vendor/bin/codecept run';
$this->codecept = test::double('Robo\Task\Testing\Codecept', [
'executeCommand' => null,
'getOutput' => new \Symfony\Component\Console\Output\NullOutput()
Expand All @@ -20,14 +27,14 @@ protected function _before()
// tests
public function testCodeceptionCommand()
{
verify($this->taskCodecept()->getCommand())->equals('vendor/bin/codecept run');
verify($this->taskCodecept()->getCommand())->equals($this->command);
verify(trim($this->taskCodecept('codecept.phar')->getCommand()))->equals('codecept.phar run');
}

public function testCodeceptionRun()
{
$this->taskCodecept()->run();
$this->codecept->verifyInvoked('executeCommand', ['vendor/bin/codecept run']);
$this->codecept->verifyInvoked('executeCommand', [$this->command]);
}

public function testCodeceptOptions()
Expand Down
5 changes: 4 additions & 1 deletion tests/unit/PHPUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ protected function _before()
// tests
public function testPhpUnitRun()
{
$isWindows = defined('PHP_WINDOWS_VERSION_MAJOR');
$command = $isWindows ? 'call vendor/bin/phpunit' : 'vendor/bin/phpunit';

$this->taskPHPUnit()->run();
$this->phpunit->verifyInvoked('executeCommand', ['vendor/bin/phpunit']);
$this->phpunit->verifyInvoked('executeCommand', [$command]);
}

public function testPHPUnitCommand()
Expand Down

0 comments on commit 28cf105

Please sign in to comment.