Symfony Testing - ClockMock / DateTime
The ClockMock doesn't work for new \DateTime()
but only on time-based PHP function.
From the announcement of the features:
This means that you don't need to make a single change in your original code, except when using
new DateTime()
, which must be replaced byDateTime::createFromFormat('U', time())
to use the mockedtime()
function.
So try as suggested: replace any DateTime object creation with the named-constructor with the time function.
Hope this help