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/term/termCounts.php

    r52010 r54088  
    9191        $term_count = get_term( get_option( 'default_category' ) )->count;
    9292        // Do not use shared fixture for this test as it relies on a new post.
    93         $post_id = $this->factory()->post->create( array( 'post_status' => $post_status ) );
     93        $post_id = self::factory()->post->create( array( 'post_status' => $post_status ) );
    9494
    9595        $expected = $term_count + $change;
     
    245245        add_filter( 'update_post_term_count_statuses', array( $this, 'add_custom_status_to_counted_statuses' ) );
    246246
    247         $post_id = $this->factory()->post->create( array( 'post_status' => $post_status ) );
     247        $post_id = self::factory()->post->create( array( 'post_status' => $post_status ) );
    248248        wp_add_object_terms( $post_id, self::$attachment_term, 'wp_test_tax_counts' );
    249249        $attachment_id = self::factory()->attachment->create_object(
     
    297297        $term_count = get_term( self::$attachment_term )->count;
    298298        // Do not use shared fixture for this test as it relies on a new post.
    299         $post_id = $this->factory()->post->create( array( 'post_status' => $post_status ) );
     299        $post_id = self::factory()->post->create( array( 'post_status' => $post_status ) );
    300300        wp_add_object_terms( $post_id, self::$attachment_term, 'wp_test_tax_counts' );
    301301        $attachment_id = self::factory()->attachment->create_object(
Note: See TracChangeset for help on using the changeset viewer.