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

GH Actions/Tests: no longer allow test runs on PHP 8.1 + 8.2 to fail #3173

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Sep 2, 2022

With one prepared PHP 8.1 patch still to be committed (first two commits in this PR), we're down to 3 errors and 1 test failure on both PHP 8.1 + 8.2.

The test failure is being addressed in Trac ticket 56681.

The last remaining errors need further investigation, but in the mean time, we should actively prevent new PHP issues from being introduced in WP Core.

To that end, I'm proposing to skip those last four tests, either on all PHP versions (the failure, see the explanation in the ticket mentioned above) or on PHP 8.1+ (the three test errors).

With those test skips in place, we now have a 🟢 build for both PHP 8.1 + 8.2 and can remove the continue-on-error.

Trac ticket: https://core.trac.wordpress.org/ticket/55652


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@jrfnl jrfnl force-pushed the WIP/trac-55652/ghactions-get-passing-build-php-81 branch 4 times, most recently from 5b3a3e4 to 9a1eac5 Compare September 5, 2022 13:11
@jrfnl jrfnl force-pushed the WIP/trac-55652/ghactions-get-passing-build-php-81 branch from 9a1eac5 to c91471a Compare September 12, 2022 22:59
@jrfnl jrfnl force-pushed the WIP/trac-55652/ghactions-get-passing-build-php-81 branch 3 times, most recently from 8640297 to bfd40a9 Compare September 27, 2022 02:33
@jrfnl jrfnl force-pushed the WIP/trac-55652/ghactions-get-passing-build-php-81 branch 6 times, most recently from a6ac0c1 to 00207df Compare September 30, 2022 15:57
@jrfnl jrfnl marked this pull request as ready for review September 30, 2022 16:11
@jrfnl jrfnl changed the title WIP | GH Actions/Tests: no longer allow tests runs on PHP 8.1 to fail GH Actions/Tests: no longer allow tests runs on PHP 8.1 to fail Sep 30, 2022
@jrfnl jrfnl changed the title GH Actions/Tests: no longer allow tests runs on PHP 8.1 to fail GH Actions/Tests: no longer allow test runs on PHP 8.1 + 8.2 to fail Sep 30, 2022
jrfnl and others added 3 commits October 1, 2022 12:16
This test was brought to my attention due to it failing on PHP 8.1.

I have investigated the test failure and the failure is a little more problematic than a "plain" PHP compatibility issue.

* The test sets a `$post_content` of `'Hello World'`, then does some things and then verifies that the subsequent REST API response does _not_ contain `'Hello World'` via a `assertStringNotContainsString()`.
* The  problem is that the original post which was created with the `'Hello World'` content, was created as a _password protected post_.
* I couldn't reproduce the test failure locally on PHP 8.1 and when I dug deeper, it turned out that it was because the REST API response returned contained `'This content is password protected.'` instead of `'Hello World'`.
* As the tests uses the _negative_ assertion `assertStringNotContainsString()`, it would pass, but as far as I can see, **it doesn't actually test what it should be testing**.

My interim conclusion is that this needs further investigation on what the _intention_ was behind the test and the test probably needs to be rewritten to make sure the test tests what it is supposed to test.

I'm proposing to skip that test for now (on all PHP versions) until it has been fixed, as, as it is, the test has no value.
These three tests would run into a PHP 8.1 "passing null to non-nullable" deprecation for the call to `trim()` when the result of `get_edit_post_link()` is passed to `esc_url()`.

Setting a deprecation expectation would not solve this as the returned value would still not match the expected value(s).

By setting a a current user, the prerequisites for the `wp_dashboard_recent_drafts()` are met, which means the deprecation notice is avoided and the assertions will succeed.

With this change included, the `continue-on-error` for PHP 8.1 and 8.2 can be removed, which will prevent new PHP 8.1 and 8.2 issues from being introduced.

Co-authored-by: Sergey Biryukov <sergeybiryukov@git.wordpress.org>
@jrfnl jrfnl force-pushed the WIP/trac-55652/ghactions-get-passing-build-php-81 branch from 00207df to 4cfa3c9 Compare October 1, 2022 10:36
@jrfnl
Copy link
Member Author

jrfnl commented Oct 1, 2022

I have rebased the PR after [54364] was committed, which means the first two commits are now gone.

The last commit skipping three tests for PHP 8.1 has been replaced with a commit applying @SergeyBiryukov's suggestion.

@SergeyBiryukov
Copy link
Member

Thanks for the PR! Merged in r54365 and r54369.

The REST API test issue was further investigated and resolved in r54368.

@jrfnl jrfnl deleted the WIP/trac-55652/ghactions-get-passing-build-php-81 branch October 17, 2023 19:39
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.

2 participants