Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Oct 7, 2012
1 parent 2b2dd90 commit 602e97e
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions composer/bin/phpunit
Original file line number Diff line number Diff line change
Expand Up @@ -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();

0 comments on commit 602e97e

Please sign in to comment.