Skip to content

Commit d602561

Browse files
committed
Merge branch 'cedriclange-master'
See #327
1 parent eb79054 commit d602561

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

application/tests/_ci_phpunit_test/CIPHPUnitTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
class CIPHPUnitTest
1212
{
1313
private static $loader_class = 'CI_Loader';
14+
private static $config_class = 'CI_Config';
1415
private static $controller_class;
1516
private static $autoload_dirs;
1617

@@ -98,6 +99,7 @@ public static function init(array $autoload_dirs = null)
9899

99100
// This code is here, not to cause errors with HMVC
100101
self::replaceLoader();
102+
self::replaceConfig();
101103

102104
// Restore $_SERVER. We need this for NetBeans
103105
$_SERVER = $_server_backup;
@@ -185,6 +187,22 @@ protected static function replaceLoader()
185187
self::loadLoader();
186188
}
187189

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+
188206
protected static function replaceHelpers()
189207
{
190208
$helpers = ['url_helper', 'download_helper'];
@@ -220,4 +238,10 @@ public static function loadLoader()
220238
$loader = new self::$loader_class;
221239
load_class_instance('Loader', $loader);
222240
}
241+
242+
public static function loadConfig()
243+
{
244+
$config= new self::$config_class;
245+
load_class_instance('Config', $config);
246+
}
223247
}

application/tests/_ci_phpunit_test/functions.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ function reset_instance()
7474
CIPHPUnitTestSuperGlobal::set_Global('LANG', $LANG);
7575

7676
CIPHPUnitTest::loadLoader();
77+
CIPHPUnitTest::loadConfig();
7778

7879
// Remove CodeIgniter instance
7980
$CI = new CIPHPUnitTestNullCodeIgniter();

0 commit comments

Comments
 (0)