Merge branch 'w28_MDL-34147_m24_cygwin' of git://github.com/skodak/moodle

This commit is contained in:
Dan Poltawski 2012-07-10 10:31:16 +08:00
commit 4b9e493b0a
3 changed files with 24 additions and 3 deletions

View File

@ -123,7 +123,7 @@ Options:
-h, --help Print out this help
Example:
\$/usr/bin/php lib/phpunit/tool.php --install
\$ php ".phpunit_bootstrap_cli_argument_path('/admin/tool/phpunit/cli/util.php')." --install
";
echo $help;
exit(0);

View File

@ -101,7 +101,11 @@ function phpunit_bootstrap_cli_argument_path($moodlepath) {
$path = realpath($CFG->dirroot.$moodlepath);
if (strpos($path, $cwd) === 0) {
return substr($path, strlen($cwd));
$path = substr($path, strlen($cwd));
}
if (phpunit_bootstrap_is_cygwin()) {
$path = str_replace('\\', '/', $path);
}
return $path;
@ -140,3 +144,14 @@ function phpunit_boostrap_fix_file_permissions($file) {
return true;
}
/**
* Find out if running under Cygwin on Windows.
* @return bool
*/
function phpunit_bootstrap_is_cygwin() {
if (empty($_SERVER['SHELL']) or empty($_SERVER['OS'])) {
return false;
}
return ($_SERVER['OS'] === 'Windows_NT' and $_SERVER['SHELL'] === '/bin/bash');
}

View File

@ -74,6 +74,12 @@ class Hint_ResultPrinter extends PHPUnit_TextUI_ResultPrinter {
$file = substr($file, strlen($cwd)+1);
}
$this->write("\nTo re-run:\n phpunit $testName $file\n");
$executable = 'phpunit';
if (phpunit_bootstrap_is_cygwin()) {
$file = str_replace('\\', '/', $file);
$executable = 'phpunit.bat';
}
$this->write("\nTo re-run:\n $executable $testName $file\n");
}
}