Skip to content
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

Make setTimezone deprecation conditional #372

Merged
merged 1 commit into from
Jan 9, 2023
Merged

Conversation

markstory
Copy link
Member

Unfortunately the assertEquals() implementation for datetime values calls setTimezone() on instances. Because, I don't think it is reasonable to ask PHPUnit to have conditional logic for this, and I don't think it is reasonable to ask users to adapt all of their test code. These constraints led me to the solution of inspecting the preceding frames to see if we're inside PHPUnit assertion. If we aren't a deprecation is still emitted.

This helps improve compatibilty for the CakePHP tests.

Unfortunately the `assertEquals()` implementation for datetime values
calls `setTimezone()` on instances. Because, I don't think it is
reasonable to ask PHPUnit to have conditional logic for this, and
I don't think it is reasonable to ask users to adapt all of their test
code. These constraints led me to the solution of inspecting the
preceding frames to see if we're inside PHPUnit assertion. If we aren't
a deprecation is still emitted.
@markstory markstory added this to the 2.x milestone Jan 8, 2023
@markstory markstory merged commit b9cb164 into 2.next Jan 9, 2023
@markstory markstory deleted the fix-deprecations branch January 9, 2023 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant