/** * initialize a full jelix environment with a coordinator, a request object etc. * * it initializes a coordinator, a classic request object. It sets jApp::coord(), * @param string $url the full requested URL (with http://, the domaine name etc.) * @param string $config the configuration file to use, as if you were inside an entry point * @param string $entryPoint the entrypoint name as indicated into project.xml */ protected static function initClassicRequest($url, $config = 'index/config.ini.php', $entryPoint = 'index.php') { self::$fakeServer = new jelix\FakeServerConf\ApacheMod(jApp::wwwPath(), '/' . $entryPoint); self::$fakeServer->setHttpRequest($url); $config = jConfigCompiler::read($config, true, false, '/' . $entryPoint); $coord = new jCoordinatorForTest($config, false); jApp::setCoord($coord); $request = new jClassicRequest(); $coord->testSetRequest($request); }
<?php /** * @package lizmap * @subpackage admin * @author 3liz * @copyright 2011 3liz * @link http://3liz.com * @license Mozilla Public License : http://www.mozilla.org/MPL/ */ require '../application.init.php'; require JELIX_LIB_CORE_PATH . 'request/jClassicRequest.class.php'; checkAppOpened(); // Charge la configuration jApp::loadConfig('admin/config.ini.php'); // nouveau coordinateur, que l'on indique à jApp jApp::setCoord(new jCoordinator()); // Nouvel objet request, que l'on passe au coordinateur, pour traiter le routage. jApp::coord()->process(new jClassicRequest());
<?php require_once '../application.init.php'; checkAppOpened(); jApp::loadConfig('soap/config.ini.php'); ini_set("soap.wsdl_cache_enabled", "0"); // disabling PHP's WSDL cache $jelix = new jSoapCoordinator(); jApp::setCoord($jelix); $jelix->request = new jSoapRequest(); $jelix->request->initService(); $jelix->processSoap();
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'] = ''; } $appInstaller = new jInstallerApplication(); $this->epInfo = $appInstaller->getEntryPointInfo($this->entryPoint); // 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); } } } } }
<?php /** * @package lizmap * @subpackage * @author your name * @copyright 2011 3liz * @link http://3liz.com * @license All rights reserved */ require_once __DIR__ . '/../application.init.php'; checkAppOpened(); require_once JELIX_LIB_CORE_PATH . 'jCmdlineCoordinator.class.php'; require_once JELIX_LIB_CORE_PATH . 'request/jCmdLineRequest.class.php'; jApp::setCoord(new jCmdlineCoordinator('cmdline/script.ini.php')); jApp::coord()->process(new jCmdLineRequest());