2009-02-18 01:30:13 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Doctrine\Tests\Common;
|
|
|
|
|
2009-09-11 23:50:48 +04:00
|
|
|
use Doctrine\Common\GlobalClassLoader,
|
|
|
|
Doctrine\Common\IsolatedClassLoader;
|
2009-02-18 01:30:13 +03:00
|
|
|
|
2009-06-15 22:25:47 +04:00
|
|
|
require_once __DIR__ . '/../TestInit.php';
|
|
|
|
|
2009-02-18 01:30:13 +03:00
|
|
|
class ClassLoaderTest extends \Doctrine\Tests\DoctrineTestCase
|
|
|
|
{
|
2009-09-11 23:50:48 +04:00
|
|
|
public function testGlobalClassLoaderThrowsExceptionIfPutInChain()
|
2009-02-18 01:30:13 +03:00
|
|
|
{
|
2010-03-05 19:35:00 +03:00
|
|
|
$this->setExpectedException('Doctrine\Common\CommonException');
|
|
|
|
|
2009-09-11 23:50:48 +04:00
|
|
|
$classLoader1 = new IsolatedClassLoader('Foo');
|
|
|
|
$classLoader1->register();
|
2010-03-05 19:35:00 +03:00
|
|
|
|
2009-09-11 23:50:48 +04:00
|
|
|
$globalClassLoader = new GlobalClassLoader;
|
|
|
|
$globalClassLoader->register();
|
2009-02-18 01:30:13 +03:00
|
|
|
}
|
2010-03-05 19:35:00 +03:00
|
|
|
|
2009-11-03 21:30:21 +03:00
|
|
|
/*public function testIsolatedClassLoaderReturnsFalseOnClassExists()
|
2009-02-18 01:30:13 +03:00
|
|
|
{
|
2009-09-11 23:50:48 +04:00
|
|
|
$classLoader = new IsolatedClassLoader('ClassLoaderTest');
|
|
|
|
$classLoader->setBasePath( __DIR__);
|
|
|
|
$classLoader->setFileExtension('.class.php');
|
2009-07-15 02:36:09 +04:00
|
|
|
$classLoader->setNamespaceSeparator('_');
|
|
|
|
|
2009-09-11 23:50:48 +04:00
|
|
|
$this->assertEquals($classLoader->loadClass('ClassLoaderTest_ClassA'), true);
|
2009-07-15 02:36:09 +04:00
|
|
|
$this->assertEquals($classLoader->loadClass('ClassLoaderTest_ClassA'), false);
|
|
|
|
$this->assertEquals($classLoader->loadClass('ClassLoaderTest_ClassC'), true);
|
2009-11-03 21:30:21 +03:00
|
|
|
}*/
|
2009-02-18 01:30:13 +03:00
|
|
|
}
|