From 71ede19ea80def1087df327f47d1460f27f96cbb Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Wed, 1 Jul 2015 13:40:53 -0700 Subject: [PATCH] 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 --- tests/phpunit/phpunit.php | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) 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; + } } } -- 2.20.1