diff --git a/composer/bin/phpunit b/composer/bin/phpunit index 90e8deec7d4..9420bc499b7 100755 --- a/composer/bin/phpunit +++ b/composer/bin/phpunit @@ -34,19 +34,32 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ + define('PHPUnit_MAIN_METHOD', 'PHPUnit_TextUI_Command::main'); -function includeIfExists($file) -{ +$files = array( + __DIR__ . '/../../vendor/autoload.php', + __DIR__ . '/../../../../autoload.php' +); + +$found = FALSE; + +foreach ($files as $file) { if (file_exists($file)) { - return include $file; + require $file; + + $found = TRUE; + + break; } } -if ((!$loader = includeIfExists(__DIR__.'/../../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../../autoload.php'))) { - die('You must set up the project dependencies, run the following commands:'.PHP_EOL. - 'curl -s http://getcomposer.org/installer | php'.PHP_EOL. - 'php composer.phar install'.PHP_EOL); +if (!$found) { + die( + 'You need to set up the project dependencies using the following commands:' . PHP_EOL . + 'curl -s http://getcomposer.org/installer | php' . PHP_EOL . + 'php composer.phar install' . PHP_EOL + ); } PHPUnit_TextUI_Command::main();