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

    r35225 r35242  
    8888        $this->assertEquals( $url, $url2 );
    8989
    90         $post_id = self::$factory->post->create( array( 'post_author' => 1 ) );
     90        $post_id = self::factory()->post->create( array( 'post_author' => 1 ) );
    9191        $post = get_post( $post_id );
    9292        $url2 = get_avatar_url( $post );
    9393        $this->assertEquals( $url, $url2 );
    9494
    95         $comment_id = self::$factory->comment->create( array( 'comment_post_ID' => $post_id, 'user_id' => 1 ) );
     95        $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => $post_id, 'user_id' => 1 ) );
    9696        $comment = get_comment( $comment_id );
    9797        $url2 = get_avatar_url( $comment );
     
    139139        $url = get_avatar_url( 1 );
    140140
    141         $post_id = self::$factory->post->create( array( 'post_author' => 1 ) );
    142         $comment_id = self::$factory->comment->create( array( 'comment_post_ID' => $post_id, 'user_id' => 1, 'comment_type' => 'pingback' ) );
     141        $post_id = self::factory()->post->create( array( 'post_author' => 1 ) );
     142        $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => $post_id, 'user_id' => 1, 'comment_type' => 'pingback' ) );
    143143        $comment = get_comment( $comment_id );
    144144
Note: See TracChangeset for help on using the changeset viewer.