Skip to content

Commit

Permalink
Merge pull request #123 from francoispluchino/phpunit-vendor-dir
Browse files Browse the repository at this point in the history
Find phpunit in vendor bin directory
  • Loading branch information
DonCallisto authored Dec 14, 2017
2 parents c63d56d + d3d4739 commit a6d46c4
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions src/Process/ProcessFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,35 @@ private static function isWindows()

private static function getWindowsBinCmd()
{
if (file_exists(getcwd().'/vendor/bin/phpunit')) {
return 'vendor\bin\phpunit {}';
}

if (file_exists(getcwd().'/bin/phpunit')) {
$cmd = 'bin\phpunit {}';
} elseif (file_exists(getenv('APPDATA').'\Composer\vendor\bin\phpunit')) {
$cmd = '%APPDATA%\Composer\vendor\bin\phpunit {}';
} else {
$cmd = 'phpunit {}';
return 'bin\phpunit {}';
}

if (file_exists(getenv('APPDATA').'\Composer\vendor\bin\phpunit')) {
return '%APPDATA%\Composer\vendor\bin\phpunit {}';
}

return $cmd;
return 'phpunit {}';
}

private static function getUnixBinCmd()
{
if (file_exists(getcwd().'/vendor/bin/phpunit')) {
return 'vendor/bin/phpunit {}';
}

if (file_exists(getcwd().'/bin/phpunit')) {
$cmd = 'bin/phpunit {}';
} elseif (file_exists(getenv('HOME').'/.composer/vendor/bin/phpunit')) {
$cmd = '~/.composer/vendor/bin/phpunit {}';
} else {
$cmd = 'phpunit {}';
return 'bin/phpunit {}';
}

if (file_exists(getenv('HOME').'/.composer/vendor/bin/phpunit')) {
return '~/.composer/vendor/bin/phpunit {}';
}

return $cmd;
return 'phpunit {}';
}
}

0 comments on commit a6d46c4

Please sign in to comment.