You are here

function ClassFinderTest::testNamespaces in X Autoload 7.3

File

tests/Drupal/xautoload/Tests/ClassFinderTest.php, line 14

Class

ClassFinderTest

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',
  ));
}