Using composer autoloader for the test suite
This commit is contained in:
parent
f0674ea034
commit
a928ce48da
@ -50,7 +50,7 @@ class SetupTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
|
|
||||||
Setup::registerAutoloadPEAR();
|
Setup::registerAutoloadPEAR();
|
||||||
|
|
||||||
$this->assertEquals($this->originalAutoloaderCount + 2, count(spl_autoload_functions()));
|
$this->assertEquals($this->originalAutoloaderCount + 1, count(spl_autoload_functions()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDirectoryAutoload()
|
public function testDirectoryAutoload()
|
||||||
|
@ -6,39 +6,24 @@ namespace Doctrine\Tests;
|
|||||||
|
|
||||||
error_reporting(E_ALL | E_STRICT);
|
error_reporting(E_ALL | E_STRICT);
|
||||||
|
|
||||||
|
if (file_exists(__DIR__ . '/../../../vendor/autoload.php')) {
|
||||||
if (isset($GLOBALS['DOCTRINE_COMMON_PATH'])) {
|
// dependencies were installed via composer - this is the main project
|
||||||
require_once $GLOBALS['DOCTRINE_COMMON_PATH'] . '/Doctrine/Common/ClassLoader.php';
|
$classLoader = require __DIR__ . '/../../../vendor/autoload.php';
|
||||||
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\Common', $GLOBALS['DOCTRINE_COMMON_PATH']);
|
} elseif (file_exists(__DIR__ . '/../../../../../autoload.php')) {
|
||||||
|
// installed as a dependency in `vendor`
|
||||||
|
$classLoader = require __DIR__ . '/../../../../../autoload.php';
|
||||||
} else {
|
} else {
|
||||||
require_once __DIR__ . '/../../../lib/vendor/doctrine-common/lib/Doctrine/Common/ClassLoader.php';
|
throw new \Exception('Can\'t find autoload.php. Did you install dependencies via composer?');
|
||||||
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\Common', __DIR__ . '/../../../lib/vendor/doctrine-common/lib');
|
|
||||||
}
|
}
|
||||||
$classLoader->register();
|
|
||||||
|
|
||||||
if (isset($GLOBALS['DOCTRINE_DBAL_PATH'])) {
|
/* @var $classLoader \Composer\Autoload\ClassLoader */
|
||||||
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\DBAL', $GLOBALS['DOCTRINE_DBAL_PATH']);
|
$classLoader->add('Doctrine\\Tests\\', __DIR__ . '/../../');
|
||||||
} else {
|
unset($classLoader);
|
||||||
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\DBAL', __DIR__ . '/../../../lib/vendor/doctrine-dbal/lib');
|
|
||||||
|
if ( ! file_exists(__DIR__ . '/Proxies') && ! mkdir(__DIR__ . '/Proxies')) {
|
||||||
|
throw new \Exception("Could not create " . __DIR__."/Proxies Folder.");
|
||||||
}
|
}
|
||||||
$classLoader->register();
|
|
||||||
|
|
||||||
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\ORM', __DIR__ . '/../../../lib');
|
if ( ! file_exists(__DIR__ . '/ORM/Proxy/generated') && ! mkdir(__DIR__ . '/ORM/Proxy/generated')) {
|
||||||
$classLoader->register();
|
throw new \Exception('Could not create ' . __DIR__ . '/ORM/Proxy/generated Folder.');
|
||||||
|
|
||||||
$classLoader = new \Doctrine\Common\ClassLoader('Doctrine\Tests', __DIR__ . '/../../');
|
|
||||||
$classLoader->register();
|
|
||||||
|
|
||||||
$classLoader = new \Doctrine\Common\ClassLoader('Symfony', __DIR__ . "/../../../lib/vendor");
|
|
||||||
$classLoader->register();
|
|
||||||
|
|
||||||
if (!file_exists(__DIR__."/Proxies")) {
|
|
||||||
if (!mkdir(__DIR__."/Proxies")) {
|
|
||||||
throw new Exception("Could not create " . __DIR__."/Proxies Folder.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!file_exists(__DIR__."/ORM/Proxy/generated")) {
|
|
||||||
if (!mkdir(__DIR__."/ORM/Proxy/generated")) {
|
|
||||||
throw new Exception("Could not create " . __DIR__."/ORM/Proxy/generated Folder.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user