public loadConfig ( string $fileName, string $type = 'app' ) : mixed | ||
$fileName | string | name of file to load, extension must be .php and only the name should be used, not the extenstion. |
$type | string | Type of config file being loaded. If equal to 'app' core config files will be use. if $type == 'pluginName' that plugins tests/config files will be loaded. |
return | mixed | false if file not found, void if load successful |
public function loadConfig($fileName, $type = 'app')
{
$found = false;
if ($type == 'app') {
$folder = APP . 'Test' . DS . 'Config' . DS;
} else {
$folder = App::pluginPath($type);
if (!empty($folder)) {
$folder .= 'Test' . DS . 'Config' . DS;
} else {
return false;
}
}
if (file_exists($folder . $fileName . '.php')) {
include $folder . $fileName . '.php';
$found = true;
}
if (!$found) {
return false;
}
if (!isset($config)) {
$error = __("AppTestCase::load() - no variable \$config found in %s.php", true);
trigger_error(sprintf($error, $fileName), E_USER_WARNING);
return false;
}
return $config;
}