You are here

public function ClassLoaderTest::testClassLoader in Plug 7

File

lib/doctrine/common/tests/Doctrine/Tests/Common/ClassLoaderTest.php, line 9

Class

ClassLoaderTest

Namespace

Doctrine\Tests\Common

Code

public function testClassLoader() {
  $classLoader = new ClassLoader('ClassLoaderTest');
  $classLoader
    ->setIncludePath(__DIR__);
  $classLoader
    ->setFileExtension('.class.php');
  $classLoader
    ->setNamespaceSeparator('_');
  $this
    ->assertTrue($classLoader
    ->canLoadClass('ClassLoaderTest_ClassA'));
  $this
    ->assertTrue($classLoader
    ->canLoadClass('ClassLoaderTest_ClassB'));
  $this
    ->assertTrue($classLoader
    ->canLoadClass('ClassLoaderTest_ClassC'));
  $this
    ->assertFalse($classLoader
    ->canLoadClass('OtherClass'));
  $this
    ->assertEquals($classLoader
    ->loadClass('ClassLoaderTest_ClassA'), true);
  $this
    ->assertEquals($classLoader
    ->loadClass('ClassLoaderTest_ClassB'), true);
  $this
    ->assertEquals($classLoader
    ->loadClass('ClassLoaderTest_ClassC'), true);
}