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/nav-menus.php

    r52010 r54088  
    852852    public function test_sanitize_nav_menus_created_posts() {
    853853        $menus                 = new WP_Customize_Nav_Menus( $this->wp_customize );
    854         $contributor_user_id   = $this->factory()->user->create( array( 'role' => 'contributor' ) );
    855         $author_user_id        = $this->factory()->user->create( array( 'role' => 'author' ) );
    856         $administrator_user_id = $this->factory()->user->create( array( 'role' => 'administrator' ) );
    857 
    858         $contributor_post_id   = $this->factory()->post->create(
     854        $contributor_user_id   = self::factory()->user->create( array( 'role' => 'contributor' ) );
     855        $author_user_id        = self::factory()->user->create( array( 'role' => 'author' ) );
     856        $administrator_user_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
     857
     858        $contributor_post_id   = self::factory()->post->create(
    859859            array(
    860860                'post_status' => 'auto-draft',
     
    864864            )
    865865        );
    866         $author_post_id        = $this->factory()->post->create(
     866        $author_post_id        = self::factory()->post->create(
    867867            array(
    868868                'post_status' => 'auto-draft',
     
    872872            )
    873873        );
    874         $administrator_post_id = $this->factory()->post->create(
     874        $administrator_post_id = self::factory()->post->create(
    875875            array(
    876876                'post_status' => 'auto-draft',
     
    881881        );
    882882
    883         $draft_post_id = $this->factory()->post->create(
     883        $draft_post_id = self::factory()->post->create(
    884884            array(
    885885                'post_status' => 'draft',
     
    889889        );
    890890
    891         $private_post_id = $this->factory()->post->create(
     891        $private_post_id = self::factory()->post->create(
    892892            array(
    893893                'post_status' => 'private',
     
    991991        $trashed_post_id = $r->ID;
    992992
    993         $pre_published_post_id = $this->factory()->post->create( array( 'post_status' => 'publish' ) );
     993        $pre_published_post_id = self::factory()->post->create( array( 'post_status' => 'publish' ) );
    994994
    995995        $setting_id = 'nav_menus_created_posts';
Note: See TracChangeset for help on using the changeset viewer.