Make WordPress Core


Ignore:
Timestamp:
10/17/2015 06:02:16 PM (9 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/getCommentsPagesCount.php

    r35225 r35242  
    3939    function test_empty() {
    4040        //setup post and comments
    41         $post_id = self::$factory->post->create( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) );
     41        $post_id = self::factory()->post->create( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) );
    4242        $this->go_to( '/?p=' . $post_id );
    4343
     
    6161    function test_threaded_comments( ) {
    6262        //setup post and comments
    63         $post = self::$factory->post->create_and_get( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) );
    64         $comments = self::$factory->comment->create_post_comments( $post->ID, 15 );
    65         self::$factory->comment->create_post_comments( $post->ID, 6, array( 'comment_parent' => $comments[0] ) );
     63        $post = self::factory()->post->create_and_get( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) );
     64        $comments = self::factory()->comment->create_post_comments( $post->ID, 15 );
     65        self::factory()->comment->create_post_comments( $post->ID, 6, array( 'comment_parent' => $comments[0] ) );
    6666        $comments = get_comments( array( 'post_id' => $post->ID ) );
    6767
     
    7777
    7878        //setup post and comments
    79         $post = self::$factory->post->create_and_get( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) );
    80         $comments = self::$factory->comment->create_post_comments( $post->ID, 15 );
    81         self::$factory->comment->create_post_comments( $post->ID, 6, array('comment_parent' => $comments[0] ) );
     79        $post = self::factory()->post->create_and_get( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) );
     80        $comments = self::factory()->comment->create_post_comments( $post->ID, 15 );
     81        self::factory()->comment->create_post_comments( $post->ID, 6, array('comment_parent' => $comments[0] ) );
    8282        $comments = get_comments( array( 'post_id' => $post->ID ) );
    8383
     
    105105        update_option( 'posts_per_rss', 100 );
    106106
    107         $post = self::$factory->post->create_and_get( array( 'post_title' => 'comment-post', 'post_type' => 'post' ) );
    108         $comments = self::$factory->comment->create_post_comments( $post->ID, 25 );
     107        $post = self::factory()->post->create_and_get( array( 'post_title' => 'comment-post', 'post_type' => 'post' ) );
     108        $comments = self::factory()->comment->create_post_comments( $post->ID, 25 );
    109109
    110110        $wp_query = new WP_Query( array( 'p' => $post->ID, 'comments_per_page' => 10, 'feed' =>'comments-' ) );
Note: See TracChangeset for help on using the changeset viewer.