You are here

function ClassLoaderTest::testPsr4 in X Autoload 7.3

Same name and namespace in other branches
  1. 7.5 tests/src/ClassLoaderTest.php \Drupal\xautoload\Tests\ClassLoaderTest::testPsr4()
  2. 7.4 tests/lib/ClassLoaderTest.php \Drupal\xautoload\Tests\ClassLoaderTest::testPsr4()

Test PSR-4-like namespaces.

File

tests/Drupal/xautoload/Tests/ClassLoaderTest.php, line 28

Class

ClassLoaderTest

Namespace

Drupal\xautoload\Tests

Code

function testPsr4() {

  // Prepare the class finder.
  $finder = new \xautoload_ClassFinder_NamespaceOrPrefix();
  $loader = new \xautoload_ClassLoader_NoCache($finder);
  $finder
    ->registerNamespacePlugin('Drupal\\ex_ample\\', new \xautoload_FinderPlugin_Psr4(), 'test://base/lib');
  $this
    ->assertLoadClass($loader, 'Drupal\\ex_ample\\Psr4\\Foo_Bar', 'test://base/lib/Psr4/Foo_Bar.php');
}