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

    r53866 r54088  
    310310        );
    311311
    312         $post = $this->factory()->post->create_and_get( $args );
     312        $post = self::factory()->post->create_and_get( $args );
    313313        setup_postdata( $post );
    314314
     
    336336        );
    337337
    338         $post = $this->factory()->post->create_and_get( $args );
     338        $post = self::factory()->post->create_and_get( $args );
    339339        setup_postdata( $post );
    340340
     
    362362        );
    363363
    364         $post = $this->factory()->post->create_and_get( $args );
     364        $post = self::factory()->post->create_and_get( $args );
    365365        setup_postdata( $post );
    366366
     
    388388        );
    389389
    390         $post = $this->factory()->post->create_and_get( $args );
     390        $post = self::factory()->post->create_and_get( $args );
    391391        setup_postdata( $post );
    392392
     
    414414        );
    415415
    416         $post = $this->factory()->post->create_and_get( $args );
     416        $post = self::factory()->post->create_and_get( $args );
    417417        setup_postdata( $post );
    418418
     
    442442        );
    443443
    444         $this->factory()->post->create( $args );
     444        self::factory()->post->create( $args );
    445445
    446446        $expect = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do…';
     
    468468        );
    469469
    470         $post = $this->factory()->post->create( $args );
     470        $post = self::factory()->post->create( $args );
    471471
    472472        $expect = 'Lorem ipsum dolor sit amet, consectetur …';
     
    494494        );
    495495
    496         $this->factory()->post->create( $args );
     496        self::factory()->post->create( $args );
    497497
    498498        $expect = str_repeat( 'あ', 40 ) . '…';
     
    515515            'comment_content' => $this->long_text,
    516516        );
    517         $comment_id      = $this->factory()->comment->create( $args );
     517        $comment_id      = self::factory()->comment->create( $args );
    518518        $expect          = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut…';
    519519        $comment_excerpt = get_comment_excerpt( $comment_id );
     
    535535            'comment_content' => $this->long_text,
    536536        );
    537         $comment_id      = $this->factory()->comment->create( $args );
     537        $comment_id      = self::factory()->comment->create( $args );
    538538        $expect          = 'Lorem ipsum dolor sit amet, consectetur …';
    539539        $comment_excerpt = get_comment_excerpt( $comment_id );
     
    555555            'comment_content' => str_repeat( 'あ', 200 ),
    556556        );
    557         $comment_id      = $this->factory()->comment->create( $args );
     557        $comment_id      = self::factory()->comment->create( $args );
    558558        $expect          = str_repeat( 'あ', 40 ) . '…';
    559559        $comment_excerpt = get_comment_excerpt( $comment_id );
Note: See TracChangeset for help on using the changeset viewer.