This commit is contained in:
Eloy Lafuente (stronk7)
2016-09-20 02:06:32 +02:00
4 changed files with 67 additions and 31 deletions
+11 -13
View File
@@ -86,34 +86,32 @@ class Hint_ResultPrinter extends PHPUnit_TextUI_ResultPrinter {
$cwd = getcwd();
if (strpos($file, $cwd) === 0) {
$file = substr($file, strlen($cwd)+1);
$file = testing_cli_fix_directory_separator($file);
}
$executable = null;
$pathprefix = testing_cli_argument_path('/');
if ($pathprefix) {
$pathprefix .= DIRECTORY_SEPARATOR;
}
// There is only vendor/bin/phpunit executable. There is no .cmd or .bat files.
$executable = $pathprefix . 'vendor' . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . 'phpunit';
$executable = testing_cli_fix_directory_separator($executable);
// Add server arguments to the rerun if passed.
if (isset($_SERVER['argv'][0])) {
if (preg_match('/phpunit(\.bat|\.cmd)?$/', $_SERVER['argv'][0])) {
$executable = $_SERVER['argv'][0];
for($i=1;$i<count($_SERVER['argv']);$i++) {
if (!isset($_SERVER['argv'][$i])) {
break;
}
if (in_array($_SERVER['argv'][$i], array('--colors', '--verbose', '-v', '--debug', '--strict'))) {
if (in_array($_SERVER['argv'][$i], array('--colors', '--verbose', '-v', '--debug'))) {
$executable .= ' '.$_SERVER['argv'][$i];
}
}
}
}
if (!$executable) {
$executable = 'phpunit';
if (testing_is_cygwin()) {
$file = str_replace('\\', '/', $file);
if (!testing_is_mingw()) {
$executable = 'phpunit.bat';
}
}
}
$this->write("\nTo re-run:\n $executable $testName $file\n");
}
}