Tests: Use the recognized ID orderby value in a query test (7.1) - #13969
lancewillett wants to merge 1 commit into
Conversation
`Tests_Query_ThePost::test_wp_query_with_custom_fields_value_populates_the_global_post()` ordered its query by `id`, which `WP_Query` does not recognize. The query fell back to ordering by date, and the fixture pages share a date, so the result depended on the database's tie order. Backports the `thePost.php` change from [64016] to the 7.1 branch. Props jonsurrell, adrianmoldovanwp. See #65893.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Trac ticket: https://core.trac.wordpress.org/ticket/65893
Tests_Query_ThePost::test_wp_query_with_custom_fields_value_populates_the_global_postpasses'orderby' => 'id'.WP_Querydoes not recognizeid(the allowed key isID), so the query falls back to ordering by date. The four fixture pages share a date, so the database chooses the order. On MariaDB the test can return a different child page than it expects, depending on the post IDs that earlier tests in the run leave behind. Trunk fixed this in 64016; the 7.1, 7.0, 6.9 and 6.8 branches still have the old value.Backports the
thePost.phpchange from [64016] to the 7.1 branch.Only the
orderbyvalue changes; the other changes in [64016] are not included.Related branches: 7.0: #13968, 6.9: #13970, 6.8: #13971.
Validation
The identical one-line change passed
npm run test:php -- --filter Tests_Query_ThePoston 7.0: 16 tests, 61 assertions.Use of AI Tools
AI assistance: Yes
Tool(s): Codex
Model(s): gpt-6
Used for: Applying the existing fix, preparing the commits and PR descriptions, and running local validation.