title: Symfony 3.3 service mocks for functional tests
body: <p>Before Symfony 3.3 it was allowed to set a mocked service onto the container. Now with 3.3 a deprecation warning is thrown because the service is already pre-defined.</p>
  
  <p>What is the new standard way to overwrite an existing or pre-defined service in the container to set a mocked service for a functional test?</p>
  
  <p>E.g. in our case we set a new entity manager with a new mocked connection pointing to a cloned database for testing.</p>
  
  <pre><code>$container-&gt;set('doctrine.orm.entity_manager', $testEm);
  </code></pre>
  
  <blockquote>
    <p>Setting the "doctrine.orm.entity_manager" pre-defined service is deprecated since Symfony 3.3 and won't be supported anymore in Symfony 4.0.</p>
  </blockquote>