You are here

function XAutoloadUnitTestCase::testNamespaces in X Autoload 7.3

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

File

lib/Drupal/xautoload/Tests/XAutoloadUnitTestCase.php, line 91

Class

XAutoloadUnitTestCase

Namespace

Drupal\xautoload\Tests

Code

function testNamespaces() {

  // Prepare the class finder.
  $finder = new \xautoload_ClassFinder_NamespaceOrPrefix();
  $finder
    ->registerNamespaceDeep('Drupal\\ex_ample', 'sites/all/modules/contrib/ex_ample/lib');
  $finder
    ->registerNamespaceRoot('Drupal\\ex_ample', 'sites/all/modules/contrib/ex_ample/vendor');

  // Test class finding for 'Drupal\\ex_ample\\Abc_Def'.
  $this
    ->assertFinderSuggestions($finder, 'Drupal\\ex_ample\\Abc_Def', array(
    // Class finder is expected to suggest these files, in the exact order,
    // until one of them is accepted.
    'sites/all/modules/contrib/ex_ample/lib/Abc/Def.php',
    'sites/all/modules/contrib/ex_ample/vendor/Drupal/ex_ample/Abc/Def.php',
  ));
}