Skip to content

Commit

Permalink
Fix logic to set global variables
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Dec 3, 2015
1 parent dff548a commit 42550ed
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 24 deletions.
14 changes: 1 addition & 13 deletions application/tests/_ci_phpunit_test/CIPHPUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,7 @@ public static function init(array $autoload_dirs = null)
* And away we go...
*/
require __DIR__ . '/replacing/core/CodeIgniter.php';

// Set global variables
CIPHPUnitTestSuperGlobal::set_Global('BM', $BM);
CIPHPUnitTestSuperGlobal::set_Global('EXT', $EXT);
CIPHPUnitTestSuperGlobal::set_Global('CFG', $CFG);
CIPHPUnitTestSuperGlobal::set_Global('UNI', $UNI);
CIPHPUnitTestSuperGlobal::set_Global('URI', $URI);
CIPHPUnitTestSuperGlobal::set_Global('RTR', $RTR);
CIPHPUnitTestSuperGlobal::set_Global('OUT', $OUT);
CIPHPUnitTestSuperGlobal::set_Global('SEC', $SEC);
CIPHPUnitTestSuperGlobal::set_Global('IN', $IN);
CIPHPUnitTestSuperGlobal::set_Global('LANG', $LANG);


// Create CodeIgniter instance
new CI_Controller();

Expand Down
20 changes: 9 additions & 11 deletions application/tests/_ci_phpunit_test/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,24 @@ function reset_instance()

// Load core classes
$BM =& load_class('Benchmark', 'core');
$EXT =& load_class('Hooks', 'core');
$CFG =& load_class('Config', 'core');
// $URI =& load_class('Utf8', 'core');
$UNI =& load_class('URI', 'core');
$RTR =& load_class('Router', 'core');
$OUT =& load_class('Output', 'core');
$SEC =& load_class('Security', 'core');
$IN =& load_class('Input', 'core');
$LANG =& load_class('Lang', 'core');

// Set global variables
CIPHPUnitTestSuperGlobal::set_Global('BM', $BM);
$EXT =& load_class('Hooks', 'core');
CIPHPUnitTestSuperGlobal::set_Global('EXT', $EXT);
$CFG =& load_class('Config', 'core');
CIPHPUnitTestSuperGlobal::set_Global('CFG', $CFG);
$UNI =& load_class('URI', 'core');
CIPHPUnitTestSuperGlobal::set_Global('UNI', $UNI);
// $URI =& load_class('Utf8', 'core');
// CIPHPUnitTestSuperGlobal::set_Global('URI', $URI);
$RTR =& load_class('Router', 'core');
CIPHPUnitTestSuperGlobal::set_Global('RTR', $RTR);
$OUT =& load_class('Output', 'core');
CIPHPUnitTestSuperGlobal::set_Global('OUT', $OUT);
$SEC =& load_class('Security', 'core');
CIPHPUnitTestSuperGlobal::set_Global('SEC', $SEC);
$IN =& load_class('Input', 'core');
CIPHPUnitTestSuperGlobal::set_Global('IN', $IN);
$LANG =& load_class('Lang', 'core');
CIPHPUnitTestSuperGlobal::set_Global('LANG', $LANG);

CIPHPUnitTest::loadLoader();
Expand Down
10 changes: 10 additions & 0 deletions application/tests/_ci_phpunit_test/replacing/core/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@
* ------------------------------------------------------
*/
$BM =& load_class('Benchmark', 'core');
CIPHPUnitTestSuperGlobal::set_Global('BM', $BM);
$BM->mark('total_execution_time_start');
$BM->mark('loading_time:_base_classes_start');

Expand All @@ -195,6 +196,7 @@
* ------------------------------------------------------
*/
$EXT =& load_class('Hooks', 'core');
CIPHPUnitTestSuperGlobal::set_Global('EXT', $EXT);

/*
* ------------------------------------------------------
Expand All @@ -214,6 +216,7 @@
*
*/
$CFG =& load_class('Config', 'core');
CIPHPUnitTestSuperGlobal::set_Global('CFG', $CFG);

// Do we have any manually set config items in the index.php file?
if (isset($assign_to_config) && is_array($assign_to_config))
Expand Down Expand Up @@ -292,27 +295,31 @@
* ------------------------------------------------------
*/
$UNI =& load_class('Utf8', 'core');
CIPHPUnitTestSuperGlobal::set_Global('UNI', $UNI);

/*
* ------------------------------------------------------
* Instantiate the URI class
* ------------------------------------------------------
*/
$URI =& load_class('URI', 'core');
CIPHPUnitTestSuperGlobal::set_Global('URI', $URI);

/*
* ------------------------------------------------------
* Instantiate the routing class and set the routing
* ------------------------------------------------------
*/
$RTR =& load_class('Router', 'core', isset($routing) ? $routing : NULL);
CIPHPUnitTestSuperGlobal::set_Global('RTR', $RTR);

/*
* ------------------------------------------------------
* Instantiate the output class
* ------------------------------------------------------
*/
$OUT =& load_class('Output', 'core');
CIPHPUnitTestSuperGlobal::set_Global('OUT', $OUT);

/*
* ------------------------------------------------------
Expand All @@ -330,20 +337,23 @@
* -----------------------------------------------------
*/
$SEC =& load_class('Security', 'core');
CIPHPUnitTestSuperGlobal::set_Global('SEC', $SEC);

/*
* ------------------------------------------------------
* Load the Input class and sanitize globals
* ------------------------------------------------------
*/
$IN =& load_class('Input', 'core');
CIPHPUnitTestSuperGlobal::set_Global('IN', $IN);

/*
* ------------------------------------------------------
* Load the Language class
* ------------------------------------------------------
*/
$LANG =& load_class('Lang', 'core');
CIPHPUnitTestSuperGlobal::set_Global('LANG', $LANG);

/*
* ------------------------------------------------------
Expand Down

0 comments on commit 42550ed

Please sign in to comment.