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

    r53948 r54088  
    163163    public function test_constructor_deferred_changeset_uuid() {
    164164        wp_set_current_user( self::$admin_user_id );
    165         $other_admin_user_id = $this->factory()->user->create( array( 'role' => 'admin' ) );
     165        $other_admin_user_id = self::factory()->user->create( array( 'role' => 'admin' ) );
    166166
    167167        $data = array(
     
    172172
    173173        $uuid1 = wp_generate_uuid4();
    174         $this->factory()->post->create(
     174        self::factory()->post->create(
    175175            array(
    176176                'post_type'     => 'customize_changeset',
     
    188188         */
    189189        $uuid2   = wp_generate_uuid4();
    190         $post_id = $this->factory()->post->create(
     190        $post_id = self::factory()->post->create(
    191191            array(
    192192                'post_type'     => 'customize_changeset',
     
    425425    public function test_find_changeset_post_id() {
    426426        $uuid    = wp_generate_uuid4();
    427         $post_id = $this->factory()->post->create(
     427        $post_id = self::factory()->post->create(
    428428            array(
    429429                'post_name'    => $uuid,
     
    455455        $uuid         = wp_generate_uuid4();
    456456        $wp_customize = new WP_Customize_Manager( array( 'changeset_uuid' => $uuid ) );
    457         $post_id      = $this->factory()->post->create(
     457        $post_id      = self::factory()->post->create(
    458458            array(
    459459                'post_name'    => $uuid,
     
    483483            'blogdescription' => array( 'value' => 'Greet the world' ),
    484484        );
    485         $this->factory()->post->create(
     485        self::factory()->post->create(
    486486            array(
    487487                'post_name'    => $uuid,
     
    566566            )
    567567        );
    568         $existing_published_home_page_id   = $this->factory()->post->create(
     568        $existing_published_home_page_id   = self::factory()->post->create(
    569569            array(
    570570                'post_name'   => 'home',
     
    573573            )
    574574        );
    575         $existing_auto_draft_about_page_id = $this->factory()->post->create(
     575        $existing_auto_draft_about_page_id = self::factory()->post->create(
    576576            array(
    577577                'post_name'   => 'about',
     
    821821        wp_set_current_user( self::$admin_user_id );
    822822
    823         $existing_published_home_page_id = $this->factory()->post->create(
     823        $existing_published_home_page_id = self::factory()->post->create(
    824824            array(
    825825                'post_name'   => 'home',
     
    18791879            array(
    18801880                'autosave' => true,
    1881                 'user_id'  => $this->factory()->user->create( array( 'role' => 'administrator' ) ),
     1881                'user_id'  => self::factory()->user->create( array( 'role' => 'administrator' ) ),
    18821882            )
    18831883        );
     
    20322032        $new_sidebar_1 = array_reverse( $new_sidebars_widgets['sidebar-1'] );
    20332033
    2034         $post_id = $this->factory()->post->create(
     2034        $post_id = self::factory()->post->create(
    20352035            array(
    20362036                'post_type'    => 'customize_changeset',
     
    23362336            ),
    23372337        );
    2338         $this->factory()->post->create(
     2338        self::factory()->post->create(
    23392339            array(
    23402340                'post_type'    => 'customize_changeset',
     
    28312831        $this->assertFalse( $this->manager->has_published_pages() );
    28322832
    2833         $this->factory()->post->create(
     2833        self::factory()->post->create(
    28342834            array(
    28352835                'post_type'   => 'page',
     
    28392839        $this->assertFalse( $this->manager->has_published_pages() );
    28402840
    2841         $this->factory()->post->create(
     2841        self::factory()->post->create(
    28422842            array(
    28432843                'post_type'   => 'page',
     
    28652865        $setting    = $this->manager->get_setting( $setting_id );
    28662866        $this->assertInstanceOf( 'WP_Customize_Filter_Setting', $setting );
    2867         $auto_draft_page = $this->factory()->post->create(
     2867        $auto_draft_page = self::factory()->post->create(
    28682868            array(
    28692869                'post_type'   => 'page',
Note: See TracChangeset for help on using the changeset viewer.