Welcome Guest, Not a member yet? Register   Sign In
Access CodeIgniter Database Class directly
#1

[eluser]ColonelChlorine[/eluser]
Does anyone have tips on how to access the CodeIgniter database classes/functions directly? I am working with PHPUnit and trying to test some of my classes that depend on

Code:
$CI =& get_instance();
$CI->db->query('blahblahblah');

It's not actually like that, because I use dependency injection to put the database into each class ... but in princple I need access to the fully instantiated class normally referenced by:

Code:
$this->db

I don't need the rest of the MVC framework, just the database functionality. I have tried things like requiring just the config/database.php file, and the system/database/DB.php, and working with that ... but it seems everything is so woven together I can't access the database without loading the entire framework. Gah!

Am I up !@#% creek? Looking forward to ideas/responses.


Messages In This Thread
Access CodeIgniter Database Class directly - by El Forum - 08-23-2012, 10:28 AM
Access CodeIgniter Database Class directly - by El Forum - 08-23-2012, 11:41 AM
Access CodeIgniter Database Class directly - by El Forum - 08-23-2012, 12:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB