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

    r35225 r35242  
    1111        global $wpdb;
    1212
    13         $p = self::$factory->post->create( array( 'post_status' => 'publish' ) );
    14         $comment_ids = self::$factory->comment->create_post_comments( $p, 3 );
     13        $p = self::factory()->post->create( array( 'post_status' => 'publish' ) );
     14        $comment_ids = self::factory()->comment->create_post_comments( $p, 3 );
    1515
    1616        foreach ( $comment_ids as $cid ) {
     
    3939        global $wpdb;
    4040
    41         $p = self::$factory->post->create( array( 'post_status' => 'publish' ) );
    42         $comment_ids = self::$factory->comment->create_post_comments( $p, 3 );
     41        $p = self::factory()->post->create( array( 'post_status' => 'publish' ) );
     42        $comment_ids = self::factory()->comment->create_post_comments( $p, 3 );
    4343
    4444        foreach ( $comment_ids as $cid ) {
     
    6868        global $wpdb;
    6969
    70         $p = self::$factory->post->create( array( 'post_status' => 'publish' ) );
    71         $comment_ids = self::$factory->comment->create_post_comments( $p, 3 );
     70        $p = self::factory()->post->create( array( 'post_status' => 'publish' ) );
     71        $comment_ids = self::factory()->comment->create_post_comments( $p, 3 );
    7272
    7373        foreach ( $comment_ids as $cid ) {
     
    9494        global $wpdb;
    9595
    96         $p = self::$factory->post->create( array( 'post_status' => 'publish' ) );
    97         $comment_ids = self::$factory->comment->create_post_comments( $p, 3 );
     96        $p = self::factory()->post->create( array( 'post_status' => 'publish' ) );
     97        $comment_ids = self::factory()->comment->create_post_comments( $p, 3 );
    9898
    9999        foreach ( $comment_ids as $cid ) {
     
    129129        global $wpdb;
    130130
    131         $posts = self::$factory->post->create_many( 2, array( 'post_status' => 'publish' ) );
     131        $posts = self::factory()->post->create_many( 2, array( 'post_status' => 'publish' ) );
    132132
    133133        $now = time();
    134134        $comments = array();
    135135        for ( $i = 0; $i < 5; $i++ ) {
    136             $comments[] = self::$factory->comment->create( array(
     136            $comments[] = self::factory()->comment->create( array(
    137137                'comment_post_ID' => $posts[0],
    138138                'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( 60 * $i ) ),
     
    173173        global $wpdb;
    174174
    175         $posts = self::$factory->post->create_many( 2, array( 'post_status' => 'publish' ) );
     175        $posts = self::factory()->post->create_many( 2, array( 'post_status' => 'publish' ) );
    176176
    177177        $now = time();
    178178        $comments = array();
    179179        for ( $i = 0; $i < 5; $i++ ) {
    180             $comments[] = self::$factory->comment->create( array(
     180            $comments[] = self::factory()->comment->create( array(
    181181                'comment_post_ID' => $posts[0],
    182182                'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( 60 * $i ) ),
Note: See TracChangeset for help on using the changeset viewer.