Пример #1
0
 public function test_option_exists()
 {
     $value = rand(1, 99999);
     $optionName = 'test_option_exists' . $value;
     $this->assertFalse(Config::option_exists($optionName), "{$optionName} shouldn't exist yet");
     Config::set_option($optionName, $value);
     $this->assertTrue(Config::option_exists($optionName), "{$optionName} should exist now");
     $returnedValue = Config::get_option($optionName);
     $this->assertEquals($value, $returnedValue, "{$optionName} should equal {$value}, got {$returnedValue}");
 }
Пример #2
0
\Scoop\Config::set_option('install_dir', $installDirectory);
\Scoop\Config::set_option('config_dir', $installDirectory . '/configs/');
\Scoop\Config::set_option('bootstrap_dir', $installDirectory . '/bootstrap');
if (!empty($_SERVER['DOCUMENT_ROOT'])) {
    \Scoop\Config::set_option('server_document_root', $_SERVER['DOCUMENT_ROOT']);
}
// search for the site name
if (!empty($_SERVER['SITE_NAME'])) {
    $siteName = $_SERVER['SITE_NAME'];
} else {
    if (!empty($_SERVER['SERVER_NAME'])) {
        $siteName = $_SERVER['SERVER_NAME'];
    }
}
if (isset($siteName)) {
    \Scoop\Config::set_option('site_name', $siteName);
}
// load config
$frameworkConfig = (include \Scoop\Config::get_option('config_dir') . '/framework.php');
// load user config file if one exists
foreach ([__DIR__ . '/../../scoop/custom.php', __DIR__ . '/../../../../scoop/custom.php'] as $customConfigFilePath) {
    if (file_exists($customConfigFilePath)) {
        $customConfig = (include_once $customConfigFilePath);
        if (is_array($customConfig)) {
            $frameworkConfig = array_replace_recursive($frameworkConfig, $customConfig);
        }
    }
}
// set main options
\Scoop\Config::set_options($frameworkConfig);
// set the timezone if one was provided