Commit 330d31cf authored by flip111's avatar flip111

Update TestInit.php for new autoloading stuff

This patch took inspiration from and has similarities to: https://github.com/doctrine/doctrine2/blob/master/tests/Doctrine/Tests/TestInit.php
parent e0ffc8a9
......@@ -6,8 +6,16 @@ namespace Doctrine\Tests;
error_reporting(E_ALL | E_STRICT);
require_once __DIR__ . '/../../../vendor/autoload.php';
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\Tests', __DIR__ . '/../../');
$classLoader->register();
if (file_exists(__DIR__ . '/../../../vendor/autoload.php')) {
// dependencies were installed via composer - this is the main project
$classLoader = require __DIR__ . '/../../../vendor/autoload.php';
} elseif (file_exists(__DIR__ . '/../../../../../autoload.php')) {
// installed as a dependency in `vendor`
$classLoader = require __DIR__ . '/../../../../../autoload.php';
} else {
throw new \Exception('Can\'t find autoload.php. Did you install dependencies via composer?');
}
/* @var $classLoader \Composer\Autoload\ClassLoader */
$classLoader->add('Doctrine\\Tests\\', __DIR__ . '/../../');
unset($classLoader);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment