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

    r35225 r35242  
    66
    77    function test_get_comments_number() {
    8         $post_id = self::$factory->post->create();
     8        $post_id = self::factory()->post->create();
    99
    1010        $this->assertEquals( 0, get_comments_number( 0 ) );
     
    1212        $this->assertEquals( 0, get_comments_number( get_post( $post_id ) ) );
    1313
    14         self::$factory->comment->create_post_comments( $post_id, 12 );
     14        self::factory()->comment->create_post_comments( $post_id, 12 );
    1515
    1616        $this->assertEquals( 12, get_comments_number( $post_id ) );
     
    1919
    2020    function test_get_comments_number_without_arg() {
    21         $post_id = self::$factory->post->create();
     21        $post_id = self::factory()->post->create();
    2222        $permalink = get_permalink( $post_id );
    2323        $this->go_to( $permalink );
     
    2525        $this->assertEquals( 0, get_comments_number() );
    2626
    27         self::$factory->comment->create_post_comments( $post_id, 12 );
     27        self::factory()->comment->create_post_comments( $post_id, 12 );
    2828        $this->go_to( $permalink );
    2929
Note: See TracChangeset for help on using the changeset viewer.