WordPress.org

Make WordPress Core


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

    r35225 r35242  
    1313        parent::setUp();
    1414
    15         $this->post_id = self::$factory->post->create();
     15        $this->post_id = self::factory()->post->create();
    1616    }
    1717
    1818    public function test_query() {
    19         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    20         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    21         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    22         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    23         $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
     19        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     20        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     21        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     22        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     23        $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    2424
    2525        $q = new WP_Comment_Query();
     
    3232
    3333    public function test_query_post_id_0() {
    34         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     34        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    3535
    3636        $q = new WP_Comment_Query();
     
    4747     */
    4848    public function test_query_type_empty_string() {
    49         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    50         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    51         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    52         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    53         $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
     49        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     50        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     51        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     52        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     53        $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    5454
    5555        $q = new WP_Comment_Query();
     
    6666     */
    6767    public function test_query_type_comment() {
    68         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    69         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    70         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    71         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    72         $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
     68        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     69        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     70        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     71        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     72        $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    7373
    7474        $q = new WP_Comment_Query();
     
    8282
    8383    public function test_query_type_pingback() {
    84         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    85         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    86         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    87         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     84        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     85        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     86        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     87        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    8888
    8989        $q = new WP_Comment_Query();
     
    9898
    9999    public function test_query_type_trackback() {
    100         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    101         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    102         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    103         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     100        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     101        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     102        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     103        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    104104
    105105        $q = new WP_Comment_Query();
     
    117117     */
    118118    public function test_query_type_pings() {
    119         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    120         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    121         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    122         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    123         $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
     119        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     120        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     121        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     122        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     123        $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    124124
    125125        $q = new WP_Comment_Query();
     
    137137     */
    138138    public function test_type_array_comments_and_custom() {
    139         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    140         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    141         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    142         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    143         $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    144         $c6 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     139        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     140        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     141        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     142        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     143        $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
     144        $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    145145
    146146        $q = new WP_Comment_Query();
     
    157157     */
    158158    public function test_type_not__in_array_custom() {
    159         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    160         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    161         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    162         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    163         $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    164         $c6 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     159        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     160        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     161        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     162        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     163        $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
     164        $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    165165
    166166        $q = new WP_Comment_Query();
     
    177177     */
    178178    public function test_type__in_array_and_not_type_array_custom() {
    179         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    180         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    181         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    182         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    183         $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    184         $c6 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     179        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     180        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     181        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     182        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     183        $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
     184        $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    185185
    186186        $q = new WP_Comment_Query();
     
    198198     */
    199199    public function test_type_array_and_type__not_in_array_custom() {
    200         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    201         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    202         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    203         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    204         $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    205         $c6 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     200        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     201        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     202        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     203        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     204        $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
     205        $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    206206
    207207        $q = new WP_Comment_Query();
     
    219219     */
    220220    public function test_type__not_in_custom() {
    221         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    222         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    223         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    224         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    225         $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    226         $c6 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     221        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     222        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     223        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     224        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     225        $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
     226        $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    227227
    228228        $q = new WP_Comment_Query();
     
    239239     */
    240240    public function test_type_array_comments_and_pings() {
    241         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    242         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    243         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    244         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    245         $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
     241        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     242        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     243        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     244        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     245        $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    246246
    247247        $q = new WP_Comment_Query();
     
    258258     */
    259259    public function test_type_array_comment_pings() {
    260         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    261         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    262         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     260        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     261        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     262        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    263263
    264264        $q = new WP_Comment_Query();
     
    275275     */
    276276    public function test_type_array_pingback() {
    277         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    278         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    279         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     277        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     278        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     279        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    280280
    281281        $q = new WP_Comment_Query();
     
    292292     */
    293293    public function test_type_array_custom_pingpack() {
    294         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    295         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    296         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     294        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     295        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     296        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    297297
    298298        $q = new WP_Comment_Query();
     
    309309     */
    310310    public function test_type_array_pings() {
    311         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    312         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    313         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     311        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     312        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     313        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    314314
    315315        $q = new WP_Comment_Query();
     
    326326     */
    327327    public function test_type_status_approved_array_comment_pings() {
    328         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    329         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    330         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    331         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0', 'comment_type' => 'pingback' ) );
     328        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     329        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     330        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     331        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0', 'comment_type' => 'pingback' ) );
    332332
    333333        $q = new WP_Comment_Query();
     
    345345     */
    346346    public function test_type_array_trackback() {
    347         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    348         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    349         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     347        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     348        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     349        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    350350
    351351        $q = new WP_Comment_Query();
     
    362362     */
    363363    public function test_type_array_custom_trackback() {
    364         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    365         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    366         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     364        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     365        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     366        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    367367
    368368        $q = new WP_Comment_Query();
     
    379379     */
    380380    public function test_type_array_pings_approved() {
    381         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    382         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    383         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    384         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0', 'comment_type' => 'trackback' ) );
     381        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     382        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     383        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     384        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0', 'comment_type' => 'trackback' ) );
    385385
    386386        $q = new WP_Comment_Query();
     
    398398     */
    399399    public function test_status_empty_string() {
    400         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    401         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
    402         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'spam' ) );
     400        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     401        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
     402        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'spam' ) );
    403403
    404404        $q = new WP_Comment_Query();
     
    415415     */
    416416    public function test_status_hold() {
    417         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    418         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
     417        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     418        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
    419419
    420420        $q = new WP_Comment_Query();
     
    431431     */
    432432    public function test_status_approve() {
    433         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    434         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
     433        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     434        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
    435435
    436436        $q = new WP_Comment_Query();
     
    444444
    445445    public function test_status_custom() {
    446         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    447         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
    448         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo1' ) );
     446        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     447        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
     448        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo1' ) );
    449449
    450450        $q = new WP_Comment_Query();
     
    458458
    459459    public function test_status_all() {
    460         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    461         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
    462         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
     460        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     461        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
     462        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
    463463
    464464        $q = new WP_Comment_Query();
     
    472472
    473473    public function test_status_default_to_all() {
    474         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    475         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
    476         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
     474        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     475        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
     476        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
    477477
    478478        $q = new WP_Comment_Query();
     
    488488     */
    489489    public function test_status_comma_any() {
    490         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    491         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
    492         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
     490        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     491        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
     492        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
    493493
    494494        $q = new WP_Comment_Query();
     
    505505     */
    506506    public function test_status_comma_separated() {
    507         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    508         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
    509         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
     507        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     508        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
     509        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
    510510
    511511        $q = new WP_Comment_Query();
     
    522522     */
    523523    public function test_status_array() {
    524         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    525         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
    526         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
     524        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     525        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
     526        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
    527527
    528528        $q = new WP_Comment_Query();
     
    538538        $limit = 5;
    539539
    540         $post_id = self::$factory->post->create();
    541         self::$factory->comment->create_post_comments( $post_id, $limit );
     540        $post_id = self::factory()->post->create();
     541        self::factory()->comment->create_post_comments( $post_id, $limit );
    542542        $comments = get_comments( array( 'post_id' => $post_id ) );
    543543        $this->assertEquals( $limit, count( $comments ) );
     
    546546        }
    547547
    548         $post_id2 = self::$factory->post->create();
    549         self::$factory->comment->create_post_comments( $post_id2, $limit );
     548        $post_id2 = self::factory()->post->create();
     549        self::factory()->comment->create_post_comments( $post_id2, $limit );
    550550        $comments = get_comments( array( 'post_id' => $post_id2 ) );
    551551        $this->assertEquals( $limit, count( $comments ) );
     
    554554        }
    555555
    556         $post_id3 = self::$factory->post->create();
    557         self::$factory->comment->create_post_comments( $post_id3, $limit, array( 'comment_approved' => '0' ) );
     556        $post_id3 = self::factory()->post->create();
     557        self::factory()->comment->create_post_comments( $post_id3, $limit, array( 'comment_approved' => '0' ) );
    558558        $comments = get_comments( array( 'post_id' => $post_id3 ) );
    559559        $this->assertEquals( $limit, count( $comments ) );
     
    571571        $this->assertEquals( 0, count( $comments ) );
    572572
    573         self::$factory->comment->create_post_comments( $post_id3, $limit, array( 'comment_approved' => '1' ) );
     573        self::factory()->comment->create_post_comments( $post_id3, $limit, array( 'comment_approved' => '1' ) );
    574574        $comments = get_comments( array( 'post_id' => $post_id3 ) );
    575575        $this->assertEquals( $limit * 2, count( $comments ) );
     
    583583     */
    584584    function test_orderby_meta() {
    585         $comment_id = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
    586         $comment_id2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
    587         $comment_id3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
     585        $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id ) );
     586        $comment_id2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id ) );
     587        $comment_id3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id ) );
    588588
    589589        add_comment_meta( $comment_id, 'key', 'value1', true );
     
    633633     */
    634634    public function test_orderby_clause_key() {
    635         $comments = self::$factory->comment->create_many( 3 );
     635        $comments = self::factory()->comment->create_many( 3 );
    636636        add_comment_meta( $comments[0], 'foo', 'aaa' );
    637637        add_comment_meta( $comments[1], 'foo', 'zzz' );
     
    658658     */
    659659    public function test_orderby_clause_key_as_secondary_sort() {
    660         $c1 = self::$factory->comment->create( array(
     660        $c1 = self::factory()->comment->create( array(
    661661            'comment_date' => '2015-01-28 03:00:00',
    662662        ) );
    663         $c2 = self::$factory->comment->create( array(
     663        $c2 = self::factory()->comment->create( array(
    664664            'comment_date' => '2015-01-28 05:00:00',
    665665        ) );
    666         $c3 = self::$factory->comment->create( array(
     666        $c3 = self::factory()->comment->create( array(
    667667            'comment_date' => '2015-01-28 03:00:00',
    668668        ) );
     
    694694     */
    695695    public function test_orderby_more_than_one_clause_key() {
    696         $comments = self::$factory->comment->create_many( 3 );
     696        $comments = self::factory()->comment->create_many( 3 );
    697697
    698698        add_comment_meta( $comments[0], 'foo', 'jjj' );
     
    729729     */
    730730    public function test_meta_query_should_work_with_comment__in() {
    731         $comments = self::$factory->comment->create_many( 3 );
     731        $comments = self::factory()->comment->create_many( 3 );
    732732
    733733        add_comment_meta( $comments[0], 'foo', 'jjj' );
     
    753753     */
    754754    public function test_meta_query_should_work_with_comment__not_in() {
    755         $comments = self::$factory->comment->create_many( 3 );
     755        $comments = self::factory()->comment->create_many( 3 );
    756756
    757757        add_comment_meta( $comments[0], 'foo', 'jjj' );
     
    777777     */
    778778    function test_get_comments_by_user() {
    779         $users = self::$factory->user->create_many( 2 );
    780         self::$factory->comment->create( array( 'user_id' => $users[0], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    781         self::$factory->comment->create( array( 'user_id' => $users[0], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    782         self::$factory->comment->create( array( 'user_id' => $users[1], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     779        $users = self::factory()->user->create_many( 2 );
     780        self::factory()->comment->create( array( 'user_id' => $users[0], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     781        self::factory()->comment->create( array( 'user_id' => $users[0], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     782        self::factory()->comment->create( array( 'user_id' => $users[1], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    783783
    784784        $comments = get_comments( array(
     
    809809     */
    810810    function test_fields_ids_query() {
    811         $comment_1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    812         $comment_2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    813         $comment_3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     811        $comment_1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     812        $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     813        $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    814814
    815815        // Ensure we are dealing with integers, and not objects.
     
    827827     */
    828828    function test_fields_comment__in() {
    829         $comment_1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    830         $comment_2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    831         $comment_3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     829        $comment_1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     830        $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     831        $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    832832
    833833        $comment_ids = get_comments( array(
     
    843843     */
    844844    function test_fields_comment__not_in() {
    845         $comment_1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    846         $comment_2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    847         $comment_3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     845        $comment_1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     846        $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     847        $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    848848
    849849        $comment_ids = get_comments( array(
     
    859859     */
    860860    function test_fields_post__in() {
    861         $p1 = self::$factory->post->create();
    862         $p2 = self::$factory->post->create();
    863         $p3 = self::$factory->post->create();
    864 
    865         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 7, 'comment_approved' => '1' ) );
    866         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) );
    867         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $p3, 'user_id' => 1, 'comment_approved' => '1' ) );
     861        $p1 = self::factory()->post->create();
     862        $p2 = self::factory()->post->create();
     863        $p3 = self::factory()->post->create();
     864
     865        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 7, 'comment_approved' => '1' ) );
     866        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) );
     867        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p3, 'user_id' => 1, 'comment_approved' => '1' ) );
    868868
    869869        $comment_ids = get_comments( array(
     
    879879     */
    880880    function test_fields_post__not_in() {
    881         $p1 = self::$factory->post->create();
    882         $p2 = self::$factory->post->create();
    883         $p3 = self::$factory->post->create();
    884 
    885         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 7, 'comment_approved' => '1' ) );
    886         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) );
    887         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $p3, 'user_id' => 1, 'comment_approved' => '1' ) );
     881        $p1 = self::factory()->post->create();
     882        $p2 = self::factory()->post->create();
     883        $p3 = self::factory()->post->create();
     884
     885        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 7, 'comment_approved' => '1' ) );
     886        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) );
     887        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p3, 'user_id' => 1, 'comment_approved' => '1' ) );
    888888
    889889        $comment_ids = get_comments( array(
     
    902902        $author_id2 = 106;
    903903
    904         $p1 = self::$factory->post->create( array( 'post_author' => $author_id1 ) );
    905         $p2 = self::$factory->post->create( array( 'post_author' => $author_id1 ) );
    906         $p3 = self::$factory->post->create( array( 'post_author' => $author_id2 ) );
    907 
    908         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) );
    909         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) );
    910         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $p3, 'user_id' => 1, 'comment_approved' => '1' ) );
     904        $p1 = self::factory()->post->create( array( 'post_author' => $author_id1    ) );
     905        $p2 = self::factory()->post->create( array( 'post_author' => $author_id1    ) );
     906        $p3 = self::factory()->post->create( array( 'post_author' => $author_id2    ) );
     907
     908        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) );
     909        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) );
     910        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p3, 'user_id' => 1, 'comment_approved' => '1' ) );
    911911
    912912        $comment_ids = get_comments( array(
     
    925925        $author_id2 = 112;
    926926
    927         $p1 = self::$factory->post->create( array( 'post_author' => $author_id1 ) );
    928         $p2 = self::$factory->post->create( array( 'post_author' => $author_id1 ) );
    929         $p3 = self::$factory->post->create( array( 'post_author' => $author_id2 ) );
    930 
    931         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) );
    932         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) );
    933         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $p3, 'user_id' => 1, 'comment_approved' => '1' ) );
     927        $p1 = self::factory()->post->create( array( 'post_author' => $author_id1    ) );
     928        $p2 = self::factory()->post->create( array( 'post_author' => $author_id1    ) );
     929        $p3 = self::factory()->post->create( array( 'post_author' => $author_id2    ) );
     930
     931        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) );
     932        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) );
     933        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p3, 'user_id' => 1, 'comment_approved' => '1' ) );
    934934
    935935        $comment_ids = get_comments( array(
     
    945945         */
    946946    function test_fields_author__in() {
    947         $p1 = self::$factory->post->create();
    948         $p2 = self::$factory->post->create();
    949         $p3 = self::$factory->post->create();
    950         $p4 = self::$factory->post->create();
    951 
    952         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) );
    953         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 2, 'comment_approved' => '1' ) );
    954         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 3, 'comment_approved' => '1' ) );
    955         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $p4, 'user_id' => 4, 'comment_approved' => '1' ) );
     947        $p1 = self::factory()->post->create();
     948        $p2 = self::factory()->post->create();
     949        $p3 = self::factory()->post->create();
     950        $p4 = self::factory()->post->create();
     951
     952        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) );
     953        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 2, 'comment_approved' => '1' ) );
     954        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 3, 'comment_approved' => '1' ) );
     955        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $p4, 'user_id' => 4, 'comment_approved' => '1' ) );
    956956
    957957        $comment_ids = get_comments( array(
     
    967967         */
    968968    function test_fields_author__not_in() {
    969         $p1 = self::$factory->post->create();
    970         $p2 = self::$factory->post->create();
    971         $p3 = self::$factory->post->create();
    972         $p4 = self::$factory->post->create();
    973 
    974         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) );
    975         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 2, 'comment_approved' => '1' ) );
    976         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 3, 'comment_approved' => '1' ) );
    977         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $p4, 'user_id' => 4, 'comment_approved' => '1' ) );
     969        $p1 = self::factory()->post->create();
     970        $p2 = self::factory()->post->create();
     971        $p3 = self::factory()->post->create();
     972        $p4 = self::factory()->post->create();
     973
     974        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) );
     975        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 2, 'comment_approved' => '1' ) );
     976        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 3, 'comment_approved' => '1' ) );
     977        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $p4, 'user_id' => 4, 'comment_approved' => '1' ) );
    978978
    979979        $comment_ids = get_comments( array(
     
    989989     */
    990990    public function test_get_comments_with_status_all() {
    991         $comment_1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    992         $comment_2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    993         $comment_3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
     991        $comment_1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     992        $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     993        $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
    994994        $comments_approved_1 = get_comments( array( 'status' => 'all' ) );
    995995
     
    10021002     */
    10031003    public function test_get_comments_with_include_unapproved_user_id() {
    1004         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    1005         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    1006         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
    1007         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );
     1004        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     1005        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     1006        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
     1007        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );
    10081008
    10091009        $found = get_comments( array(
     
    10201020     */
    10211021    public function test_get_comments_with_include_unapproved_user_id_array() {
    1022         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    1023         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    1024         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
    1025         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );
    1026         $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 8, 'comment_approved' => '0' ) );
     1022        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     1023        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     1024        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
     1025        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );
     1026        $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 8, 'comment_approved' => '0' ) );
    10271027
    10281028        $found = get_comments( array(
     
    10391039     */
    10401040    public function test_get_comments_with_include_unapproved_user_id_comma_separated() {
    1041         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    1042         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    1043         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
    1044         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );
    1045         $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 8, 'comment_approved' => '0' ) );
     1041        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     1042        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     1043        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
     1044        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );
     1045        $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 8, 'comment_approved' => '0' ) );
    10461046
    10471047        $found = get_comments( array(
     
    10581058     */
    10591059    public function test_get_comments_with_include_unapproved_author_email() {
    1060         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    1061         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
    1062         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
    1063         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
     1060        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     1061        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
     1062        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
     1063        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
    10641064
    10651065        $found = get_comments( array(
     
    10761076     */
    10771077    public function test_get_comments_with_include_unapproved_mixed_array() {
    1078         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    1079         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
    1080         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
    1081         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
    1082         $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
     1078        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     1079        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
     1080        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
     1081        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
     1082        $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
    10831083
    10841084        $found = get_comments( array(
     
    10951095     */
    10961096    public function test_get_comments_with_include_unapproved_mixed_comma_separated() {
    1097         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    1098         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
    1099         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
    1100         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
    1101         $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
     1097        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     1098        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
     1099        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
     1100        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
     1101        $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
    11021102
    11031103        $found = get_comments( array(
     
    11111111
    11121112    public function test_search() {
    1113         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
    1114         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'foo@example.com' ) );
    1115         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://foo.bar' ) );
    1116         $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com', 'comment_author_IP' => 'foo.bar' ) );
    1117         $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com', 'comment_content' => 'Nice foo comment' ) );
    1118         $c6 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com' ) );
     1113        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
     1114        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'foo@example.com' ) );
     1115        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://foo.bar' ) );
     1116        $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com', 'comment_author_IP' => 'foo.bar' ) );
     1117        $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com', 'comment_content' => 'Nice foo comment' ) );
     1118        $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com' ) );
    11191119
    11201120        $q = new WP_Comment_Query();
     
    13641364    public function test_orderby_date_modified_gmt_should_order_by_comment_ID_in_case_of_tie_ASC() {
    13651365        $now = current_time( 'mysql', 1 );
    1366         $comments = self::$factory->comment->create_many( 5, array(
     1366        $comments = self::factory()->comment->create_many( 5, array(
    13671367            'comment_post_ID' => $this->post_id,
    13681368            'comment_date_gmt' => $now,
     
    13841384    public function test_orderby_date_modified_gmt_should_order_by_comment_ID_in_case_of_tie_DESC() {
    13851385        $now = current_time( 'mysql', 1 );
    1386         $comments = self::$factory->comment->create_many( 5, array(
     1386        $comments = self::factory()->comment->create_many( 5, array(
    13871387            'comment_post_ID' => $this->post_id,
    13881388            'comment_date_gmt' => $now,
     
    14171417
    14181418    public function test_count() {
    1419         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
    1420         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
     1419        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
     1420        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
    14211421
    14221422        $q = new WP_Comment_Query();
     
    14321432     */
    14331433    public function test_count_with_meta_query() {
    1434         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
    1435         $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
    1436         $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
     1434        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
     1435        $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
     1436        $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
    14371437        add_comment_meta( $c1, 'foo', 'bar' );
    14381438        add_comment_meta( $c3, 'foo', 'bar' );
     
    14561456        register_post_type( 'post-type-2' );
    14571457
    1458         $p1 = self::$factory->post->create( array( 'post_type' => 'post-type-1' ) );
    1459         $p2 = self::$factory->post->create( array( 'post_type' => 'post-type-2' ) );
    1460 
    1461         $c1 = self::$factory->comment->create_post_comments( $p1, 1 );
    1462         $c2 = self::$factory->comment->create_post_comments( $p2, 1 );
     1458        $p1 = self::factory()->post->create( array( 'post_type' => 'post-type-1' ) );
     1459        $p2 = self::factory()->post->create( array( 'post_type' => 'post-type-2' ) );
     1460
     1461        $c1 = self::factory()->comment->create_post_comments( $p1, 1 );
     1462        $c2 = self::factory()->comment->create_post_comments( $p2, 1 );
    14631463
    14641464        $q = new WP_Comment_Query();
     
    14811481        register_post_type( 'post-type-2' );
    14821482
    1483         $p1 = self::$factory->post->create( array( 'post_type' => 'post-type-1' ) );
    1484         $p2 = self::$factory->post->create( array( 'post_type' => 'post-type-2' ) );
    1485 
    1486         $c1 = self::$factory->comment->create_post_comments( $p1, 1 );
    1487         $c2 = self::$factory->comment->create_post_comments( $p2, 1 );
     1483        $p1 = self::factory()->post->create( array( 'post_type' => 'post-type-1' ) );
     1484        $p2 = self::factory()->post->create( array( 'post_type' => 'post-type-2' ) );
     1485
     1486        $c1 = self::factory()->comment->create_post_comments( $p1, 1 );
     1487        $c2 = self::factory()->comment->create_post_comments( $p2, 1 );
    14881488
    14891489        $q = new WP_Comment_Query();
     
    15061506        register_post_type( 'post-type-2' );
    15071507
    1508         $p1 = self::$factory->post->create( array( 'post_type' => 'post-type-1' ) );
    1509         $p2 = self::$factory->post->create( array( 'post_type' => 'post-type-2' ) );
    1510         $p3 = self::$factory->post->create( array( 'post_type' => 'post-type-3' ) );
    1511 
    1512         $c1 = self::$factory->comment->create_post_comments( $p1, 1 );
    1513         $c2 = self::$factory->comment->create_post_comments( $p2, 1 );
    1514         $c3 = self::$factory->comment->create_post_comments( $p3, 1 );
     1508        $p1 = self::factory()->post->create( array( 'post_type' => 'post-type-1' ) );
     1509        $p2 = self::factory()->post->create( array( 'post_type' => 'post-type-2' ) );
     1510        $p3 = self::factory()->post->create( array( 'post_type' => 'post-type-3' ) );
     1511
     1512        $c1 = self::factory()->comment->create_post_comments( $p1, 1 );
     1513        $c2 = self::factory()->comment->create_post_comments( $p2, 1 );
     1514        $c3 = self::factory()->comment->create_post_comments( $p3, 1 );
    15151515
    15161516        $q = new WP_Comment_Query();
     
    15271527
    15281528    public function test_post_name_single_value() {
    1529         $p1 = self::$factory->post->create( array( 'post_name' => 'foo' ) );
    1530         $p2 = self::$factory->post->create( array( 'post_name' => 'bar' ) );
    1531 
    1532         $c1 = self::$factory->comment->create_post_comments( $p1, 1 );
    1533         $c2 = self::$factory->comment->create_post_comments( $p2, 1 );
     1529        $p1 = self::factory()->post->create( array( 'post_name' => 'foo' ) );
     1530        $p2 = self::factory()->post->create( array( 'post_name' => 'bar' ) );
     1531
     1532        $c1 = self::factory()->comment->create_post_comments( $p1, 1 );
     1533        $c2 = self::factory()->comment->create_post_comments( $p2, 1 );
    15341534
    15351535        $q = new WP_Comment_Query();
     
    15461546     */
    15471547    public function test_post_name_singleton_array() {
    1548         $p1 = self::$factory->post->create( array( 'post_name' => 'foo' ) );
    1549         $p2 = self::$factory->post->create( array( 'post_name' => 'bar' ) );
    1550 
    1551         $c1 = self::$factory->comment->create_post_comments( $p1, 1 );
    1552         $c2 = self::$factory->comment->create_post_comments( $p2, 1 );
     1548        $p1 = self::factory()->post->create( array( 'post_name' => 'foo' ) );
     1549        $p2 = self::factory()->post->create( array( 'post_name' => 'bar' ) );
     1550
     1551        $c1 = self::factory()->comment->create_post_comments( $p1, 1 );
     1552        $c2 = self::factory()->comment->create_post_comments( $p2, 1 );
    15531553
    15541554        $q = new WP_Comment_Query();
     
    15651565     */
    15661566    public function test_post_name_array() {
    1567         $p1 = self::$factory->post->create( array( 'post_name' => 'foo' ) );
    1568         $p2 = self::$factory->post->create( array( 'post_name' => 'bar' ) );
    1569         $p3 = self::$factory->post->create( array( 'post_name' => 'baz' ) );
    1570 
    1571         $c1 = self::$factory->comment->create_post_comments( $p1, 1 );
    1572         $c2 = self::$factory->comment->create_post_comments( $p2, 1 );
    1573         $c3 = self::$factory->comment->create_post_comments( $p3, 1 );
     1567        $p1 = self::factory()->post->create( array( 'post_name' => 'foo' ) );
     1568        $p2 = self::factory()->post->create( array( 'post_name' => 'bar' ) );
     1569        $p3 = self::factory()->post->create( array( 'post_name' => 'baz' ) );
     1570
     1571        $c1 = self::factory()->comment->create_post_comments( $p1, 1 );
     1572        $c2 = self::factory()->comment->create_post_comments( $p2, 1 );
     1573        $c3 = self::factory()->comment->create_post_comments( $p3, 1 );
    15741574
    15751575        $q = new WP_Comment_Query();
     
    15831583
    15841584    public function test_post_status_single_value() {
    1585         $p1 = self::$factory->post->create( array( 'post_status' => 'publish' ) );
    1586         $p2 = self::$factory->post->create( array( 'post_status' => 'draft' ) );
    1587 
    1588         $c1 = self::$factory->comment->create_post_comments( $p1, 1 );
    1589         $c2 = self::$factory->comment->create_post_comments( $p2, 1 );
     1585        $p1 = self::factory()->post->create( array( 'post_status' => 'publish' ) );
     1586        $p2 = self::factory()->post->create( array( 'post_status' => 'draft' ) );
     1587
     1588        $c1 = self::factory()->comment->create_post_comments( $p1, 1 );
     1589        $c2 = self::factory()->comment->create_post_comments( $p2, 1 );
    15901590
    15911591        $q = new WP_Comment_Query();
     
    16021602     */
    16031603    public function test_post_status_singleton_array() {
    1604         $p1 = self::$factory->post->create( array( 'post_status' => 'publish' ) );
    1605         $p2 = self::$factory->post->create( array( 'post_status' => 'draft' ) );
    1606 
    1607         $c1 = self::$factory->comment->create_post_comments( $p1, 1 );
    1608         $c2 = self::$factory->comment->create_post_comments( $p2, 1 );
     1604        $p1 = self::factory()->post->create( array( 'post_status' => 'publish' ) );
     1605        $p2 = self::factory()->post->create( array( 'post_status' => 'draft' ) );
     1606
     1607        $c1 = self::factory()->comment->create_post_comments( $p1, 1 );
     1608        $c2 = self::factory()->comment->create_post_comments( $p2, 1 );
    16091609
    16101610        $q = new WP_Comment_Query();
     
    16211621     */
    16221622    public function test_post_status_array() {
    1623         $p1 = self::$factory->post->create( array( 'post_status' => 'publish' ) );
    1624         $p2 = self::$factory->post->create( array( 'post_status' => 'draft' ) );
    1625         $p3 = self::$factory->post->create( array( 'post_status' => 'future' ) );
    1626 
    1627         $c1 = self::$factory->comment->create_post_comments( $p1, 1 );
    1628         $c2 = self::$factory->comment->create_post_comments( $p2, 1 );
    1629         $c3 = self::$factory->comment->create_post_comments( $p3, 1 );
     1623        $p1 = self::factory()->post->create( array( 'post_status' => 'publish' ) );
     1624        $p2 = self::factory()->post->create( array( 'post_status' => 'draft' ) );
     1625        $p3 = self::factory()->post->create( array( 'post_status' => 'future' ) );
     1626
     1627        $c1 = self::factory()->comment->create_post_comments( $p1, 1 );
     1628        $c2 = self::factory()->comment->create_post_comments( $p2, 1 );
     1629        $c3 = self::factory()->comment->create_post_comments( $p3, 1 );
    16301630
    16311631        $q = new WP_Comment_Query();
     
    16421642     */
    16431643    public function test_comment_query_object() {
    1644         $comment_id = self::$factory->comment->create();
     1644        $comment_id = self::factory()->comment->create();
    16451645
    16461646        $query1 = new WP_Comment_Query();
     
    16641664        global $wpdb;
    16651665
    1666         $p = self::$factory->post->create();
    1667         $c = self::$factory->comment->create( array( 'comment_post_ID' => $p ) );
     1666        $p = self::factory()->post->create();
     1667        $c = self::factory()->comment->create( array( 'comment_post_ID' => $p ) );
    16681668
    16691669        $q1 = new WP_Comment_Query();
     
    16891689     */
    16901690    public function test_it_should_be_possible_to_modify_meta_query_using_pre_get_comments_action() {
    1691         $comments = self::$factory->comment->create_many( 2, array(
     1691        $comments = self::factory()->comment->create_many( 2, array(
    16921692            'comment_post_ID' => $this->post_id,
    16931693        ) );
     
    17201720     */
    17211721    public function test_it_should_be_possible_to_modify_meta_params_using_pre_get_comments_action() {
    1722         $comments = self::$factory->comment->create_many( 2, array(
     1722        $comments = self::factory()->comment->create_many( 2, array(
    17231723            'comment_post_ID' => $this->post_id,
    17241724        ) );
     
    17471747     */
    17481748    public function test_parent__in() {
    1749         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    1750         $c2 = self::$factory->comment->create( array(
     1749        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     1750        $c2 = self::factory()->comment->create( array(
    17511751            'comment_post_ID' => $this->post_id,
    17521752            'comment_approved' => '1',
     
    17671767     */
    17681768    public function test_parent__in_commas() {
    1769         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    1770         $c2 = self::$factory->comment->create( array(
     1769        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     1770        $c2 = self::factory()->comment->create( array(
    17711771            'comment_post_ID' => $this->post_id,
    17721772            'comment_approved' => '1'
    17731773        ) );
    1774         $c3 = self::$factory->comment->create( array(
     1774        $c3 = self::factory()->comment->create( array(
    17751775            'comment_post_ID' => $this->post_id,
    17761776            'comment_approved' => '1',
    17771777            'comment_parent' => $c1,
    17781778        ) );
    1779         $c4 = self::$factory->comment->create( array(
     1779        $c4 = self::factory()->comment->create( array(
    17801780            'comment_post_ID' => $this->post_id,
    17811781            'comment_approved' => '1',
     
    17961796     */
    17971797    public function test_parent__not_in() {
    1798         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    1799 
    1800         self::$factory->comment->create( array(
     1798        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     1799
     1800        self::factory()->comment->create( array(
    18011801            'comment_post_ID' => $this->post_id,
    18021802            'comment_approved' => '1',
     
    18171817     */
    18181818    public function test_parent__not_in_commas() {
    1819         $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    1820         $c2 = self::$factory->comment->create( array(
     1819        $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     1820        $c2 = self::factory()->comment->create( array(
    18211821            'comment_post_ID' => $this->post_id,
    18221822            'comment_approved' => '1'
    18231823        ) );
    18241824
    1825         self::$factory->comment->create( array(
     1825        self::factory()->comment->create( array(
    18261826            'comment_post_ID' => $this->post_id,
    18271827            'comment_approved' => '1',
    18281828            'comment_parent' => $c1,
    18291829        ) );
    1830         self::$factory->comment->create( array(
     1830        self::factory()->comment->create( array(
    18311831            'comment_post_ID' => $this->post_id,
    18321832            'comment_approved' => '1',
     
    18471847     */
    18481848    public function test_orderby_comment__in() {
    1849         self::$factory->comment->create( array(
     1849        self::factory()->comment->create( array(
    18501850            'comment_post_ID' => $this->post_id,
    18511851            'comment_approved' => '1'
    18521852        ) );
    18531853
    1854         $c2 = self::$factory->comment->create( array(
     1854        $c2 = self::factory()->comment->create( array(
    18551855            'comment_post_ID' => $this->post_id,
    18561856            'comment_approved' => '1'
    18571857        ) );
    1858         $c3 = self::$factory->comment->create( array(
     1858        $c3 = self::factory()->comment->create( array(
    18591859            'comment_post_ID' => $this->post_id,
    18601860            'comment_approved' => '1'
    18611861        ) );
    18621862
    1863         self::$factory->comment->create( array(
     1863        self::factory()->comment->create( array(
    18641864            'comment_post_ID' => $this->post_id,
    18651865            'comment_approved' => '1'
     
    18811881     */
    18821882    public function test_no_found_rows_should_default_to_true() {
    1883         $comments = self::$factory->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) );
     1883        $comments = self::factory()->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) );
    18841884
    18851885        $q = new WP_Comment_Query( array(
     
    18961896     */
    18971897    public function test_should_respect_no_found_rows_true() {
    1898         $comments = self::$factory->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) );
     1898        $comments = self::factory()->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) );
    18991899
    19001900        $q = new WP_Comment_Query( array(
     
    19121912     */
    19131913    public function test_should_respect_no_found_rows_false() {
    1914         $comments = self::$factory->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) );
     1914        $comments = self::factory()->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) );
    19151915
    19161916        $q = new WP_Comment_Query( array(
     
    19281928     */
    19291929    public function test_hierarchical_should_skip_child_comments_in_offset() {
    1930         $top_level_0 = self::$factory->comment->create( array(
    1931             'comment_post_ID' => $this->post_id,
    1932             'comment_approved' => '1',
    1933         ) );
    1934 
    1935         $child_of_0 = self::$factory->comment->create( array(
     1930        $top_level_0 = self::factory()->comment->create( array(
     1931            'comment_post_ID' => $this->post_id,
     1932            'comment_approved' => '1',
     1933        ) );
     1934
     1935        $child_of_0 = self::factory()->comment->create( array(
    19361936            'comment_post_ID' => $this->post_id,
    19371937            'comment_approved' => '1',
     
    19391939        ) );
    19401940
    1941         $top_level_comments = self::$factory->comment->create_many( 3, array(
     1941        $top_level_comments = self::factory()->comment->create_many( 3, array(
    19421942            'comment_post_ID' => $this->post_id,
    19431943            'comment_approved' => '1',
     
    19611961     */
    19621962    public function test_hierarchical_should_not_include_child_comments_in_number() {
    1963         $top_level_0 = self::$factory->comment->create( array(
    1964             'comment_post_ID' => $this->post_id,
    1965             'comment_approved' => '1',
    1966         ) );
    1967 
    1968         $child_of_0 = self::$factory->comment->create( array(
     1963        $top_level_0 = self::factory()->comment->create( array(
     1964            'comment_post_ID' => $this->post_id,
     1965            'comment_approved' => '1',
     1966        ) );
     1967
     1968        $child_of_0 = self::factory()->comment->create( array(
    19691969            'comment_post_ID' => $this->post_id,
    19701970            'comment_approved' => '1',
     
    19721972        ) );
    19731973
    1974         $top_level_comments = self::$factory->comment->create_many( 3, array(
     1974        $top_level_comments = self::factory()->comment->create_many( 3, array(
    19751975            'comment_post_ID' => $this->post_id,
    19761976            'comment_approved' => '1',
     
    19921992     */
    19931993    public function test_hierarchical_threaded() {
    1994         $c1 = self::$factory->comment->create( array(
    1995             'comment_post_ID' => $this->post_id,
    1996             'comment_approved' => '1',
    1997         ) );
    1998 
    1999         $c2 = self::$factory->comment->create( array(
     1994        $c1 = self::factory()->comment->create( array(
     1995            'comment_post_ID' => $this->post_id,
     1996            'comment_approved' => '1',
     1997        ) );
     1998
     1999        $c2 = self::factory()->comment->create( array(
    20002000            'comment_post_ID' => $this->post_id,
    20012001            'comment_approved' => '1',
     
    20032003        ) );
    20042004
    2005         $c3 = self::$factory->comment->create( array(
     2005        $c3 = self::factory()->comment->create( array(
    20062006            'comment_post_ID' => $this->post_id,
    20072007            'comment_approved' => '1',
     
    20092009        ) );
    20102010
    2011         $c4 = self::$factory->comment->create( array(
     2011        $c4 = self::factory()->comment->create( array(
    20122012            'comment_post_ID' => $this->post_id,
    20132013            'comment_approved' => '1',
     
    20152015        ) );
    20162016
    2017         $c5 = self::$factory->comment->create( array(
    2018             'comment_post_ID' => $this->post_id,
    2019             'comment_approved' => '1',
    2020         ) );
    2021 
    2022         $c6 = self::$factory->comment->create( array(
     2017        $c5 = self::factory()->comment->create( array(
     2018            'comment_post_ID' => $this->post_id,
     2019            'comment_approved' => '1',
     2020        ) );
     2021
     2022        $c6 = self::factory()->comment->create( array(
    20232023            'comment_post_ID' => $this->post_id,
    20242024            'comment_approved' => '1',
     
    20552055     */
    20562056    public function test_hierarchical_threaded_approved() {
    2057         $c1 = self::$factory->comment->create( array(
    2058             'comment_post_ID' => $this->post_id,
    2059             'comment_approved' => '1',
    2060         ) );
    2061 
    2062         $c2 = self::$factory->comment->create( array(
     2057        $c1 = self::factory()->comment->create( array(
     2058            'comment_post_ID' => $this->post_id,
     2059            'comment_approved' => '1',
     2060        ) );
     2061
     2062        $c2 = self::factory()->comment->create( array(
    20632063            'comment_post_ID' => $this->post_id,
    20642064            'comment_approved' => '1',
     
    20662066        ) );
    20672067
    2068         $c3 = self::$factory->comment->create( array(
     2068        $c3 = self::factory()->comment->create( array(
    20692069            'comment_post_ID' => $this->post_id,
    20702070            'comment_approved' => '0',
     
    20722072        ) );
    20732073
    2074         $c4 = self::$factory->comment->create( array(
     2074        $c4 = self::factory()->comment->create( array(
    20752075            'comment_post_ID' => $this->post_id,
    20762076            'comment_approved' => '1',
     
    20782078        ) );
    20792079
    2080         $c5 = self::$factory->comment->create( array(
    2081             'comment_post_ID' => $this->post_id,
    2082             'comment_approved' => '1',
    2083         ) );
    2084 
    2085         self::$factory->comment->create( array(
     2080        $c5 = self::factory()->comment->create( array(
     2081            'comment_post_ID' => $this->post_id,
     2082            'comment_approved' => '1',
     2083        ) );
     2084
     2085        self::factory()->comment->create( array(
    20862086            'comment_post_ID' => $this->post_id,
    20872087            'comment_approved' => '1',
     
    21182118        global $wpdb;
    21192119
    2120         $p = self::$factory->post->create();
    2121         $c = self::$factory->comment->create( array( 'comment_post_ID' => $p ) );
     2120        $p = self::factory()->post->create();
     2121        $c = self::factory()->comment->create( array( 'comment_post_ID' => $p ) );
    21222122
    21232123        $q = new WP_Comment_Query( array(
     
    21362136        global $wpdb;
    21372137
    2138         $p = self::$factory->post->create();
    2139         $c = self::$factory->comment->create( array( 'comment_post_ID' => $p ) );
     2138        $p = self::factory()->post->create();
     2139        $c = self::factory()->comment->create( array( 'comment_post_ID' => $p ) );
    21402140
    21412141        $q = new WP_Comment_Query( array(
Note: See TracChangeset for help on using the changeset viewer.