title: Functional testing form with CSRF enabled in Symfony
body: <p>What is the best way of creating functional tests to test forms with CSRF protection enabled in Symfony?</p>
  
  <p>Currently I have to add the following code before each form submittion:</p>
  
  <pre><code>  $form = new sfGuardFormSignin();
    $token = $form-&gt;getCSRFToken();
    $token_name = $form-&gt;getCSRFFieldName();
  </code></pre>
  
  <p>Then I add the $token and $token_name to form parameters like this:</p>
  
  <pre><code>call('/login', 'POST', array (
      'signin' =&gt; 
      array (
        'username' =&gt; $username,
        'password' =&gt; $password,
        $token_name =&gt; $token,
      )))
  </code></pre>
  
  <p>The option suggested in the documentation:</p>
  
  <pre><code>'_with_csrf' =&gt; true,
  </code></pre>
  
  <p>Doesn't work at all.</p>
  
  <p>Is there more simple way to avoid adding token to each form tested manually? Or is there a way to turn off csrf checking when running tests?</p>
  
  <p>The way I've described above is ok when you have to test 1-2 forms but if project contains tens unique forms it becomes a pain.</p>