Make WordPress Core


Ignore:
Timestamp:
09/06/2022 10:09:49 PM (4 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php

    r54043 r54090  
    206206                // is not desirable.
    207207
    208                 $administrator_id = $this->factory->user->create(
     208                $administrator_id = self::factory()->user->create(
    209209                        array(
    210210                                'role'          => 'administrator',
    … …  
    216216                wp_set_current_user( $administrator_id );
    217217
    218                 $post_id = $this->factory->post->create(
     218                $post_id = self::factory()->post->create(
    219219                        array(
    220220                                'post_name'    => 'restapi-client-fixture-post',
    … …  
    244244                );
    245245
    246                 $page_id = $this->factory->post->create(
     246                $page_id = self::factory()->post->create(
    247247                        array(
    248248                                'post_type'     => 'page',
    … …  
    274274                );
    275275
    276                 $tag_id = $this->factory->tag->create(
     276                $tag_id = self::factory()->tag->create(
    277277                        array(
    278278                                'name'        => 'REST API Client Fixture: Tag',
    … …  
    282282                );
    283283
    284                 $media_id = $this->factory->attachment->create_object(
     284                $media_id = self::factory()->attachment->create_object(
    285285                        get_temp_dir() . 'canola.jpg',
    286286                        0,
    … …  
    296296                );
    297297
    298                 $comment_id = $this->factory->comment->create(
     298                $comment_id = self::factory()->comment->create(
    299299                        array(
    300300                                'comment_approved'     => 1,
Note: See TracChangeset for help on using the changeset viewer.