Skip to content

Instantly share code, notes, and snippets.

@cirpo
Created April 11, 2012 13:38
Show Gist options
  • Select an option

  • Save cirpo/2359352 to your computer and use it in GitHub Desktop.

Select an option

Save cirpo/2359352 to your computer and use it in GitHub Desktop.
<?php
protected function login($client, $username = '[email protected]', $password = 'admin')
{
$crawler = $client->request('get', '/admin/login')->selectButton('Login');
$form = $crawler->form();
$form['_username'] = $username;
$form['_password'] = $password;
$client->submit($form);
$security = $client->getProfile()->getCollector('security');
$this->assertTrue(is_string($security->getUser()) && strlen($security->getUser()) > 0);
$this->assertTrue($security->isAuthenticated(), 'Logged in user is not authenticated.');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment