title: Issue with the Entity Manager and phpunit in Symfony 2
body: <p>I have an issue with my Entity Manager in phpunit.</p>
  
  <p>This is my test :</p>
  
  <pre><code>public function testValidChangeEmail()
  {
      $client = self::createAuthClient('user','password');
  
      $crawler = $client-&gt;request('GET', '/user/edit/30');
      $crawler = $client-&gt;submit($crawler-&gt;selectButton('submit')-&gt;form(array(
          'form[email]' =&gt; 'new@email.com',
      )));
  
      /*
       * With this em, this work perfectly 
       * $em = $client-&gt;getContainer()-&gt;get('doctrine.orm.entity_manager');
       */
  
      $user = self::$em-&gt;getRepository('MyBundle:User')-&gt;findUser('new@email.com');
  
      die(var_dump($user-&gt;getEmail()));
  }
  </code></pre>
  
  <p>and this is my WebTestCase which extends original WebTestCase :</p>
  
  <pre><code>class WebTestCase extends BaseWebTestCase
  {
      static protected $container;
      static protected $em;
  
      static protected function createClient(array $options = array(), array $server = array())
      {
          $client = parent::createClient($options, $server);
          self::$em = $client-&gt;getContainer()-&gt;get('doctrine.orm.entity_manager');
          self::$container = $client-&gt;getContainer();
  
          return $client;
      }
  
      protected function createAuthClient($user, $pass)
      {
          return self::createClient(array(), array(
              'PHP_AUTH_USER' =&gt; $user,
              'PHP_AUTH_PW'   =&gt; $pass,
          ));
      }
  </code></pre>
  
  <p>As you can see, I replace the self::$em when I created my client.</p>
  
  <p>My issue :</p>
  
  <p>In my test, the <code>die()</code> give me the old email and not the new email (<code>new@email.com</code>) which has registered in the test. However in my database, I have the <code>new@email.com</code> correctly saved.</p>
  
  <p>When I retrieve my user in the database, I use <code>sefl::$em</code>. If I use the <code>$em</code> in comments, I retrieve the right new email.</p>
  
  <p>I don't understand why in my WebTestCase, I can access to the new Entity Manager...  </p>