Skip to content

Commit

Permalink
Merge branch 'w28_MDL-34147_m23_cygwin' of git://github.com/skodak/mo…
Browse files Browse the repository at this point in the history
…odle into MOODLE_23_STABLE
  • Loading branch information
danpoltawski committed Jul 10, 2012
2 parents 806129b + 880f8e7 commit 1f34fa7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion admin/tool/phpunit/cli/util.php
Expand Up @@ -123,7 +123,7 @@
-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);
Expand Down
17 changes: 16 additions & 1 deletion lib/phpunit/bootstraplib.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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');
}
8 changes: 7 additions & 1 deletion lib/phpunit/classes/hint_resultprinter.php
Expand Up @@ -74,6 +74,12 @@ protected function printDefectTrace(PHPUnit_Framework_TestFailure $defect) {
$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");
}
}

0 comments on commit 1f34fa7

Please sign in to comment.