r74554 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74553‎ | r74554 | r74555 >
Date:18:32, 9 October 2010
Author:platonides
Status:resolved (Comments)
Tags:
Comment:
Look for PHPUnit folder in the PATH and add support for Windows.
Follow r74553
Modified paths:
  • /trunk/phase3/maintenance/tests/phpunit/phpunit.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/tests/phpunit/phpunit.php
@@ -23,5 +23,18 @@
2424 // To prevent tests from failing with SQLite, we need to turn database caching off
2525 $wgCaches[CACHE_DB] = false;
2626
27 -require_once "/usr/bin/phpunit";
 27+$targetFile = wfIsWindows() ? 'phpunit.php' : 'phpunit';
 28+$pathSeparator = wfIsWindows() ? ';' : ':';
2829
 30+$folders = explode( $pathSeparator, getenv('PATH') );
 31+foreach ( $folders as $folder ) {
 32+ if ( file_exists( "$folder/$targetFile" ) ) {
 33+ require_once "$folder/$targetFile";
 34+ exit(0);
 35+ }
 36+}
 37+
 38+echo "I couldn't find PHPUnit\nTry adding its folder to your PATH\n";
 39+
 40+die( 1 );
 41+

Follow-up revisions

RevisionCommit summaryAuthorDate
r74555Follow r74554. Also take include path into account.platonides18:40, 9 October 2010
r74556Follow-up r74553, r74554 and r74555: don't guess, just include stuff properlymaxsem19:00, 9 October 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r74553Readd after r72566 a phpunit.php so that globals are kept global.platonides18:15, 9 October 2010

Comments

#Comment by 😂 (talk | contribs)   00:32, 10 October 2010

+ $pathSeparator = wfIsWindows() ? ';' : ':';

PHP included a constant just for this purpose, it's called PATH_SEPARATOR.

#Comment by Platonides (talk | contribs)   09:49, 10 October 2010

Nikerabbit also pointed it out. I changed it but r74556 removed all this logic.

Status & tagging log