/** * fill some properties from informations stored into the project.xml or jelix-app.json file. * @return string the application name */ function loadFromProject() { $infos = new \Jelix\Core\Infos\AppInfos(\Jelix\Core\App::appPath()); if (!$infos->exists()) { throw new Exception("cannot load jelix-app.json or project.xml"); } $this->infoLicence = $infos->license; $this->infoLicenceUrl = $infos->licenseURL; $this->infoCopyright = $infos->copyright; $this->infoWebsite = $infos->homepageURL; return $infos->name; }
protected function handleCustomTestSuite() { $modulesTests = -1; /* $this->options[0] is an array of all options '--xxx'. each values is an array(0=>'optionname', 1=>'value if given') $this->options[1] is a list of parameters given after options it can be array(0=>'test name', 1=>'filename') */ foreach ($this->options[0] as $option) { switch ($option[0]) { case '--entrypoint': $this->entryPoint = $option[1]; break; case '--all-modules': $modulesTests = 0; break; case '--module': $modulesTests = 1; // test is the module name // testFile is the test file inside the module break; case '--testtype': $this->testType = $option[1]; break; } } if (isset($this->options[1][1]) && $modulesTests != 0) { // a specifique test file $this->arguments['testFile'] = $this->options[1][1]; } else { $this->arguments['testFile'] = ''; } $appInfos = new \Jelix\Core\Infos\AppInfos(); $ep = $appInfos->getEntryPointInfo($this->entryPoint); $mainConfig = new \Jelix\IniFile\IniModifier(jApp::mainConfigFile()); $this->epInfo = new \Jelix\Installer\EntryPoint($mainConfig, $ep["config"], $ep["file"], $ep["type"]); // let's load configuration now, and coordinator. it could be needed by tests // (during load of their php files or during execution) jApp::setConfig(jConfigCompiler::readAndCache($this->epInfo->configFile, null, $this->entryPoint)); jApp::setCoord(new jCoordinator('', false)); if ($modulesTests == 0) { // we add all modules in the test list $suite = $this->getAllModulesTestSuites(); if (count($suite)) { $this->arguments['test'] = $suite; unset($this->arguments['testFile']); } else { $this->showMessage("Error: no tests in modules\n"); exit(PHPUnit_TextUI_TestRunner::FAILURE_EXIT); } } else { if ($modulesTests == 1 && !$this->version36) { $suite = $this->getModuleTestSuite($this->options[1][0]); if (count($suite)) { $this->arguments['test'] = $suite; if (isset($this->options[1][1])) { // a specifique test file $this->arguments['testFile'] = $this->options[1][1]; } else { $this->arguments['testFile'] = ''; } } else { $this->showMessage("Error: no tests in the module\n"); exit(PHPUnit_TextUI_TestRunner::FAILURE_EXIT); } } else { if ($modulesTests == 1) { if (isset($this->options[1][1])) { // a specifique test file $suite = $this->getModuleTestSuite($this->options[1][0], $this->options[1][1]); } else { $suite = $this->getModuleTestSuite($this->options[1][0]); } if (count($suite)) { $this->arguments['test'] = $suite; } else { $this->showMessage("Error: no tests in the module\n"); exit(PHPUnit_TextUI_TestRunner::FAILURE_EXIT); } } } } }