title: Symfony security is granted
body: <p>I have controller with annotation <code>* @Security("is_granted('PERM_MODULE_OUTBOUND_INVOICES_READ')")</code> and I write test for some action in this controller, create user and loginIn, and when call rout for this action have error </p>
  
  <pre><code>Expression "is_granted('PERM_MODULE_OUTBOUND_INVOICES_READ')" denied access.
  </code></pre>
  
  <p>when add role to user <code>PERM_MODULE_OUTBOUND_INVOICES_READ</code> still have access denied</p>
  
  <p>when commented tgis and in action check current user is granted have <code>true</code></p>
  
  <pre><code>    /**
   * @Route("/manage/new_outbound_invoices", name="new_outbound_invoices")
   */
  public function outBoundInvoiceListsAction(Request $request)
  {
          $check = $this-&gt;get('security.authorization_checker')
          -&gt;isGranted('PERM_MODULE_OUTBOUND_INVOICES_READ', $this-&gt;getUser());
  </code></pre>
  
  <p>but with security annotation access denied why not understand
  this is my test</p>
  
  <pre><code>        $user = $this-&gt;user;
      $this-&gt;logIn($user);
      //$t = $this-&gt;getContainer()-&gt;get('security.context')-&gt;getToken(); try get token and have null, but in action have user from session
      $this-&gt;client-&gt;setServerParameter('HTTP_HOST', 'erp.houseoptima.fi.local');
      $crawler = $this-&gt;client-&gt;request('GET', '/economy/manage/new_outbound_invoices');
  </code></pre>
  
  <p>this function for LogIn</p>
  
  <pre><code>    public function logIn(User $user)
  {
      $session = $this-&gt;client-&gt;getContainer()-&gt;get('session');
  
      $firewall = 'main';
      $token = new UsernamePasswordToken($user, null, $firewall, $user-&gt;getRoles());
      $session-&gt;set('_security_'.$firewall, serialize($token));
      $session-&gt;save();
  
      $cookie = new Cookie($session-&gt;getName(), $session-&gt;getId());
      $this-&gt;client-&gt;getCookieJar()-&gt;set($cookie);
  }
  </code></pre>
  
  <p>What problem with this security ? With annotation error 403 withot 200 and when check in action is granted user have true </p>