public function ClassLoaderTest::testClassExists

File

drupal/core/vendor/doctrine/common/tests/Doctrine/Tests/Common/ClassLoaderTest.php, line 25

Class

ClassLoaderTest

Namespace

Doctrine\Tests\Common

Code

public function testClassExists() {
  $this
    ->assertFalse(ClassLoader::classExists('ClassLoaderTest\\ClassD'));
  $badLoader = function ($className) {
    require __DIR__ . '/ClassLoaderTest/ClassD.php';
    return true;
  };
  spl_autoload_register($badLoader);
  $this
    ->assertTrue(ClassLoader::classExists('ClassLoaderTest\\ClassD'));
  spl_autoload_unregister($badLoader);
}