Make WordPress Core


Ignore:
Timestamp:
09/06/2022 10:03:10 PM (21 months ago)
Author:
SergeyBiryukov
Message:

Tests: Correctly use the factory method.

This replaces all non-static calls to the WP_UnitTestCase_Base::factory() method with static function calls, since the method is declared as static.

This is a consistency improvement for the test suite.

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

Props jrf.
See #55652.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/customize/control.php

    r52010 r54088  
    2727    public function set_up() {
    2828        parent::set_up();
    29         wp_set_current_user( $this->factory()->user->create( array( 'role' => 'administrator' ) ) );
     29        wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
    3030        require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
    3131        $GLOBALS['wp_customize'] = new WP_Customize_Manager();
     
    139139
    140140        // Ensure that auto-draft pages are included if they are among the nav_menus_created_posts.
    141         $auto_draft_page_id = $this->factory()->post->create(
     141        $auto_draft_page_id = self::factory()->post->create(
    142142            array(
    143143                'post_type'   => 'page',
     
    146146            )
    147147        );
    148         $this->factory()->post->create(
     148        self::factory()->post->create(
    149149            array(
    150150                'post_type'   => 'page',
     
    153153            )
    154154        );
    155         $auto_draft_post_id = $this->factory()->post->create(
     155        $auto_draft_post_id = self::factory()->post->create(
    156156            array(
    157157                'post_type'   => 'post',
Note: See TracChangeset for help on using the changeset viewer.