function testConfigRead() { $c = new Dase_Config(BASE_PATH); $c->load('inc/config.php'); $c->load('inc/local_config.php'); $test = $c->getAppSettings('test'); $this->assertTrue('dase' == $test); }
function testDatabaseSelect() { $c = new Dase_Config(BASE_PATH); $c->load('inc/config.php'); $c->load('inc/local_config.php'); $db = new Dase_DB($c); $c = Dase_DBO_Collection::get($db, 'test'); $this->assertTrue('Test Collection' == $c->collection_name); }
function testDataIsCached() { $c = new Dase_Config(BASE_PATH); $c->load('inc/config.php'); $c->load('inc/local_config.php'); $cache = Dase_Cache::get($c); $cache->setData('my_cache_file', 'hello world'); $data = $cache->getData('my_cache_file'); $this->assertTrue('hello world' == $data); }
<?php ini_set('include_path', BASE_PATH . '/lib'); function __autoload($class_name) { $class_name = str_replace('_', '/', $class_name) . '.php'; @(include $class_name); } //set up configuration object $config = new Dase_Config(BASE_PATH); $config->load('inc/config.php'); $config->load('inc/local_config.php'); if ($config->getAppSettings('force_https')) { if ('on' != $_SERVER['HTTPS']) { $secure_url = "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; header("Location:{$secure_url}"); } } //imagemagick define('CONVERT', $config->getAppSettings('convert')); //log file define('LOG_FILE', $config->getLogDir() . '/dase.log'); define('FAILED_SEARCH_LOG', $config->getLogDir() . '/failed_searches.log'); define('DEBUG_LOG', $config->getLogDir() . '/debug.log'); //log level define('LOG_LEVEL', $config->getAppSettings('log_level')); //media directory define('MEDIA_DIR', $config->getMediaDir()); //db table prefix define('TABLE_PREFIX', $config->getDb('table_prefix')); //cache type