CodeIgniter Forums
using SimpleTest with Tank Auth - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: using SimpleTest with Tank Auth (/showthread.php?tid=44123)



using SimpleTest with Tank Auth - El Forum - 08-04-2011

[eluser]jaykaneda[/eluser]
I am using Tank Auth for login and the Eric Barnes Simpletest implementation for unit testing. This is working fine for testing my models, but I'd like to add a few Web Tests to test my controllers. This is working for urls not behind my login, but I cannot get to those that are, and am always re-directed to auth, even when I am currently logged.

In my controller I have:

Code:
if($this->tank_auth->is_logged_in()){
    $this->load->view('myView');
}else{
    redirect('auth');
}

The strange thing is if I do this in my test:

Code:
$this->assertTrue($this->_ci->tank_auth->is_logged_in(),'user is logged in, so why the hell am I redirected to the auth controller?');

I get a green bar?

I was wondering if anyone has any experience of this, and could shed some light.