Tests: Avoid duplicate queries in some WP_Query tests.

When passing args to the `WP_Query::__construct()` method, it internally executes the `WP_Query::get_posts()` method and stores the result in the `WP_Query::posts` property.

When calling `WP_Query::get_posts()` again, the same SQL query gets executed, and the result is again stored in the `WP_Query::posts` property.

Thus, the correct usage is to read the posts already stored in the `WP_Query::posts` property.

Follow-up to [1062/tests], [1065/tests], [1066/tests], [1070/tests], [29805], [31286], [49900], [51144].

Props david.binda.
Fixes #54822.
Built from https://develop.svn.wordpress.org/trunk@52577


git-svn-id: http://core.svn.wordpress.org/trunk@52167 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-01-14 17:52:01 +00:00
parent d73a6bcc64
commit 59287c1157

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-alpha-52576';
$wp_version = '6.0-alpha-52577';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.