You are here

function ClassLoaderTest::testNamespaces in X Autoload 7.5

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

Test PSR-0-like namespaces.

File

tests/src/ClassLoaderTest.php, line 49

Class

ClassLoaderTest

Namespace

Drupal\xautoload\Tests

Code

function testNamespaces() {

  // Prepare the class finder.
  $finder = new ClassFinder();
  $psr0 = new Psr0DirectoryBehavior();
  $finder
    ->registerNamespaceDeep('Drupal\\ex_ample', 'test://base/lib', $psr0);
  $finder
    ->registerNamespaceRoot('Drupal\\ex_ample', 'test://base/vendor', $psr0);
  $this
    ->assertCandidateOrder($finder, 'Drupal\\ex_ample\\Sub_%\\Foo_Bar', array(
    'test://base/lib/Sub_%/Foo/Bar.php',
    'test://base/vendor/Drupal/ex_ample/Sub_%/Foo/Bar.php',
  ));
}