title: Symfony Testing - ClockMock / DateTime
body: <p>I looking for help with creating complex test for our JSON API based application.</p>
  <p>Short problem scenario:</p>
  <ul>
  <li>Test create temporary entity (for compare)</li>
  <li>EntityManagerMock is set to wait for <strong>persist($temporaryEntity)</strong></li>
  <li>Test call real method with some parameters</li>
  <li>Method create entity and try to save at <strong>mocked EM</strong></li>
  <li>Test fails because time change for 1 second</li>
  </ul>
  <p><a href="https://i.stack.imgur.com/qcfcd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qcfcd.png" alt="enter image description here" /></a></p>
  <p>We tried to use <strong>ClockMock</strong> but it's work only for class where was called/for namespace. Our method is at other namespace and entity is created in some next.</p>
  <p>We looking for solution how to temporary override PHP platform <strong>\DateTime</strong> class - or technique how to use ClockMock for all namespaces/class in project (but only for tests). We tried to modify Symfony based ClockMock - but good way not found :-/.</p>
  <p>Is there any way? (I dont want use something like <strong>get_declared_class()</strong> and call with it clockMock::register - because it's very slow soloution for about 15.000 tests :-/.</p>
  <p>Thanks all!</p>