FIX: Throw more helpful error if tests are run badly.

If you run tests outside of a composer autoloader-based environment, or
your autoloader isn’t pulling in Constants.php, everything will break.

This provides a more helpful error message.
This commit is contained in:
Sam Minnee 2016-09-21 09:43:14 +12:00
parent 3ea23ce2b7
commit 2e054af7b1
1 changed files with 7 additions and 0 deletions

View File

@ -3,6 +3,13 @@
use SilverStripe\ORM\DB;
use SilverStripe\Dev\SapphireTest;
if(!defined('BASE_PATH')) {
echo "BASE_PATH hasn't been defined. This probably means that framework/Core/Constants.php hasn't been " .
"included by Composer's autoloader.\n" .
"Make sure the you are running your tests via vendor/bin/phpunit and your autoloader is up to date.\n";
exit(1);
}
/**
* This bootstraps the SilverStripe system so that phpunit can be run directly on SilverStripe tests.