|
11 | 11 | class CIPHPUnitTest
|
12 | 12 | {
|
13 | 13 | private static $loader_class = 'CI_Loader';
|
| 14 | + private static $config_class = 'CI_Config'; |
14 | 15 | private static $controller_class;
|
15 | 16 | private static $autoload_dirs;
|
16 | 17 |
|
@@ -98,6 +99,7 @@ public static function init(array $autoload_dirs = null)
|
98 | 99 |
|
99 | 100 | // This code is here, not to cause errors with HMVC
|
100 | 101 | self::replaceLoader();
|
| 102 | + self::replaceConfig(); |
101 | 103 |
|
102 | 104 | // Restore $_SERVER. We need this for NetBeans
|
103 | 105 | $_SERVER = $_server_backup;
|
@@ -185,6 +187,22 @@ protected static function replaceLoader()
|
185 | 187 | self::loadLoader();
|
186 | 188 | }
|
187 | 189 |
|
| 190 | + protected static function replaceConfig() |
| 191 | + { |
| 192 | + $my_config_file = |
| 193 | + APPPATH . 'core/' . config_item('subclass_prefix') . 'Config.php'; |
| 194 | + |
| 195 | + if (file_exists($my_config_file)) |
| 196 | + { |
| 197 | + self::$config_class = config_item('subclass_prefix') . 'Config'; |
| 198 | + if ( ! class_exists(self::$config_class)) |
| 199 | + { |
| 200 | + require $my_config_file; |
| 201 | + } |
| 202 | + } |
| 203 | + self::loadConfig(); |
| 204 | + } |
| 205 | + |
188 | 206 | protected static function replaceHelpers()
|
189 | 207 | {
|
190 | 208 | $helpers = ['url_helper', 'download_helper'];
|
@@ -220,4 +238,10 @@ public static function loadLoader()
|
220 | 238 | $loader = new self::$loader_class;
|
221 | 239 | load_class_instance('Loader', $loader);
|
222 | 240 | }
|
| 241 | + |
| 242 | + public static function loadConfig() |
| 243 | + { |
| 244 | + $config= new self::$config_class; |
| 245 | + load_class_instance('Config', $config); |
| 246 | + } |
223 | 247 | }
|
0 commit comments