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/wpRestMenusController.php

    r52079 r54090  
    8686        );
    8787
    88         $this->menu_id = $this->factory->term->create( $orig_args );
     88        $this->menu_id = self::factory()->term->create( $orig_args );
    8989
    9090        register_meta(
     
    134134        $this->assertSame( array( 'v1' => true ), $data['endpoints'][0]['allow_batch'] );
    135135        // Single.
    136         $tag1     = $this->factory->tag->create( array( 'name' => 'Season 5' ) );
     136        $tag1     = self::factory()->tag->create( array( 'name' => 'Season 5' ) );
    137137        $request  = new WP_REST_Request( 'OPTIONS', '/wp/v2/menus/' . $tag1 );
    138138        $response = rest_get_server()->dispatch( $request );
Note: See TracChangeset for help on using the changeset viewer.