Welcome Guest, Not a member yet? Register   Sign In
Functional testing of pages that require a login using SimpleTest
#1

[eluser]topherdan1[/eluser]
Hello,

I have integrated the SimpleTest library with my CodeIgniter application. I am able to run basic unit and functional tests without a problem. When I try to run tests which require the user to login, though, the code always fails. Here is what I am trying:

Code:
//Set the user credentials
$email = 'tester';
$password = 'tester';

//Login the user
$this->post(base_url().'users/login', array('email'=>$email, 'password'=>$password);

//Verify that the login worked
$this->assertTitle(new PatternExpectation('/testers\'s Profile/'));

When I looked in the sessions table in the database, I can see that the code logged the user in and stored the user_data fields correctly. The issue is the that cookie that SimpleTest sends is not the cookie that CodeIgniter set. I have tried using $this->_browser->useCookies(), but I still am not able to login.

Does anyone have any suggestions on how to get this to work?

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB