Created
April 26, 2011 00:46
-
-
Save JoshuaEstes/941570 to your computer and use it in GitHub Desktop.
Use with symfony1.4.x to sign in/out to secure parts of the site. This is meant to be used with sfDoctrineGuardPlugin but can be changed to be used with others.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class sfAuthTestFunctional extends sfTestFunctional | |
{ | |
/** | |
* @param string $username | |
* @param string $password | |
* @return sfAuthTestFunctional | |
*/ | |
public function signin($username, $password) | |
{ | |
return $this->info('Signing In') | |
->get('/sfGuardAuth/signin') | |
->click('Signin', array( | |
'signin' => array( | |
'username' => $username, | |
'password' => $password))) | |
->with('form')->begin() | |
->hasErrors(0) | |
->end() | |
->with('user')->begin() | |
->isAuthenticated() | |
->end(); | |
} | |
/** | |
* @return sfAuthTestFunctional | |
*/ | |
public function signout() | |
{ | |
return $this->info('Signing Out') | |
->get('/sfGuardAuth/signout'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment