function ClassLoaderTest::testNamespaces in X Autoload 7.3
Same name and namespace in other branches
- 7.5 tests/src/ClassLoaderTest.php \Drupal\xautoload\Tests\ClassLoaderTest::testNamespaces()
- 7.4 tests/lib/ClassLoaderTest.php \Drupal\xautoload\Tests\ClassLoaderTest::testNamespaces()
Test PSR-0-like namespaces.
File
- tests/
Drupal/ xautoload/ Tests/ ClassLoaderTest.php, line 42
Class
Namespace
Drupal\xautoload\TestsCode
function testNamespaces() {
// Prepare the class finder.
$finder = new \xautoload_ClassFinder_NamespaceOrPrefix();
$loader = new \xautoload_ClassLoader_NoCache($finder);
$finder
->registerNamespaceDeep('Drupal\\ex_ample', 'test://base/lib');
$finder
->registerNamespaceRoot('Drupal\\ex_ample', 'test://base/vendor');
$this
->assertLoadClass($loader, 'Drupal\\ex_ample\\Shallow\\Foo_Bar', 'test://base/lib/Shallow/Foo/Bar.php');
$this
->assertLoadClass($loader, 'Drupal\\ex_ample\\Sub\\Foo_Bar', 'test://base/vendor/Drupal/ex_ample/Sub/Foo/Bar.php');
}