Skip to content

[Yaml] fix DateTime tests #18093

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Mar 10, 2016

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

Please note: This is mainly a workaround for the failing tests in the component. I was not able to reproduce the failures locally nor do I have a clue why this happens. So I'd be glad if someone can come up with an explanation for this behaviour which confirms that this is the right fix or that we should fix it in another way.

@jakzal
Copy link
Contributor

jakzal commented Mar 10, 2016

@xabbuh have you tried changing your local timezone to reproduce the problem?

@xabbuh
Copy link
Member Author

xabbuh commented Mar 10, 2016

@jakzal Yes, but the result was the same.

@nicolas-grekas
Copy link
Member

The issue is that PHP 5.5.14+ handles sub-seconds whereas previous PHP did not:
https://3v4l.org/Lo0cX
and an other issue is the TZ injection is ignored when the parsed time contains a TZ info.
I'm about to fix both issues in an other PR

@xabbuh
Copy link
Member Author

xabbuh commented Mar 10, 2016

closing in favour of #18098

@xabbuh xabbuh closed this Mar 10, 2016
@xabbuh xabbuh deleted the yaml-datetime-tests branch March 10, 2016 14:16
nicolas-grekas added a commit that referenced this pull request Mar 10, 2016
This PR was merged into the 3.1-dev branch.

Discussion
----------

[Yaml] Fix tests

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

`now` contains a TZ info (the current default TZ), so that the following ignores the injected TZ:
`new \DateTime('now', new \DateTimeZone('UTC'))`

An other fix is that since PHP 5.5.14, timestamps contains sub-seconds numbers that where previously ignore.

This fixes both issues.

Commits
-------

25677fe [Yaml] Fix tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants