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/query.php

    r53861 r54090  
    645645        register_taxonomy( 'tax2', 'post' );
    646646
    647         $term1   = $this->factory->term->create(
     647        $term1   = self::factory()->term->create(
    648648            array(
    649649                'taxonomy' => 'tax1',
     
    651651            )
    652652        );
    653         $term2   = $this->factory->term->create(
     653        $term2   = self::factory()->term->create(
    654654            array(
    655655                'taxonomy' => 'tax2',
     
    657657            )
    658658        );
    659         $post_id = $this->factory->post->create();
     659        $post_id = self::factory()->post->create();
    660660        wp_set_object_terms( $post_id, 'term1', 'tax1' );
    661661        wp_set_object_terms( $post_id, 'term2', 'tax2' );
     
    675675        register_taxonomy( 'tax2', 'post' );
    676676
    677         $term1   = $this->factory->term->create(
     677        $term1   = self::factory()->term->create(
    678678            array(
    679679                'taxonomy' => 'tax1',
     
    681681            )
    682682        );
    683         $term2   = $this->factory->term->create(
     683        $term2   = self::factory()->term->create(
    684684            array(
    685685                'taxonomy' => 'tax2',
     
    687687            )
    688688        );
    689         $post_id = $this->factory->post->create();
     689        $post_id = self::factory()->post->create();
    690690        wp_set_object_terms( $post_id, 'term1', 'tax1' );
    691691        wp_set_object_terms( $post_id, 'term2', 'tax2' );
Note: See TracChangeset for help on using the changeset viewer.