Make WordPress Core


Ignore:
Timestamp:
09/06/2022 10:09:49 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Tests: Use the factory method instead of the property.

This replaces all references to the WP_UnitTestCase_Base::$factory property with static function calls to the WP_UnitTestCase_Base::factory() method.

This is a consistency improvement for the test suite.

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

Props jrf.
See #55652.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/comment/template.php

    r53863 r54090  
    5959    public function test_get_comments_number_text_with_post_id() {
    6060        $post_id = self::$post_id;
    61         $this->factory->comment->create_post_comments( $post_id, 6 );
     61        self::factory()->comment->create_post_comments( $post_id, 6 );
    6262
    6363        $comments_number_text = get_comments_number_text( false, false, false, $post_id );
     
    8585        $this->assertSame( __( 'No Comments' ), get_comments_number_text() );
    8686
    87         $this->factory->comment->create_post_comments( $post_id, 1 );
     87        self::factory()->comment->create_post_comments( $post_id, 1 );
    8888        $this->go_to( $permalink );
    8989
    9090        $this->assertSame( __( '1 Comment' ), get_comments_number_text() );
    9191
    92         $this->factory->comment->create_post_comments( $post_id, 1 );
     92        self::factory()->comment->create_post_comments( $post_id, 1 );
    9393        $this->go_to( $permalink );
    9494
     
    107107        $permalink = get_permalink( $post_id );
    108108
    109         $this->factory->comment->create_post_comments( $post_id, $number );
     109        self::factory()->comment->create_post_comments( $post_id, $number );
    110110        $this->go_to( $permalink );
    111111
Note: See TracChangeset for help on using the changeset viewer.