Make WordPress Core


Ignore:
Timestamp:
09/06/2022 10:09:49 PM (3 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-post-statuses-controller.php

    r51367 r54090  
    4444
    4545    public function test_get_items_logged_in() {
    46         $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
     46        $user_id = self::factory()->user->create( array( 'role' => 'author' ) );
    4747        wp_set_current_user( $user_id );
    4848
     
    7373
    7474    public function test_get_item() {
    75         $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
     75        $user_id = self::factory()->user->create( array( 'role' => 'author' ) );
    7676        wp_set_current_user( $user_id );
    7777        $request = new WP_REST_Request( 'GET', '/wp/v2/statuses/publish' );
     
    9595
    9696    public function test_get_item_invalid_internal() {
    97         $user_id = $this->factory->user->create();
     97        $user_id = self::factory()->user->create();
    9898        wp_set_current_user( $user_id );
    9999
Note: See TracChangeset for help on using the changeset viewer.