Skip to content

Instantly share code, notes, and snippets.

@JoshuaEstes
Created April 26, 2011 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoshuaEstes/941570 to your computer and use it in GitHub Desktop.
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.
<?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