mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
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:
@@ -205,7 +205,7 @@ class WP_Test_REST_Schema_Initialization extends WP_Test_REST_TestCase {
|
||||
// fixture file will be different between runs of PHPUnit tests, which
|
||||
// is not desirable.
|
||||
|
||||
$administrator_id = $this->factory->user->create(
|
||||
$administrator_id = self::factory()->user->create(
|
||||
array(
|
||||
'role' => 'administrator',
|
||||
'display_name' => 'REST API Client Fixture: User',
|
||||
@@ -215,7 +215,7 @@ class WP_Test_REST_Schema_Initialization extends WP_Test_REST_TestCase {
|
||||
);
|
||||
wp_set_current_user( $administrator_id );
|
||||
|
||||
$post_id = $this->factory->post->create(
|
||||
$post_id = self::factory()->post->create(
|
||||
array(
|
||||
'post_name' => 'restapi-client-fixture-post',
|
||||
'post_title' => 'REST API Client Fixture: Post',
|
||||
@@ -243,7 +243,7 @@ class WP_Test_REST_Schema_Initialization extends WP_Test_REST_TestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$page_id = $this->factory->post->create(
|
||||
$page_id = self::factory()->post->create(
|
||||
array(
|
||||
'post_type' => 'page',
|
||||
'post_name' => 'restapi-client-fixture-page',
|
||||
@@ -273,7 +273,7 @@ class WP_Test_REST_Schema_Initialization extends WP_Test_REST_TestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$tag_id = $this->factory->tag->create(
|
||||
$tag_id = self::factory()->tag->create(
|
||||
array(
|
||||
'name' => 'REST API Client Fixture: Tag',
|
||||
'slug' => 'restapi-client-fixture-tag',
|
||||
@@ -281,7 +281,7 @@ class WP_Test_REST_Schema_Initialization extends WP_Test_REST_TestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$media_id = $this->factory->attachment->create_object(
|
||||
$media_id = self::factory()->attachment->create_object(
|
||||
get_temp_dir() . 'canola.jpg',
|
||||
0,
|
||||
array(
|
||||
@@ -295,7 +295,7 @@ class WP_Test_REST_Schema_Initialization extends WP_Test_REST_TestCase {
|
||||
)
|
||||
);
|
||||
|
||||
$comment_id = $this->factory->comment->create(
|
||||
$comment_id = self::factory()->comment->create(
|
||||
array(
|
||||
'comment_approved' => 1,
|
||||
'comment_post_ID' => $post_id,
|
||||
|
||||
Reference in New Issue
Block a user