From 7d2a2878639283de0c5cb68683a4ea6ab89c7c13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Chy=C5=82ek?= Date: Thu, 15 Mar 2012 01:51:54 +0100 Subject: [PATCH] Add file_exists in bootstrap.php --- tests/bootstrap.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 02bd0e169..39c661936 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -10,7 +10,15 @@ * file that was distributed with this source code. */ -if ((!$loader = @include __DIR__.'/../../../.composer/autoload.php') && (!$loader = @include __DIR__.'/../vendor/.composer/autoload.php')) { +function autoload($file) { + if (file_exists($file)) { + return include $file; + } else { + return false; + } +} + +if ((!$loader = autoload(__DIR__.'/../../../.composer/autoload.php')) && (!$loader = autoload(__DIR__.'/../vendor/.composer/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);