[wp-trac] [WordPress Trac] #54822: Incorrectly accessing posts fetched by WP_Query in query PHPUnit tests
WordPress Trac
noreply at wordpress.org
Fri Jan 14 16:10:20 UTC 2022
#54822: Incorrectly accessing posts fetched by WP_Query in query PHPUnit tests
------------------------------+-----------------------------
Reporter: david.binda | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Build/Test Tools | Version:
Severity: normal | Keywords:
Focuses: |
------------------------------+-----------------------------
Similarly to #53280, the usage of `WP_Query::get_posts()` method after the
`WP_Query` object was initialised with arguments passed to it is incorrect
in tests/phpunit/tests/query/invalidQueries.php and
tests/phpunit/tests/query/taxQuery.php PHPUnit tests, as it triggers just
one more SQL query.
For instance:
https://core.trac.wordpress.org/browser/trunk/tests/phpunit/tests/query/invalidQueries.php?rev=51568#L94
or
https://core.trac.wordpress.org/browser/trunk/tests/phpunit/tests/query/taxQuery.php?rev=52389#L1027
Instead, the posts should be read via `WP_Query::posts` property.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54822>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list