title: Object of class Symfony\Component\DomCrawler\Crawler could not be converted to string
body: <p>I am trying to run my first functional test in Symfony2 using the DemoController.</p>
  
  <p>If I load the page from the browser the data displayed are correct.
  But if I try to run the test by using the command <code>phpunit -c app</code> I got the following error message:</p>
  
  <pre><code>There was 1 error:
  
  1) Blog\CoreBundle\Tests\Controller\AuthorControllerTest::testShow
  Object of class Symfony\Component\DomCrawler\Crawler could not be converted to string
  </code></pre>
  
  <p>Here is my AuthorControllerTest class:</p>
  
  <pre><code>&lt;?php
  
  namespace Blog\CoreBundle\Tests\Controller;
  
  use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
  
  /**
   * Class AuthorControllerTest
   */
  class AuthorControllerTest extends WebTestCase
  {
      /**
       * Test show author
       */
      public function testShow()
      {
          $client = static::createClient();
  
          /** @var Author $author */
          $author = $client-&gt;getContainer()
              -&gt;get('doctrine')
              -&gt;getManager()
              -&gt;getRepository('ModelBundle:Author')
              -&gt;findFirst();
          $authorPostCount = $author-&gt;getPosts()-&gt;count();
  
          $crawler = $client-&gt;request('GET', '/author/'.$author-&gt;getSlug());
  
          $this-&gt;assertTrue($client-&gt;getResponse()-&gt;isSuccessful(), 'The response was not successful');
  
          $this-&gt;assertTrue($authorPostCount, $crawler-&gt;filter('h2'), 'There should be '.$authorPostCount.' posts');
      }
  
  }
  </code></pre>