title: How to test user login page?
body: <p>I have installed FosUserBundle and I want to make a test with PhpUnit to check whether users can login, but my code must be wrong, because I can not get redirected.</p>
  
  <p>My code: </p>
  
  <pre><code>public function testLogin()
      {
          $client = static::createClient();
          $crawler = $client-&gt;request('GET', '/crm/login');
          $buttonCrawlerNode = $crawler-&gt;selectButton('_submit');
          $form = $buttonCrawlerNode-&gt;form();
          $data = array('_username' =&gt; 'root','_password' =&gt; 'toor');
          $client-&gt;submit($form,$data);
          $crawler = $this-&gt;client-&gt;followRedirect();
          $crawler = $client-&gt;request('GET', '/crm/home');
      }
  </code></pre>