Example #1
0
 protected function ModuleFile($Module = null)
 {
     if ($Module === null) {
         $Module = $this->ModuleName();
     }
     return jf::moduleFile($Module);
 }
Example #2
0
 /**
  * Adds another module to the test suite
  * @param string $TestModule
  */
 function add($TestModule)
 {
     $file = jf::moduleFile($TestModule);
     if (!in_array($file, TestLauncher::$TestFiles)) {
         TestLauncher::$TestFiles[] = $file;
         TestLauncher::$TestSuite->addTestFile($file);
     }
 }
Example #3
0
 /**
  * Runs a module. The difference with import is that this one uses require instead of require_once
  * @param string $module
  * @param array $scopeVars
  */
 static function run($module, $scopeVars = null)
 {
     $file = jf::moduleFile($module);
     if (!file_exists($file)) {
         throw new ImportException("File not found : {$file}");
     }
     if (is_array($scopeVars)) {
         foreach ($scopeVars as $ArgName => $ArgValue) {
             ${$ArgName} = $ArgValue;
         }
     }
     require $file;
 }
Example #4
0
 /**
  * This is a convenient wrapper for AddRule, which calls moduleFile on the module string and then adds the file to rules.
  * @param string $Classname
  * @param string $Module e.g model/folder/file
  * @throws AutoloadRuleException
  */
 static function AddModule($Classname, $Module)
 {
     $File = jf::moduleFile($Module);
     if (!file_exists($File)) {
         throw new AutoloadRuleException("Invalid autoload rule added: {$File} set for autoloading of class '{$Classname}' does not exist.");
     }
     self::$List[$Classname] = $File;
 }
 /**
  * searches the directory tree for a catch controller, if no direct controller found
  * @param string $ControllerModule module name of catch controller
  */
 protected function GetIterativeCatchController($ControllerModule)
 {
     if (Controller::$IterativeCatchController) {
         $Iteration = 1000;
     } else {
         $Iteration = 1;
     }
     $n = 0;
     $Parts = explode("/", $ControllerModule);
     while ($n <= $Iteration) {
         $Part = array_pop($Parts);
         $template = implode("/", $Parts);
         if ($template == "") {
             break;
         }
         $template = $template . DIRECTORY_SEPARATOR . Controller::$CatchControllerFile;
         if (file_exists(jf::moduleFile($template))) {
             return $template;
         }
     }
     $template_root = "control" . DIRECTORY_SEPARATOR . Controller::$CatchControllerFile;
     return $template_root;
 }