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

    r35225 r35242  
    1010        parent::setUp();
    1111        // we need an admin user to bypass comment flood protection
    12         $this->author_id = self::$factory->user->create( array( 'role' => 'administrator' ) );
     12        $this->author_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
    1313        $this->old_current_user = get_current_user_id();
    1414        wp_set_current_user( $this->author_id );
     
    3535     */
    3636    function test_wp_new_comment() {
    37         $post_id = self::$factory->post->create();
     37        $post_id = self::factory()->post->create();
    3838
    3939        // not testing comment_author_email or comment_author_url
     
    7575     */
    7676    function test_edit_comment() {
    77         $post_id = self::$factory->post->create();
    78         $comment_id = self::$factory->comment->create(array(
     77        $post_id = self::factory()->post->create();
     78        $comment_id = self::factory()->comment->create(array(
    7979            'comment_post_ID' => $post_id
    8080        ));
     
    118118     */
    119119    function test_wp_insert_comment() {
    120         $post_id = self::$factory->post->create();
     120        $post_id = self::factory()->post->create();
    121121
    122122        $comment_id = wp_insert_comment(array(
     
    146146     */
    147147    function test_wp_update_comment() {
    148         $post_id = self::$factory->post->create();
    149         $comment_id = self::$factory->comment->create(array(
     148        $post_id = self::factory()->post->create();
     149        $comment_id = self::factory()->comment->create(array(
    150150            'comment_post_ID' => $post_id
    151151        ));
Note: See TracChangeset for help on using the changeset viewer.