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/post/wpInsertPost.php

    r53883 r54088  
    14261426        wp_set_current_user( self::$user_ids['contributor'] );
    14271427
    1428         $post_id = $this->factory()->post->create(
     1428        $post_id = self::factory()->post->create(
    14291429            array(
    14301430                'post_title'   => 'Jefferson claim: nice to have Washington on your side.',
     
    14651465        wp_set_current_user( self::$user_ids['administrator'] );
    14661466
    1467         $post_id = $this->factory()->post->create(
     1467        $post_id = self::factory()->post->create(
    14681468            array(
    14691469                'post_title'   => 'What is the Conner Project?',
     
    15061506        wp_set_current_user( self::$user_ids['administrator'] );
    15071507
    1508         $post_id = $this->factory()->post->create(
     1508        $post_id = self::factory()->post->create(
    15091509            array(
    15101510                'post_title'   => 'Everything is legal in New Jersey',
     
    15431543        $now = new DateTimeImmutable( 'now', new DateTimeZone( 'UTC' ) );
    15441544
    1545         $post_id = $this->factory()->post->create(
     1545        $post_id = self::factory()->post->create(
    15461546            array(
    15471547                'post_date_gmt' => $now->modify( '-1 year' )->format( 'Y-m-d H:i:s' ),
     
    15521552        $this->assertSame( 'publish', get_post_status( $post_id ) );
    15531553
    1554         $post_id = $this->factory()->post->create(
     1554        $post_id = self::factory()->post->create(
    15551555            array(
    15561556                'post_date_gmt' => $now->modify( '+50 years' )->format( 'Y-m-d H:i:s' ),
Note: See TracChangeset for help on using the changeset viewer.