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/feed/rss2.php

    r54050 r54088  
    523523
    524524        // Create a post dated last week.
    525         $post_id = $this->factory()->post->create( array( 'post_date' => $last_week ) );
     525        $post_id = self::factory()->post->create( array( 'post_date' => $last_week ) );
    526526
    527527        // Create a comment dated yesterday.
    528         $this->factory()->comment->create(
     528        self::factory()->comment->create(
    529529            array(
    530530                'comment_post_ID' => $post_id,
     
    562562
    563563        // Create a post dated last week.
    564         $post_id = $this->factory()->post->create( array( 'post_date' => $last_week ) );
     564        $post_id = self::factory()->post->create( array( 'post_date' => $last_week ) );
    565565
    566566        // Create a comment dated yesterday.
    567         $this->factory()->comment->create(
     567        self::factory()->comment->create(
    568568            array(
    569569                'comment_post_ID' => $post_id,
     
    602602
    603603        // Create a post dated last week.
    604         $post_id = $this->factory()->post->create( array( 'post_date' => $last_week ) );
     604        $post_id = self::factory()->post->create( array( 'post_date' => $last_week ) );
    605605
    606606        // Create a comment dated yesterday.
    607         $this->factory()->comment->create(
     607        self::factory()->comment->create(
    608608            array(
    609609                'comment_post_ID' => $post_id,
     
    613613
    614614        // Create a post dated today.
    615         $this->factory()->post->create( array( 'post_date' => $today ) );
     615        self::factory()->post->create( array( 'post_date' => $today ) );
    616616
    617617        // The Last-Modified header should have the date from today's post when it is the latest update.
Note: See TracChangeset for help on using the changeset viewer.