-
Notifications
You must be signed in to change notification settings - Fork 100
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
Prevent sending Location
header during test_perflab_aea_clean_aea_audit_action
#926
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @westonruter for the PR.
The test_ilo_get_normalized_query_vars
and test_ilo_can_optimize_response
tests change the global state for the URL so can we fixed those test instead of changing this test?
If we add $this->go_to( '' );
at bottom of both tests it will fixed the issue. Could you please take a look it. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@westonruter This fix makes sense to me. With your changes, the test no longer relies on the global query vars / URL state, but forces a referer. Previously this didn't work correctly since the wp_get_referer()
call returned false
and thus remove_query_arg()
would call the "current" URL.
Separately, I partially agree with @mukeshpanchal27's feedback that we should also ensure the go_to()
calls in #898 don't pollute global state, which is potentially the reason this failure was triggered in your branch.
OK, I've fixed this in #898 by unsetting Nevertheless, as Felix notes, this change is still an improvement. |
Summary
In working on #898, I noticed PHPUnit failing with:
This is due to
wp_safe_redirect()
being called byperflab_aea_clean_aea_audit_action()
which is attempting to send theLocation
header during testing.It's not clear to me why this unit test failure is not occurring in
trunk
.Relevant technical choices
Prevent
wp_safe_redirect()
from sending theLocation
header via thewp_redirect
filter in the unit test. Capture the redirected URL and test that it is as expected.Checklist
[Focus]
orInfrastructure
label.[Type]
label.no milestone
label.