public function getConfig() { return $this->config->get_config(); }
# TODO configurable and detect changes by timestamp $compiled_file = File::buildPath(array($app_root, "cache", "{$basename}-compiled.php")); if (file_exists($compiled_file)) { global $config; require_once "{$compiled_file}"; return $config; } $file = File::buildPath(array($app_root, "{$basename}.yaml")); $fileenv = File::buildPath(array($app_root, "{$basename}-{$environment}.yaml")); $config = array(); if (file_exists($file)) { if ($env->debug) { self::$LOGGER->debug("Loading configuration file: {$file}"); } $loader = new DF_Web_Config_Loader($file); $config = array_merge($config, $loader->getConfig()); } if (file_exists($fileenv)) { if ($env->debug) { self::$LOGGER->log("Loading configuration file: {$fileenv}"); } $loader = DF_Web_Config_Loader($fileenv); $config = array_merge($config, $loader->getConfig()); } $struct = "<?php\n \$config = " . var_export($config, 1) . ";"; file_put_contents($compiled_file, $struct); return $config; } } DF_Web_Config::$LOGGER = DF_Web_Logger::logger('DF_Web_Config'); require_once 'DF/Util/Arrays.php';
<?php $DIR_SCRIPT = dirname(__FILE__); $DIR_ROOT = "{$DIR_SCRIPT}/.."; $DIR_LIB = "{$DIR_ROOT}/lib"; set_include_path("{$DIR_SCRIPT}:" . $DIR_LIB . ':' . get_include_path()); require_once 'DF/Web/Logger.php'; DF_Web_Logger::setActiveLogger('log4php'); require_once 'simpletest/unit_tester.php'; require_once 'simpletest/reporter.php'; require_once 'DF/Web/Config.php'; require_once 'DF/Web/Environment.php'; $environment = DF_Web_Environment::singleton(); $environment->app_root = "{$dir}/.."; DF_Web_Config::$basename = "tests";
public function Test_ULB_Routing($name = 'Testing DF_Web_Routing') { $this->UnitTestCase($name); $config = DF_Web_Config::get_config(); $this->routing = new DF_Web_Routing($config); }