Testing Controllers with Toast |
[eluser]j2more[/eluser]
Hi all, I am having difficulties testing Controllers in Codeigniter: I use Toast(http://jensroland.com/projects/toast/) but when I invoke my Home Controller class I get an exception that "db" is not defined. Has anybody an idea how to test Controllers 1-1? Thxs ben class Home_tests extends Toast { function __construct() { parent::__construct(__FILE__); // Load any models, libraries etc. you need here } function test_select_user() { $controller = new Home(); $controller->getDbUser('[email protected]','password'); assert($query->num_rows() == 0 ); } }
[eluser]slowgary[/eluser]
I don't have any experience with toast, but it sounds like maybe you're attempting to use the database class with having loaded it first. I could be wrong though. Are you using the database class? If not, try loading it and see if that works. You'll likely need to change some config variables in config/database.php. |
Welcome Guest, Not a member yet? Register Sign In |