Add Composer autoloader

Mainly to get PHPUnit going as a composer requirement
rather than through PEAR (which is easier to set up).
This commit is contained in:
Ingo Schommer 2012-11-08 17:46:33 +01:00
parent 0a580deb3f
commit e4d71c2a20

View File

@ -275,10 +275,16 @@ $flush = (isset($_GET['flush']) || isset($_REQUEST['url']) && (
));
$manifest = new SS_ClassManifest(BASE_PATH, false, $flush);
// Register SilverStripe's class map autoload
$loader = SS_ClassLoader::instance();
$loader->registerAutoloader();
$loader->pushManifest($manifest);
// Fall back to Composer's autoloader (e.g. for PHPUnit), if composer is used
if(file_exists(BASE_PATH . '/vendor/autoload.php')) {
require_once BASE_PATH . '/vendor/autoload.php';
}
// Now that the class manifest is up, load the configuration
$configManifest = new SS_ConfigManifest(BASE_PATH, false, $flush);
Config::inst()->pushConfigManifest($configManifest);