public function logInAs($username)
 {
     $crawler = $this->client->request('GET', '/login');
     $form = $crawler->filter('button[type=submit]')->form();
     $data = ['_username' => $username, '_password' => 'mypassword'];
     $this->client->submit($form, $data);
 }
Example #2
0
 /**
  * Do login with username
  *
  * @param string $username
  */
 private function doLogin($username = '******')
 {
     $crawler = $this->client->request('GET', $this->getUrl('fos_user_security_login', array()));
     $form = $crawler->selectButton('_submit')->form(array('_username' => $username, '_password' => 'qwerty'));
     $this->client->submit($form);
     $this->assertTrue($this->client->getResponse()->isRedirect());
     $this->client->followRedirects();
 }