title: Symfony2 functional test client request returns error 500
body: <p>I have a controller that i am trying to do a functional test for it.</p>
  
  <p>controller:</p>
  
  <pre><code>&lt;?php
  
  namespace Zanox\AppBundle\Controller;
  
  use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  use Symfony\Component\Routing\Annotation\Route;
  use Exception;
  
  /**
   * 
   * @author Mohamed Ragab Dahab &lt;eng.mohamed.dahab@gmail.com&gt;
   * 
   * @Route("merchant")
   * 
   */
  class ReportController extends Controller {
  
      /**
       * Show transaction report regarding to the given merchant ID
       * @author Mohamed Ragab Dahab &lt;eng.mohamed.dahab@gmail.com&gt;
       * @access public
       * 
       * @Route("/{id}/report", name="merchant-report")
       * 
       * @param int $id   Merchant ID
       */
      public function showAction($id) {
          try {
              //Order Service
              $orderService = $this-&gt;get('zanox_app.orderService');
  
              //merchant Orders
              $orders = $orderService-&gt;getMerchantOrders($id);
  
              //render view and pass orders array
              return $this-&gt;render('ZanoxAppBundle:Report:show.html.twig', ['orders' =&gt; $orders]);
          } catch (Exception $e) {
              //log errors
          }
      }
  
  }
  </code></pre>
  
  <p>I have created a functional test as following:</p>
  
  <pre><code>namespace Zanox\AppBundle\Tests\Controller;
  
  use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
  
  class ReportControllerTest extends WebTestCase {
  
      /**
       * 
       */
      public function testShow() {
          //Client instance
          $client = static::createClient();
  
          //Act like browsing the merchant listing page, via GET method
          $crawler = $client-&gt;request('GET', '/merchant/{id}/report', ['id'=&gt; 1]);
  
          //Getting the response of the requested URL
          $crawlerResponse = $client-&gt;getResponse();
  
          //Assert that Page is loaded ok
          $this-&gt;assertEquals(200, $crawlerResponse-&gt;getStatusCode());
  
          //Assert that the response content contains 'Merchant Listing' text
          $this-&gt;assertTrue($crawler-&gt;filter('html:contains("Merchant Report")')-&gt;count() &gt; 0);
      }
  
  }
  </code></pre>
  
  <p>However this test fails as the first assertion returns status 500 instead of 200</p>
  
  <p>Test log shows:
  [2015-07-06 21:00:24] request.INFO: Matched route "merchant-report". {"route_parameters":{"_controller":"Zanox\AppBundle\Controller\ReportController::showAction","id":"{id}","_route":"merchant-report"},"request_uri":"<a href="http://localhost/merchant/" rel="nofollow">http://localhost/merchant/</a>{id}/report?id=1"} []</p>
  
  <p>Letting you know that ['id' => 1] exists in DB.</p>
  
  <p>First Question:  why it fails?</p>
  
  <p>Second Question: am i doing the functional test in a proper way?</p>