Tests: Use the factory method instead of the property.

This replaces all references to the `WP_UnitTestCase_Base::$factory` property with static function calls to the `WP_UnitTestCase_Base::factory()` method.

This is a consistency improvement for the test suite.

Follow up to [35225], [35242], [49603], [54087], [54088].

Props jrf.
See #55652.

git-svn-id: https://develop.svn.wordpress.org/trunk@54090 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2022-09-06 22:09:49 +00:00
parent 563e24ced1
commit ff56396bf3
52 changed files with 598 additions and 598 deletions
+2 -2
View File
@@ -978,13 +978,13 @@ class Tests_Query_Conditionals extends WP_UnitTestCase {
public function test_is_single_with_slug_that_clashes_with_attachment() {
$this->set_permalink_structure( '/%postname%/' );
$attachment_id = $this->factory->post->create(
$attachment_id = self::factory()->post->create(
array(
'post_type' => 'attachment',
)
);
$post_id = $this->factory->post->create(
$post_id = self::factory()->post->create(
array(
'post_title' => get_post( $attachment_id )->post_title,
)
+2 -2
View File
@@ -73,7 +73,7 @@ class Tests_Query_NoFoundRows extends WP_UnitTestCase {
* @ticket 29552
*/
public function test_no_found_rows_default_with_nopaging_true() {
$p = $this->factory->post->create();
$p = self::factory()->post->create();
$q = new WP_Query(
array(
@@ -90,7 +90,7 @@ class Tests_Query_NoFoundRows extends WP_UnitTestCase {
* @ticket 29552
*/
public function test_no_found_rows_default_with_postsperpage_minus1() {
$p = $this->factory->post->create();
$p = self::factory()->post->create();
$q = new WP_Query(
array(
+2 -2
View File
@@ -266,7 +266,7 @@ class Tests_Query_Search extends WP_UnitTestCase {
* @ticket 31025
*/
public function test_s_zero() {
$p1 = $this->factory->post->create(
$p1 = self::factory()->post->create(
array(
'post_status' => 'publish',
'post_title' => '1',
@@ -275,7 +275,7 @@ class Tests_Query_Search extends WP_UnitTestCase {
)
);
$p2 = $this->factory->post->create(
$p2 = self::factory()->post->create(
array(
'post_status' => 'publish',
'post_title' => '0',