Make WordPress Core


Ignore:
Timestamp:
09/06/2022 10:03:10 PM (2 years 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/general/template.php

    r53774 r54088  
    181181    public function test_customize_preview_wp_site_icon_empty() {
    182182        global $wp_customize;
    183         wp_set_current_user( $this->factory()->user->create( array( 'role' => 'administrator' ) ) );
     183        wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
    184184
    185185        require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
     
    199199    public function test_customize_preview_wp_site_icon_dirty() {
    200200        global $wp_customize;
    201         wp_set_current_user( $this->factory()->user->create( array( 'role' => 'administrator' ) ) );
     201        wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
    202202
    203203        require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
     
    599599     */
    600600    public function test_get_the_archive_title_is_correct_for_author_queries() {
    601         $user_with_posts    = $this->factory()->user->create_and_get(
     601        $user_with_posts    = self::factory()->user->create_and_get(
    602602            array(
    603603                'role' => 'author',
    604604            )
    605605        );
    606         $user_with_no_posts = $this->factory()->user->create_and_get(
     606        $user_with_no_posts = self::factory()->user->create_and_get(
    607607            array(
    608608                'role' => 'author',
     
    610610        );
    611611
    612         $this->factory()->post->create(
     612        self::factory()->post->create(
    613613            array(
    614614                'post_author' => $user_with_posts->ID,
Note: See TracChangeset for help on using the changeset viewer.