From: Kunal Mehta Date: Wed, 1 Jul 2015 20:40:53 +0000 (-0700) Subject: Don't try looking for phpunit if it is already loaded X-Git-Tag: 1.31.0-rc.0~10910 X-Git-Url: http://git.cyclocoop.org/%27.parametre_url%28%20%20%20generer_action_auteur%28%27charger_plugin%27%2C%20%27update_flux%27%29%2C%27update_flux%27%2C%20%27oui%27%29.%27?a=commitdiff_plain;h=71ede19ea80def1087df327f47d1460f27f96cbb;p=lhc%2Fweb%2Fwiklou.git Don't try looking for phpunit if it is already loaded If phpunit is installed via composer, it will already be present in the autoloader, so including other paths won't do anything. Also add some output to make it easier to figure out where phpunit is being loaded from. Change-Id: Id6d23626b158779f6ff56e6d0f20d519f2f4ad18 --- diff --git a/tests/phpunit/phpunit.php b/tests/phpunit/phpunit.php index 34e3fb410d..efde4c0103 100755 --- a/tests/phpunit/phpunit.php +++ b/tests/phpunit/phpunit.php @@ -215,17 +215,23 @@ if ( version_compare( PHP_VERSION, '5.4.0', '<' ) ) { $ok = false; -foreach ( array( - stream_resolve_include_path( 'phpunit.phar' ), - 'PHPUnit/Runner/Version.php', - 'PHPUnit/Autoload.php' -) as $includePath ) { - // @codingStandardsIgnoreStart - @include_once $includePath; - // @codingStandardsIgnoreEnd - if ( class_exists( 'PHPUnit_TextUI_Command' ) ) { - $ok = true; - break; +if ( class_exists( 'PHPUnit_TextUI_Command' ) ) { + echo "PHPUnit already present\n"; + $ok = true; +} else { + foreach ( array( + stream_resolve_include_path( 'phpunit.phar' ), + 'PHPUnit/Runner/Version.php', + 'PHPUnit/Autoload.php' + ) as $includePath ) { + // @codingStandardsIgnoreStart + @include_once $includePath; + // @codingStandardsIgnoreEnd + if ( class_exists( 'PHPUnit_TextUI_Command' ) ) { + $ok = true; + echo "Using PHPUnit from $includePath\n"; + break; + } } }