public function testAutoloadsVendorPrefixedClasses()
 {
     $loader = new StandardAutoloader();
     $loader->registerPrefix('ZendTest_UnusualPrefix', __DIR__ . '/TestAsset');
     $loader->autoload('ZendTest_UnusualPrefix_PrefixedClass');
     $this->assertTrue(class_exists('ZendTest_UnusualPrefix_PrefixedClass', false));
 }
Example #2
0
 /**
  * Execute the task
  *
  * @return Docblox
  * @throw BuildException
  */
 public function execute()
 {
     if (!class_exists('Parser')) {
         if (!$this->getLibraryPath()) {
             throw new BuildException('No Docblox library path set');
         }
         $libraryPath = $this->filterProperties($this->getLibraryPath());
         set_include_path(get_include_path() . PATH_SEPARATOR . $libraryPath);
         require_once 'markdown.php';
         $autoloader = new StandardAutoloader();
         $autoloader->registerPrefix('Zend', "{$libraryPath}/Zend")->registerPrefix('DocBlox', "{$libraryPath}/DocBlox")->setFallbackAutoloader(true)->register();
     }
     $parser = new Parser();
     ParserAbstract::$event_dispatcher = new sfEventDispatcher();
     if ($this->getForce()) {
         $parser->setForced($this->getForce());
     }
     if ($this->getMarkers()) {
         $parser->setMarkers($this->getMarkers());
     }
     if ($this->getTitle()) {
         $parser->setTitle($this->filterProperties($this->getTitle()));
     }
     if ($this->getValidate()) {
         $parser->setValidate($this->getValidate());
     }
     $files = new Files();
     foreach ($this->getFiles() as $file) {
         $files->addFile($this->filterProperties($file));
     }
     $xml = $parser->parseFiles($files);
     $transformer = new Transformer();
     $transformer->setSource($xml);
     if ($this->getParsePrivate()) {
         $transformer->setParseprivate($this->getParsePrivate());
     }
     if ($this->getTarget()) {
         $transformer->setTarget($this->filterProperties($this->getTarget()));
     }
     if ($this->getThemesPath()) {
         $transformer->setThemesPath($this->filterProperties($this->getThemesPath()));
     } else {
         $transformer->setThemesPath(CoreAbstract::config()->paths->themes);
     }
     if ($this->getTemplates()) {
         $transformer->setTemplates($this->getTemplates());
     } else {
         $transformer->setTemplates(CoreAbstract::config()->transformations->template->name);
     }
     $transformer->execute();
     return $this;
 }