From 295456e2af13c3ca9a2196b8791ff69b4e61cb04 Mon Sep 17 00:00:00 2001 From: Platonides Date: Sat, 9 Oct 2010 18:32:13 +0000 Subject: [PATCH] Look for PHPUnit folder in the PATH and add support for Windows. Follow r74553 --- maintenance/tests/phpunit/phpunit.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/maintenance/tests/phpunit/phpunit.php b/maintenance/tests/phpunit/phpunit.php index 6fde6112ea..16d0c83eb7 100755 --- a/maintenance/tests/phpunit/phpunit.php +++ b/maintenance/tests/phpunit/phpunit.php @@ -23,5 +23,18 @@ $wgLocaltimezone = 'UTC'; // To prevent tests from failing with SQLite, we need to turn database caching off $wgCaches[CACHE_DB] = false; -require_once "/usr/bin/phpunit"; +$targetFile = wfIsWindows() ? 'phpunit.php' : 'phpunit'; +$pathSeparator = wfIsWindows() ? ';' : ':'; + +$folders = explode( $pathSeparator, getenv('PATH') ); +foreach ( $folders as $folder ) { + if ( file_exists( "$folder/$targetFile" ) ) { + require_once "$folder/$targetFile"; + exit(0); + } +} + +echo "I couldn't find PHPUnit\nTry adding its folder to your PATH\n"; + +die( 1 ); -- 2.20.1