public function tearDown() { Conf::load($this->conf); Log::$stack = array(); Log::$store = array(); Log::$level = $this->level; }
public function testDumpLoad() { $this->assertequals(true, Conf::f('debug')); $conf = Conf::dump(); $new_conf = array('debug' => false); Conf::load($new_conf); $this->assertequals(false, Conf::f('debug')); Conf::load($conf); $this->assertequals(true, Conf::f('debug')); }
public function tearDown() { Conf::load($this->conf); }
* But... PHPUnit accepts only one PHP prepend file. Good news, * PHPUnit can also set some php.ini values before the run. So, Photon * is calling PHPUnit with this bootstrap file and at the same time, * it passes PHPUnit the photon.config value with the path to the * config file for the unit tests. * * Of course, if you do not like this bootstrap file, you can run your * tests this way: * * $ photon runtests --bootstrap=path/to/yourbootstrap.php * * Also, by default, Photon will load the config.test.php file in your * current folder. You can change it by running: * * $ photon --conf=path/to/myconfig.php runtests * * You can combine them: * * $ photon --conf=fooconfig.php runtests --bootstrap=/other/testbootstrap.php * * WARNING: For added security, photon will never accept to run tests * against a config file named "config.php". This is to avoid the * "oops I run the tests against my production settings and I have * just dropped the main database.". */ namespace { include_once __DIR__ . '/autoload.php'; $tmp = is_dir(__DIR__ . '/../../tmp') ? realpath(__DIR__ . '/../../tmp') : sys_get_temp_dir(); $config = array('runtests' => true, 'tmp_folder' => $tmp, 'debug' => true, 'secret_key' => 'SECRET_KEY'); \photon\config\Container::load($config); }
/** * Custom configuration generation. * * The goal of the selftest sequence is to perform Photon tests * without the need of a configuration file or a project. This * makes the run a bit tricky as we need to figure out everything * without help from the user. But this is really important for * the ease of use of Photon. * * If the configuration file is forced with the --conf option, it * will be used. Else it will use an automatically generated * configuration and will use it. */ public function loadConfig($default = 'config.php') { try { $path = parent::loadConfig($default); } catch (Exception $e) { $this->verbose('Uses automatically generated configuration:'); $config = array('tmp_folder' => sys_get_temp_dir(), 'secret_key' => 'SECRET_KEY'); $this->verbose(var_export($config, true)); Conf::load($config); Conf::set('cmd_params', $this->params); $path = ''; } return $path; }
public function tearDown() { Conf::load($this->conf); \photon\middleware\Security::clearConfig(); }