Skip to content

Commit

Permalink
Mimic Composer's formula for locating autoload.php
Browse files Browse the repository at this point in the history
  • Loading branch information
simensen authored and sebastianbergmann committed Oct 7, 2012
1 parent 4586bcf commit 2b2dd90
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions composer/bin/phpunit
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,17 @@
*/
define('PHPUnit_MAIN_METHOD', 'PHPUnit_TextUI_Command::main');

// pull in vendor/autoload.php as defined by composer
require __DIR__ .'/../../../../autoload.php';
function includeIfExists($file)
{
if (file_exists($file)) {
return include $file;
}
}

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);
}

PHPUnit_TextUI_Command::main();

0 comments on commit 2b2dd90

Please sign in to comment.