WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/17/2015 06:02:16 PM (6 years ago)
Author:
wonderboymusic
Message:

Unit Tests: after [35225], make factory a method/getter on WP_UnitTestCase and add magic methods for BC for every plugin that is extending WP_UnitTestCase and accessing the $factory instance prop.

Props nerrad, wonderboymusic.
See #30017, #33968.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/comment/wpCountComments.php

    r35225 r35242  
    1616
    1717    public function test_wp_count_comments_approved() {
    18         self::$factory->comment->create( array(
     18        self::factory()->comment->create( array(
    1919            'comment_approved' => 1
    2020        ) );
     
    3232
    3333    public function test_wp_count_comments_awaiting() {
    34         self::$factory->comment->create( array(
     34        self::factory()->comment->create( array(
    3535            'comment_approved' => 0
    3636        ) );
     
    4848
    4949    public function test_wp_count_comments_spam() {
    50         self::$factory->comment->create( array(
     50        self::factory()->comment->create( array(
    5151            'comment_approved' => 'spam'
    5252        ) );
     
    6464
    6565    public function test_wp_count_comments_trash() {
    66         self::$factory->comment->create( array(
     66        self::factory()->comment->create( array(
    6767            'comment_approved' => 'trash'
    6868        ) );
     
    8080
    8181    public function test_wp_count_comments_post_trashed() {
    82         self::$factory->comment->create( array(
     82        self::factory()->comment->create( array(
    8383            'comment_approved' => 'post-trashed'
    8484        ) );
     
    9696
    9797    public function test_wp_count_comments_cache() {
    98         $post_id = self::$factory->post->create( array(
     98        $post_id = self::factory()->post->create( array(
    9999            'post_status' => 'publish'
    100100        ) );
    101         $comment_id = self::$factory->comment->create( array(
     101        $comment_id = self::factory()->comment->create( array(
    102102            'comment_approved' => '1',
    103103            'comment_post_ID' => $post_id
Note: See TracChangeset for help on using the changeset viewer.