minor #22324 [HttpFoundation] Fix transient tests (nicolas-grekas)

This PR was merged into the 2.8 branch.

Discussion
----------

[HttpFoundation] Fix transient tests

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

We need to call `time()` when creating `DateTime` objects so that the clock-mock system can work.
This fixes some newly introduced transient tests.
ping @mpdude FYI

Commits
-------

9f7a6bb5e5 [HttpFoundation] Fix transient tests
This commit is contained in:
Fabien Potencier 2017-04-06 16:38:46 -07:00
commit f9d5ede9c6

View File

@ -204,7 +204,7 @@ class Response
/* RFC2616 - 14.18 says all Responses need to have a Date */
if (!$this->headers->has('Date')) {
$this->setDate(new \DateTime(null, new \DateTimeZone('UTC')));
$this->setDate(\DateTime::createFromFormat('U', time()));
}
}