/** * load flavor * * @param string $name flavor name * @return FlavirDirectory object. */ public function load($name) { foreach ($this->dirs as $dir) { $flavor = new FlavorDirectory($dir . DIRECTORY_SEPARATOR . $name); if ($flavor->exists()) { return $flavor; } } throw new Exception("Flavor {$name} not found."); }
function testFunc() { $fl = new FlavorDirectory('flavors/command'); ok($fl->getResourceDir()); ok($fl->hasResourceDir()); ok($fl->hasGeneratorClassFile()); ok($fl->getGeneratorClassFile()); ok($fl->exists()); is('command', $fl->getName()); is('\\command\\Generator', $fl->getGeneratorClass()); ok($fl->createGenericGenerator()); }