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."); } } }
/** * @param ClassFinderAdapter $adapter * The class finder object. * @param string $localDirectory */ function __construct($adapter, $localDirectory) { parent::__construct($adapter, $localDirectory); $this->finder = $adapter->getFinder(); }