Interesting Load of CI from an external class |
[eluser][email protected][/eluser]
Hey guys, I am trying to load the CI framework from an external class. The framework is loading fine with no errors in the logs. I am trying two scenarios here, and for scenario #1, am getting result: "12" <?php require_once('../../../simpletest/unit_tester.php'); require_once('../../../simpletest/reporter.php'); require_once('../../../index.php'); //Load CI Framework class admin_model_test extends UnitTestCase { function testGetAllDesigns() { echo '1'; $CI =&get;_instance(); echo'2'; $CI->load->model('admin_model'); echo '3'; $arr = $CI->admin_model->getAllDesigns(); echo '4'; $this->assertTrue(true); echo '5'; } } if(TESTING=='TESTING') { $test = & new admin_model_test(); $test->run(new HtmlReporter()); } ?> For scenario #2 (comment out CI stuff), I am getting "12345", and then the test case result. <?php require_once('../../../simpletest/unit_tester.php'); require_once('../../../simpletest/reporter.php'); require_once('../../../test_index.php'); class admin_model_test extends UnitTestCase { function testGetAllDesigns() { echo '1'; //$CI =&get;_instance(); echo'2'; //$CI->load->model('admin_model'); echo '3'; //$arr = $CI->admin_model->getAllDesigns(); echo '4'; $this->assertTrue(true); echo '5'; } } $test = & new admin_model_test(); $test->run(new HtmlReporter()); ?> Currently, the "&get;_instance()" is returning the default_controller class (Home Class). How can I get it to return the CI base class, and then call a ($CI->load->model(...)) on it? |
Welcome Guest, Not a member yet? Register Sign In |