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/ajax/CustomizeManager.php

    r53561 r54088  
    308308        $uuid = wp_generate_uuid4();
    309309
    310         $post_id      = $this->factory()->post->create(
     310        $post_id      = self::factory()->post->create(
    311311            array(
    312312                'post_name'    => $uuid,
     
    347347    public function test_success_save_post_date() {
    348348        $uuid         = wp_generate_uuid4();
    349         $post_id      = $this->factory()->post->create(
     349        $post_id      = self::factory()->post->create(
    350350            array(
    351351                'post_name'    => $uuid,
     
    447447        $uuid = wp_generate_uuid4();
    448448
    449         $post_id = $this->factory()->post->create(
     449        $post_id = self::factory()->post->create(
    450450            array(
    451451                'post_name'    => $uuid,
     
    615615        $this->assertSame( 'no_auto_draft_to_delete', $this->_last_response_parsed['data'] );
    616616
    617         $other_user_id = $this->factory()->user->create();
     617        $other_user_id = self::factory()->user->create();
    618618
    619619        // Create auto-drafts.
    620620        $user_auto_draft_ids = array();
    621621        for ( $i = 0; $i < 3; $i++ ) {
    622             $user_auto_draft_ids[] = $this->factory()->post->create(
     622            $user_auto_draft_ids[] = self::factory()->post->create(
    623623                array(
    624624                    'post_name'    => wp_generate_uuid4(),
     
    632632        $other_user_auto_draft_ids = array();
    633633        for ( $i = 0; $i < 3; $i++ ) {
    634             $other_user_auto_draft_ids[] = $this->factory()->post->create(
     634            $other_user_auto_draft_ids[] = self::factory()->post->create(
    635635                array(
    636636                    'post_name'    => wp_generate_uuid4(),
Note: See TracChangeset for help on using the changeset viewer.