/**
  * Tests PEAR-like class names beginning with underscore, or with a double
  * underscore in between.
  */
 function testSpecialUnderscores()
 {
     // Prepare the class finder.
     $finder = new ClassFinder();
     $finder->registerPrefixDeep('_ex_ample', 'test://lib');
     $finder->registerPrefixRoot('_ex_ample', 'test://vendor');
     // Verify that underscores are not a problem..
     $this->assertCandidateOrder($finder, '_ex_ample_Abc%_Def', array('test://lib/Abc%/Def.php', 'test://vendor/_ex/ample/Abc%/Def.php'));
     $this->assertCandidateOrder($finder, '_abc_Foo%', array());
     $this->assertCandidateOrder($finder, 'abc__Foo%', array());
 }
 /**
  * @param ClassFinder $finder
  * @param string $class
  * @param array $expectedSuggestions
  *
  * @return bool
  *   Result of the assertion
  */
 protected function assertFinderSuggestions($finder, $class, array $expectedSuggestions)
 {
     $success = TRUE;
     for ($iAccept = 0; $iAccept < count($expectedSuggestions); ++$iAccept) {
         list($method_name, $file) = $expectedSuggestions[$iAccept];
         $api = new CollectFilesInjectedApi($class, $method_name, $file);
         $finder->apiFindFile($api, $class);
         $suggestions = $api->getSuggestions();
         $expected = array_slice($expectedSuggestions, 0, $iAccept + 1);
         $success = $success && $this->assertEqualBlock($expected, $suggestions, "Finder suggestions for class <code>{$class}</code>:");
     }
     return $success;
 }
 function testComposerJson()
 {
     $finder = new ClassFinder();
     $masterAdapter = new ClassFinderAdapter($finder, new ClassMapGenerator());
     foreach (array(dirname(__DIR__) . '/fixtures/.libraries/ComposerTestLib' => array('ComposerTestLib\\Foo', 'ComposerTestLib\\Other\\Foo'), dirname(__DIR__) . '/fixtures/.libraries/ComposerTargetDirTestLib' => array('Acme\\ComposerTargetDirTestLib\\Foo')) as $dir => $classes) {
         $localDirectoryAdapter = new LocalDirectoryAdapter($masterAdapter, $dir);
         $localDirectoryAdapter->composerJson('composer.json');
         foreach ($classes as $class) {
             $this->assertFalse(class_exists($class, FALSE), "Class {$class} not defined yet.");
             $finder->loadClass($class);
             $this->assertTrue(class_exists($class, FALSE), "Class {$class} is defined.");
         }
     }
 }