title: Symfony 4 : Override public services in container
body: <p>I am migrating our project to Symfony 4. In my test suites, we used PHPUnit for functional tests (I mean, we call endpoints and we check result). Often, we mock services to check different steps.</p>
  
  <p>Since I migrated to Symfony 4, I am facing this issue: <code>Symfony\Component\DependencyInjection\Exception\InvalidArgumentException: The "my.service" service is already initialized, you cannot replace it.</code>
  when we redefine it like this : <code>static::$container-&gt;set("my.service", $mock);</code></p>
  
  <p>Only for tests, how can I fix this issue?</p>
  
  <p>Thank you</p>