function setUpOnce()
 {
     parent::setUpOnce();
     $this->origEnabled = DocumentationService::automatic_registration_enabled();
     DocumentationService::set_automatic_registration(false);
     $this->origModules = DocumentationService::get_registered_modules();
     $this->origLinkBase = DocumentationViewer::get_link_base();
     DocumentationViewer::set_link_base('dev/docs/');
     foreach ($this->origModules as $module) {
         DocumentationService::unregister($module->getModuleFolder());
     }
     // We set 3.0 as current, and test most assertions against 2.4 - to avoid 'current' rewriting issues
     DocumentationService::register("DocumentationViewerTests", BASE_PATH . "/sapphiredocs/tests/docs/", '2.4');
     DocumentationService::register("DocumentationViewerTests", BASE_PATH . "/sapphiredocs/tests/docs-2/", '2.3');
     DocumentationService::register("DocumentationViewerTests", BASE_PATH . "/sapphiredocs/tests/docs-3/", '3.0');
 }
コード例 #2
0
 /**
  * Generate the module which are to be documented. It filters
  * the list based on the current head version. It displays the contents
  * from the index.md file on the page to use.
  *
  * @return DataObject
  */
 function getModules($version = false, $lang = false)
 {
     if (!$version) {
         $version = $this->Version;
     }
     if (!$lang) {
         $lang = $this->Lang;
     }
     $modules = DocumentationService::get_registered_modules($version, $lang);
     $output = new DataObjectSet();
     if ($modules) {
         foreach ($modules as $module) {
             $absFilepath = $module->getPath() . '/index.md';
             $relativeFilePath = str_replace($module->getPath(), '', $absFilepath);
             if (file_exists($absFilepath)) {
                 $page = new DocumentationPage($relativeFilePath, $module, $this->Lang, $this->Version);
                 $content = DocumentationParser::parse($page, $this->Link(array_slice($this->Remaining, -1, -1)));
             } else {
                 $content = '';
             }
             // build the dataset. Load the $Content from an index.md
             $output->push(new ArrayData(array('Title' => $module->getTitle(), 'Code' => $module, 'Content' => DBField::create("HTMLText", $content))));
         }
     }
     return $output;
 }