Make WordPress Core


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

    r35225 r35242  
    1818
    1919        // Setup users
    20         $admin = self::$factory->user->create( array(
     20        $admin = self::factory()->user->create( array(
    2121            'role' => 'administrator',
    2222        ) );
    23         $editor = self::$factory->user->create( array(
     23        $editor = self::factory()->user->create( array(
    2424            'role' => 'editor',
    2525        ) );
    26         $author = self::$factory->user->create( array(
     26        $author = self::factory()->user->create( array(
    2727            'role' => 'author',
    2828        ) );
    29         $contributor = self::$factory->user->create( array(
     29        $contributor = self::factory()->user->create( array(
    3030            'role' => 'contributor',
    3131        ) );
    32         $subscriber = self::$factory->user->create( array(
     32        $subscriber = self::factory()->user->create( array(
    3333            'role' => 'subscriber',
    3434        ) );
    35         $none = self::$factory->user->create( array(
     35        $none = self::factory()->user->create( array(
    3636            'role' => '',
    3737        ) );
    38         $nobody = self::$factory->user->create( array(
     38        $nobody = self::factory()->user->create( array(
    3939            'role' => '',
    4040        ) );
     
    6868
    6969        // Setup users
    70         $admin = self::$factory->user->create( array(
     70        $admin = self::factory()->user->create( array(
    7171            'role' => 'administrator',
    7272        ) );
    73         $editor = self::$factory->user->create( array(
     73        $editor = self::factory()->user->create( array(
    7474            'role' => 'editor',
    7575        ) );
    76         $author = self::$factory->user->create( array(
     76        $author = self::factory()->user->create( array(
    7777            'role' => 'author',
    7878        ) );
    79         $contributor = self::$factory->user->create( array(
     79        $contributor = self::factory()->user->create( array(
    8080            'role' => 'contributor',
    8181        ) );
    82         $subscriber = self::$factory->user->create( array(
     82        $subscriber = self::factory()->user->create( array(
    8383            'role' => 'subscriber',
    8484        ) );
    85         $none = self::$factory->user->create( array(
     85        $none = self::factory()->user->create( array(
    8686            'role' => '',
    8787        ) );
    88         $nobody = self::$factory->user->create( array(
     88        $nobody = self::factory()->user->create( array(
    8989            'role' => '',
    9090        ) );
    9191
    9292        // Setup blogs
    93         $blog_1 = (int) self::$factory->blog->create( array(
     93        $blog_1 = (int) self::factory()->blog->create( array(
    9494            'user_id' => $editor,
    9595        ) );
    96         $blog_2 = (int) self::$factory->blog->create( array(
     96        $blog_2 = (int) self::factory()->blog->create( array(
    9797            'user_id' => $author,
    9898        ) );
Note: See TracChangeset for help on using the changeset viewer.