From 28cf10552807fb32083d8ff5bd00052f77259dc7 Mon Sep 17 00:00:00 2001 From: Philipp Scheit Date: Tue, 31 Mar 2015 15:58:50 +0200 Subject: [PATCH] prepend call to the commands on windows for PHPUnitTest and CodeCeptionTest --- tests/unit/CodeceptionTest.php | 11 +++++++++-- tests/unit/PHPUnitTest.php | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/unit/CodeceptionTest.php b/tests/unit/CodeceptionTest.php index 547234151..ef07fa5f2 100644 --- a/tests/unit/CodeceptionTest.php +++ b/tests/unit/CodeceptionTest.php @@ -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() @@ -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() diff --git a/tests/unit/PHPUnitTest.php b/tests/unit/PHPUnitTest.php index 650f2d2d5..c1783ea6c 100644 --- a/tests/unit/PHPUnitTest.php +++ b/tests/unit/PHPUnitTest.php @@ -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()