Make WordPress Core

Changeset 35225


Ignore:
Timestamp:
10/16/2015 09:04:12 PM (9 years ago)
Author:
wonderboymusic
Message:

Unit Tests: one $factory to rule them all, and it shall be static.

Using more than one instance of WP_UnitTest_Factory causes all kinds of craziness, due to out-of-sync internal generator sequences. Since we want to use setUpBeforeClass, we were creating ad hoc instances. To avoid that, we were injecting one static instance via Dependency Injection in wpSetUpBeforeClass. All tests should really use the static instance, so we will remove the instance prop $factory.

Replace $this->factory with self::$factory over 2000 times.
Rewrite all of the tests that were hard-coding dynamic values.

#YOLOFriday

Location:
trunk/tests/phpunit
Files:
169 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/testcase-ajax.php

    r35211 r35225  
    7676
    7777        // Make some posts
    78         $this->factory->post->create_many( 5 );
     78        self::$factory->post->create_many( 5 );
    7979    }
    8080
     
    149149    protected function _setRole( $role ) {
    150150        $post = $_POST;
    151         $user_id = $this->factory->user->create( array( 'role' => $role ) );
     151        $user_id = self::$factory->user->create( array( 'role' => $role ) );
    152152        wp_set_current_user( $user_id );
    153153        $_POST = array_merge($_POST, $post);
  • trunk/tests/phpunit/includes/testcase-canonical.php

    r35191 r35225  
    5050
    5151        // Already created by install defaults:
    52         // $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'uncategorized' ) );
     52        // self::$factory->term->create( array( 'taxonomy' => 'category', 'name' => 'uncategorized' ) );
    5353
    5454        self::$post_ids[] = $factory->post->create( array( 'import_id' => 587, 'post_title' => 'post-format-test-audio', 'post_date' => '2008-06-02 00:00:00' ) );
  • trunk/tests/phpunit/includes/testcase-xmlrpc.php

    r30279 r35225  
    2323
    2424    protected function make_user_by_role( $role ) {
    25         return $this->factory->user->create( array(
     25        return self::$factory->user->create( array(
    2626            'user_login' => $role,
    2727            'user_pass'  => $role,
  • trunk/tests/phpunit/includes/testcase.php

    r35186 r35225  
    1818     * @var WP_UnitTest_Factory
    1919     */
    20     protected $factory;
    21 
    22     protected static $static_factory;
     20    protected static $factory;
    2321
    2422    public static function get_called_class() {
     
    4038        parent::setUpBeforeClass();
    4139
     40        if ( ! self::$factory ) {
     41            self::$factory = new WP_UnitTest_Factory();
     42        }
     43
    4244        $c = self::get_called_class();
    4345        if ( ! method_exists( $c, 'wpSetUpBeforeClass' ) ) {
     
    4547        }
    4648
    47         if ( ! self::$static_factory ) {
    48             self::$static_factory = new WP_UnitTest_Factory();
    49         }
    50 
    51         call_user_func( array( $c, 'wpSetUpBeforeClass' ), self::$static_factory );
     49        call_user_func( array( $c, 'wpSetUpBeforeClass' ), self::$factory );
    5250
    5351        self::commit_transaction();
     
    8381        $wpdb->db_connect();
    8482        ini_set('display_errors', 1 );
    85         $this->factory = new WP_UnitTest_Factory;
    8683        $this->clean_up_global_scope();
    8784
  • trunk/tests/phpunit/tests/admin/includesComment.php

    r34460 r35225  
    77class Tests_Admin_IncludesComment extends WP_UnitTestCase {
    88    public function test_must_match_date_and_author() {
    9         $p1 = $this->factory->post->create();
    10         $c1 = $this->factory->comment->create( array(
     9        $p1 = self::$factory->post->create();
     10        $c1 = self::$factory->comment->create( array(
    1111            'comment_author' => 1,
    1212            'comment_date' => '2014-05-06 12:00:00',
     
    1414        ) );
    1515
    16         $p2 = $this->factory->post->create();
    17         $c2 = $this->factory->comment->create( array(
     16        $p2 = self::$factory->post->create();
     17        $c2 = self::$factory->comment->create( array(
    1818            'comment_author' => 2,
    1919            'comment_date' => '2004-01-02 12:00:00',
     
    2929     */
    3030    public function test_default_value_of_timezone_should_be_blog() {
    31         $p = $this->factory->post->create();
    32         $c = $this->factory->comment->create( array(
     31        $p = self::$factory->post->create();
     32        $c = self::$factory->comment->create( array(
    3333            'comment_author' => 1,
    3434            'comment_post_ID' => $p,
     
    4444     */
    4545    public function test_should_respect_timezone_blog() {
    46         $p = $this->factory->post->create();
    47         $c = $this->factory->comment->create( array(
     46        $p = self::$factory->post->create();
     47        $c = self::$factory->comment->create( array(
    4848            'comment_author' => 1,
    4949            'comment_post_ID' => $p,
     
    5959     */
    6060    public function test_should_respect_timezone_gmt() {
    61         $p = $this->factory->post->create();
    62         $c = $this->factory->comment->create( array(
     61        $p = self::$factory->post->create();
     62        $c = self::$factory->comment->create( array(
    6363            'comment_author' => 1,
    6464            'comment_post_ID' => $p,
     
    7474     */
    7575    public function test_invalid_timezone_should_fall_back_on_blog() {
    76         $p = $this->factory->post->create();
    77         $c = $this->factory->comment->create( array(
     76        $p = self::$factory->post->create();
     77        $c = self::$factory->comment->create( array(
    7878            'comment_author' => 1,
    7979            'comment_post_ID' => $p,
  • trunk/tests/phpunit/tests/admin/includesPlugin.php

    r33906 r35225  
    3030    function test_menu_page_url() {
    3131        $current_user = get_current_user_id();
    32         wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     32        wp_set_current_user( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    3333        update_option( 'siteurl', 'http://example.com' );
    3434
  • trunk/tests/phpunit/tests/admin/includesPost.php

    r34810 r35225  
    1212
    1313    function test__wp_translate_postdata_cap_checks_contributor() {
    14         $contributor_id = $this->factory->user->create( array( 'role' => 'contributor' ) );
    15         $editor_id = $this->factory->user->create( array( 'role' => 'editor' ) );
     14        $contributor_id = self::$factory->user->create( array( 'role' => 'contributor' ) );
     15        $editor_id = self::$factory->user->create( array( 'role' => 'editor' ) );
    1616
    1717        wp_set_current_user( $contributor_id );
     
    5252        // Edit Draft Post for another user
    5353        $_post_data = array();
    54         $_post_data['post_ID'] = $this->factory->post->create( array( 'post_author' => $editor_id ) );
     54        $_post_data['post_ID'] = self::$factory->post->create( array( 'post_author' => $editor_id ) );
    5555        $_post_data['post_author'] = $editor_id;
    5656        $_post_data['post_type'] = 'post';
     
    6565
    6666    function test__wp_translate_postdata_cap_checks_editor() {
    67         $contributor_id = $this->factory->user->create( array( 'role' => 'contributor' ) );
    68         $editor_id = $this->factory->user->create( array( 'role' => 'editor' ) );
     67        $contributor_id = self::$factory->user->create( array( 'role' => 'contributor' ) );
     68        $editor_id = self::$factory->user->create( array( 'role' => 'editor' ) );
    6969
    7070        wp_set_current_user( $editor_id );
     
    105105        // Edit Draft Post for another user
    106106        $_post_data = array();
    107         $_post_data['post_ID'] = $this->factory->post->create( array( 'post_author' => $contributor_id ) );
     107        $_post_data['post_ID'] = self::$factory->post->create( array( 'post_author' => $contributor_id ) );
    108108        $_post_data['post_author'] = $contributor_id;
    109109        $_post_data['post_type'] = 'post';
     
    123123     */
    124124    function test_edit_post_auto_draft() {
    125         $user_id = $this->factory->user->create( array( 'role' => 'editor' ) );
     125        $user_id = self::$factory->user->create( array( 'role' => 'editor' ) );
    126126        wp_set_current_user( $user_id );
    127         $post = $this->factory->post->create_and_get( array( 'post_status' => 'auto-draft' ) );
     127        $post = self::$factory->post->create_and_get( array( 'post_status' => 'auto-draft' ) );
    128128        $this->assertEquals( 'auto-draft', $post->post_status );
    129129        $post_data = array(
     
    141141     */
    142142    public function test_edit_post_should_parse_tax_input_by_name_rather_than_slug_for_nonhierarchical_taxonomies() {
    143         $u = $this->factory->user->create( array( 'role' => 'editor' ) );
     143        $u = self::$factory->user->create( array( 'role' => 'editor' ) );
    144144        wp_set_current_user( $u );
    145145
    146146        register_taxonomy( 'wptests_tax', array( 'post' ) );
    147         $t1 = $this->factory->term->create( array(
     147        $t1 = self::$factory->term->create( array(
    148148            'taxonomy' => 'wptests_tax',
    149149            'name' => 'foo',
    150150            'slug' => 'bar',
    151151        ) );
    152         $t2 = $this->factory->term->create( array(
     152        $t2 = self::$factory->term->create( array(
    153153            'taxonomy' => 'wptests_tax',
    154154            'name' => 'bar',
     
    156156        ) );
    157157
    158         $p = $this->factory->post->create();
     158        $p = self::$factory->post->create();
    159159
    160160        $post_data = array(
     
    180180     */
    181181    public function test_edit_post_should_not_create_terms_for_an_empty_tag_input_field() {
    182         $u = $this->factory->user->create( array( 'role' => 'editor' ) );
     182        $u = self::$factory->user->create( array( 'role' => 'editor' ) );
    183183        wp_set_current_user( $u );
    184184
    185185        register_taxonomy( 'wptests_tax', array( 'post' ) );
    186         $t1 = $this->factory->term->create( array(
     186        $t1 = self::$factory->term->create( array(
    187187            'taxonomy' => 'wptests_tax',
    188188            'name' => 'foo',
     
    190190        ) );
    191191
    192         $p = $this->factory->post->create();
     192        $p = self::$factory->post->create();
    193193
    194194        $post_data = array(
     
    210210     */
    211211    function test_bulk_edit_posts_stomping() {
    212         $admin = $this->factory->user->create( array( 'role' => 'administrator' ) );
    213         $users = $this->factory->user->create_many( 2, array( 'role' => 'author' ) );
     212        $admin = self::$factory->user->create( array( 'role' => 'administrator' ) );
     213        $users = self::$factory->user->create_many( 2, array( 'role' => 'author' ) );
    214214        wp_set_current_user( $admin );
    215215
    216         $post1 = $this->factory->post->create( array(
     216        $post1 = self::$factory->post->create( array(
    217217            'post_author'    => $users[0],
    218218            'comment_status' => 'open',
     
    221221        ) );
    222222
    223         $post2 = $this->factory->post->create( array(
     223        $post2 = self::$factory->post->create( array(
    224224            'post_author'    => $users[1],
    225225            'comment_status' => 'closed',
     
    256256
    257257        $future_date = date( 'Y-m-d H:i:s', time() + 100 );
    258         $p = $this->factory->post->create( array( 'post_status' => 'future', 'post_name' => 'foo', 'post_date' => $future_date ) );
     258        $p = self::$factory->post->create( array( 'post_status' => 'future', 'post_name' => 'foo', 'post_date' => $future_date ) );
    259259
    260260        $found = get_sample_permalink( $p );
     
    269269     */
    270270    public function test_get_sample_permalink_html_should_use_default_permalink_for_view_post_link_when_pretty_permalinks_are_disabled() {
    271         wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     271        wp_set_current_user( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    272272
    273273        $future_date = date( 'Y-m-d H:i:s', time() + 100 );
    274         $p = $this->factory->post->create( array( 'post_status' => 'future', 'post_name' => 'foo', 'post_date' => $future_date ) );
     274        $p = self::$factory->post->create( array( 'post_status' => 'future', 'post_name' => 'foo', 'post_date' => $future_date ) );
    275275
    276276        $found = get_sample_permalink_html( $p );
     
    285285        $this->set_permalink_structure( '/%postname%/' );
    286286
    287         wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     287        wp_set_current_user( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    288288
    289289        $future_date = date( 'Y-m-d H:i:s', time() + 100 );
    290         $p = $this->factory->post->create( array( 'post_status' => 'future', 'post_name' => 'foo', 'post_date' => $future_date ) );
     290        $p = self::$factory->post->create( array( 'post_status' => 'future', 'post_name' => 'foo', 'post_date' => $future_date ) );
    291291
    292292        $found = get_sample_permalink_html( $p );
     
    302302        $this->set_permalink_structure( '/%postname%/' );
    303303
    304         wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     304        wp_set_current_user( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    305305
    306306        // Published posts should use published permalink
    307         $p = $this->factory->post->create( array( 'post_status' => 'publish', 'post_name' => 'foo' ) );
     307        $p = self::$factory->post->create( array( 'post_status' => 'publish', 'post_name' => 'foo' ) );
    308308
    309309        $found = get_sample_permalink_html( $p, null, 'new_slug' );
     
    314314        // Scheduled posts should use published permalink
    315315        $future_date = date( 'Y-m-d H:i:s', time() + 100 );
    316         $p = $this->factory->post->create( array( 'post_status' => 'future', 'post_name' => 'bar', 'post_date' => $future_date ) );
     316        $p = self::$factory->post->create( array( 'post_status' => 'future', 'post_name' => 'bar', 'post_date' => $future_date ) );
    317317
    318318        $found = get_sample_permalink_html( $p, null, 'new_slug' );
     
    322322
    323323        // Draft posts should use preview link
    324         $p = $this->factory->post->create( array( 'post_status' => 'draft', 'post_name' => 'baz' ) );
     324        $p = self::$factory->post->create( array( 'post_status' => 'draft', 'post_name' => 'baz' ) );
    325325
    326326        $found = get_sample_permalink_html( $p, null, 'new_slug' );
     
    340340        $this->set_permalink_structure( '/%postname%/' );
    341341
    342         $p = $this->factory->post->create( array(
     342        $p = self::$factory->post->create( array(
    343343            'post_name' => '2015',
    344344        ) );
     
    354354        $this->set_permalink_structure( '/%year%/%postname%/' );
    355355
    356         $p = $this->factory->post->create( array(
     356        $p = self::$factory->post->create( array(
    357357            'post_name' => '2015',
    358358        ) );
     
    368368        $this->set_permalink_structure( '/%year%/%postname%/' );
    369369
    370         $p = $this->factory->post->create( array(
     370        $p = self::$factory->post->create( array(
    371371            'post_name' => '11',
    372372        ) );
     
    382382        $this->set_permalink_structure( '/%year%/%postname%/' );
    383383
    384         $p = $this->factory->post->create( array(
     384        $p = self::$factory->post->create( array(
    385385            'post_name' => '13',
    386386        ) );
     
    396396        $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' );
    397397
    398         $p = $this->factory->post->create( array(
     398        $p = self::$factory->post->create( array(
    399399            'post_name' => '30',
    400400        ) );
     
    410410        $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' );
    411411
    412         $this->factory->post->create( array(
     412        self::$factory->post->create( array(
    413413            'post_name' => '30-2',
    414414        ) );
    415415
    416         $p = $this->factory->post->create( array(
     416        $p = self::$factory->post->create( array(
    417417            'post_name' => '30',
    418418        ) );
     
    428428        $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' );
    429429
    430         $p = $this->factory->post->create( array(
     430        $p = self::$factory->post->create( array(
    431431            'post_name' => '32',
    432432        ) );
     
    442442        $this->set_permalink_structure( '/%year%/%month%/%day%/%postname%/' );
    443443
    444         $p = $this->factory->post->create( array(
     444        $p = self::$factory->post->create( array(
    445445            'post_name' => '30',
    446446        ) );
     
    451451
    452452    public function test_post_exists_should_match_title() {
    453         $p = $this->factory->post->create( array(
     453        $p = self::$factory->post->create( array(
    454454            'post_title' => 'Foo Bar',
    455455        ) );
     
    459459
    460460    public function test_post_exists_should_not_match_nonexistent_title() {
    461         $p = $this->factory->post->create( array(
     461        $p = self::$factory->post->create( array(
    462462            'post_title' => 'Foo Bar',
    463463        ) );
     
    469469        $title = 'Foo Bar';
    470470        $content = 'Foo Bar Baz';
    471         $p = $this->factory->post->create( array(
     471        $p = self::$factory->post->create( array(
    472472            'post_title' => $title,
    473473            'post_content' => $content,
     
    480480        $title = 'Foo Bar';
    481481        $content = 'Foo Bar Baz';
    482         $p = $this->factory->post->create( array(
     482        $p = self::$factory->post->create( array(
    483483            'post_title' => $title,
    484484            'post_content' => $content . ' Quz',
     
    491491        $title = 'Foo Bar';
    492492        $date = '2014-05-08 12:00:00';
    493         $p = $this->factory->post->create( array(
     493        $p = self::$factory->post->create( array(
    494494            'post_title' => $title,
    495495            'post_date' => $date,
     
    502502        $title = 'Foo Bar';
    503503        $date = '2014-05-08 12:00:00';
    504         $p = $this->factory->post->create( array(
     504        $p = self::$factory->post->create( array(
    505505            'post_title' => $title,
    506506            'post_date' => '2015-10-10 00:00:00',
     
    514514        $content = 'Foo Bar Baz';
    515515        $date = '2014-05-08 12:00:00';
    516         $p = $this->factory->post->create( array(
     516        $p = self::$factory->post->create( array(
    517517            'post_title' => $title,
    518518            'post_content' => $content,
  • trunk/tests/phpunit/tests/adminbar.php

    r35186 r35225  
    1616     */
    1717    function test_content_post_type() {
    18         wp_set_current_user( $this->factory->user->create( array( 'role' => 'editor' ) ) );
     18        wp_set_current_user( self::$factory->user->create( array( 'role' => 'editor' ) ) );
    1919
    2020        register_post_type( 'content', array( 'show_in_admin_bar' => true ) );
     
    3535     */
    3636    function test_merging_existing_meta_values() {
    37         wp_set_current_user( $this->factory->user->create( array( 'role' => 'editor' ) ) );
     37        wp_set_current_user( self::$factory->user->create( array( 'role' => 'editor' ) ) );
    3838
    3939        $admin_bar = new WP_Admin_Bar;
     
    6363        }
    6464
    65         $nobody = $this->factory->user->create( array( 'role' => '' ) );
     65        $nobody = self::$factory->user->create( array( 'role' => '' ) );
    6666        $this->assertFalse( user_can( $nobody, 'read' ) );
    6767
     
    9393        }
    9494
    95         $editor = $this->factory->user->create( array( 'role' => 'editor' ) );
     95        $editor = self::$factory->user->create( array( 'role' => 'editor' ) );
    9696        $this->assertTrue( user_can( $editor, 'read' ) );
    9797
     
    126126        }
    127127
    128         $admin  = $this->factory->user->create( array( 'role' => 'administrator' ) );
    129         $editor = $this->factory->user->create( array( 'role' => 'editor' ) );
     128        $admin  = self::$factory->user->create( array( 'role' => 'administrator' ) );
     129        $editor = self::$factory->user->create( array( 'role' => 'editor' ) );
    130130
    131131        $this->assertTrue( user_can( $admin, 'read' ) );
    132132        $this->assertTrue( user_can( $editor, 'read' ) );
    133133
    134         $new_blog_id = $this->factory->blog->create( array(
     134        $new_blog_id = self::$factory->blog->create( array(
    135135            'user_id' => $admin,
    136136        ) );
     
    180180        }
    181181
    182         $admin  = $this->factory->user->create( array( 'role' => 'administrator' ) );
    183         $nobody = $this->factory->user->create( array( 'role' => '' ) );
     182        $admin  = self::$factory->user->create( array( 'role' => 'administrator' ) );
     183        $nobody = self::$factory->user->create( array( 'role' => '' ) );
    184184
    185185        $this->assertTrue( user_can( $admin, 'read' ) );
    186186        $this->assertFalse( user_can( $nobody, 'read' ) );
    187187
    188         $new_blog_id = $this->factory->blog->create( array(
     188        $new_blog_id = self::$factory->blog->create( array(
    189189            'user_id' => $admin,
    190190        ) );
  • trunk/tests/phpunit/tests/ajax/Autosave.php

    r35211 r35225  
    3434        parent::setUp();
    3535        // Set a user so the $post has 'post_author'
    36         $this->user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
     36        $this->user_id = self::$factory->user->create( array( 'role' => 'administrator' ) );
    3737        wp_set_current_user( $this->user_id );
    3838
    39         $post_id = $this->factory->post->create( array( 'post_status' => 'draft' ) );
     39        $post_id = self::$factory->post->create( array( 'post_status' => 'draft' ) );
    4040        $this->_post = get_post( $post_id );
    4141    }
     
    9898    public function test_autosave_locked_post() {
    9999        // Lock the post to another user
    100         $another_user_id = $this->factory->user->create( array( 'role' => 'editor' ) );
     100        $another_user_id = self::$factory->user->create( array( 'role' => 'editor' ) );
    101101        wp_set_current_user( $another_user_id );
    102102        wp_set_post_lock( $this->_post->ID );
  • trunk/tests/phpunit/tests/ajax/CustomizeMenus.php

    r35211 r35225  
    2323        parent::setUp();
    2424        require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
    25         wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     25        wp_set_current_user( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    2626        global $wp_customize;
    2727        $this->wp_customize = new WP_Customize_Manager();
     
    6666        }
    6767
    68         wp_set_current_user( $this->factory->user->create( array( 'role' => $role ) ) );
     68        wp_set_current_user( self::$factory->user->create( array( 'role' => $role ) ) );
    6969
    7070        $_POST = array(
     
    308308
    309309        // Create some terms and pages.
    310         $this->factory->term->create_many( 5 );
    311         $this->factory->post->create_many( 5, array( 'post_type' => 'page' ) );
     310        self::$factory->term->create_many( 5 );
     311        self::$factory->post->create_many( 5, array( 'post_type' => 'page' ) );
    312312
    313313        $_POST = array_merge( array(
     
    397397        }
    398398
    399         wp_set_current_user( $this->factory->user->create( array( 'role' => $role ) ) );
     399        wp_set_current_user( self::$factory->user->create( array( 'role' => $role ) ) );
    400400
    401401        $_POST = array(
     
    470470    function test_ajax_search_available_items_results( $post_args, $expected_results ) {
    471471
    472         $this->factory->post->create_many( 5, array( 'post_title' => 'Test Post' ) );
     472        self::$factory->post->create_many( 5, array( 'post_title' => 'Test Post' ) );
    473473
    474474        $_POST = array_merge( array(
  • trunk/tests/phpunit/tests/ajax/DeleteComment.php

    r34879 r35225  
    2727    public function setUp() {
    2828        parent::setUp();
    29         $post_id = $this->factory->post->create();
    30         $this->_comments = $this->factory->comment->create_post_comments( $post_id, 15 );
     29        $post_id = self::$factory->post->create();
     30        $this->_comments = self::$factory->comment->create_post_comments( $post_id, 15 );
    3131        $this->_comments = array_map( 'get_comment', $this->_comments );
    3232    }
  • trunk/tests/phpunit/tests/ajax/DimComment.php

    r25002 r35225  
    2727    public function setUp() {
    2828        parent::setUp();
    29         $post_id = $this->factory->post->create();
    30         $this->_comments = $this->factory->comment->create_post_comments( $post_id, 15 );
     29        $post_id = self::$factory->post->create();
     30        $this->_comments = self::$factory->comment->create_post_comments( $post_id, 15 );
    3131        $this->_comments = array_map( 'get_comment', $this->_comments );
    3232    }
  • trunk/tests/phpunit/tests/ajax/EditComment.php

    r33614 r35225  
    2727    public function setUp() {
    2828        parent::setUp();
    29         $post_id = $this->factory->post->create();
    30         $this->factory->comment->create_post_comments( $post_id, 5 );
     29        $post_id = self::$factory->post->create();
     30        self::$factory->comment->create_post_comments( $post_id, 5 );
    3131        $this->_comment_post = get_post( $post_id );
    3232    }
  • trunk/tests/phpunit/tests/ajax/GetComments.php

    r25438 r35225  
    3333    public function setUp() {
    3434        parent::setUp();
    35         $post_id = $this->factory->post->create();
    36         $this->factory->comment->create_post_comments( $post_id, 5 );
     35        $post_id = self::$factory->post->create();
     36        self::$factory->comment->create_post_comments( $post_id, 5 );
    3737        $this->_comment_post = get_post( $post_id );
    3838
    39         $post_id = $this->factory->post->create();
     39        $post_id = self::$factory->post->create();
    4040        $this->_no_comment_post = get_post( $post_id );
    4141
  • trunk/tests/phpunit/tests/ajax/QuickEdit.php

    r31313 r35225  
    2626        ) );
    2727
    28         $t1 = $this->factory->term->create( array(
     28        $t1 = self::$factory->term->create( array(
    2929            'taxonomy' => 'wptests_tax_1',
    3030        ) );
    31         $t2 = $this->factory->term->create( array(
     31        $t2 = self::$factory->term->create( array(
    3232            'taxonomy' => 'wptests_tax_2',
    3333        ) );
     
    3636        $this->_setRole( 'administrator' );
    3737
    38         $post = $this->factory->post->create_and_get( array(
     38        $post = self::$factory->post->create_and_get( array(
    3939            'post_author' => get_current_user_id(),
    4040        ) );
  • trunk/tests/phpunit/tests/ajax/ReplytoComment.php

    r34172 r35225  
    3333    public function setUp() {
    3434        parent::setUp();
    35         $post_id = $this->factory->post->create();
    36         $this->factory->comment->create_post_comments( $post_id, 5 );
     35        $post_id = self::$factory->post->create();
     36        self::$factory->comment->create_post_comments( $post_id, 5 );
    3737        $this->_comment_post = get_post( $post_id );
    3838
    39         $post_id = $this->factory->post->create( array( 'post_status' => 'draft' ) );
     39        $post_id = self::$factory->post->create( array( 'post_status' => 'draft' ) );
    4040        $this->_draft_post = get_post( $post_id );
    4141    }
  • trunk/tests/phpunit/tests/attachment/slashes.php

    r34852 r35225  
    99    function setUp() {
    1010        parent::setUp();
    11         $this->author_id = $this->factory->user->create( array( 'role' => 'editor' ) );
     11        $this->author_id = self::$factory->user->create( array( 'role' => 'editor' ) );
    1212        $this->old_current_user = get_current_user_id();
    1313        wp_set_current_user( $this->author_id );
  • trunk/tests/phpunit/tests/avatar.php

    r33425 r35225  
    8888        $this->assertEquals( $url, $url2 );
    8989
    90         $post_id = $this->factory->post->create( array( 'post_author' => 1 ) );
     90        $post_id = self::$factory->post->create( array( 'post_author' => 1 ) );
    9191        $post = get_post( $post_id );
    9292        $url2 = get_avatar_url( $post );
    9393        $this->assertEquals( $url, $url2 );
    9494
    95         $comment_id = $this->factory->comment->create( array( 'comment_post_ID' => $post_id, 'user_id' => 1 ) );
     95        $comment_id = self::$factory->comment->create( array( 'comment_post_ID' => $post_id, 'user_id' => 1 ) );
    9696        $comment = get_comment( $comment_id );
    9797        $url2 = get_avatar_url( $comment );
     
    139139        $url = get_avatar_url( 1 );
    140140
    141         $post_id = $this->factory->post->create( array( 'post_author' => 1 ) );
    142         $comment_id = $this->factory->comment->create( array( 'comment_post_ID' => $post_id, 'user_id' => 1, 'comment_type' => 'pingback' ) );
     141        $post_id = self::$factory->post->create( array( 'post_author' => 1 ) );
     142        $comment_id = self::$factory->comment->create( array( 'comment_post_ID' => $post_id, 'user_id' => 1, 'comment_type' => 'pingback' ) );
    143143        $comment = get_comment( $comment_id );
    144144
  • trunk/tests/phpunit/tests/canonical/pageOnFront.php

    r35191 r35225  
    1919
    2020        update_option( 'show_on_front', 'page' );
    21         update_option( 'page_for_posts', $this->factory->post->create( array( 'post_title' => 'blog-page', 'post_type' => 'page' ) ) );
    22         update_option( 'page_on_front', $this->factory->post->create( array( 'post_title' => 'front-page', 'post_type' => 'page' ) ) );
     21        update_option( 'page_for_posts', self::$factory->post->create( array( 'post_title' => 'blog-page', 'post_type' => 'page' ) ) );
     22        update_option( 'page_on_front', self::$factory->post->create( array( 'post_title' => 'front-page', 'post_type' => 'page' ) ) );
    2323    }
    2424
  • trunk/tests/phpunit/tests/canonical/paged.php

    r34492 r35225  
    1313        $next = '<!--nextpage-->';
    1414
    15         $post_id = $this->factory->post->create( array(
     15        $post_id = self::$factory->post->create( array(
    1616            'post_status' => 'publish',
    1717            'post_content' => "{$para}{$next}{$para}{$next}{$para}"
  • trunk/tests/phpunit/tests/category.php

    r35162 r35225  
    2222    function test_get_all_category_ids() {
    2323        // create categories
    24         $this->factory->category->create_many( 2 );
     24        self::$factory->category->create_many( 2 );
    2525
    2626        // create new taxonomy to ensure not included
     
    3939
    4040        // create Test Categories
    41         $testcat = $this->factory->category->create_and_get(
     41        $testcat = self::$factory->category->create_and_get(
    4242            array(
    4343                'slug' => 'testcat',
     
    4545            )
    4646        );
    47         $testcat2 = $this->factory->category->create_and_get(
     47        $testcat2 = self::$factory->category->create_and_get(
    4848            array(
    4949                'slug' => 'testcat2',
     
    7474            'description' => 'Category Test'
    7575        );
    76         $testcat = $this->factory->category->create_and_get( $testcat_array );
     76        $testcat = self::$factory->category->create_and_get( $testcat_array );
    7777        $testcat_array['term_id'] = $testcat->term_id;
    7878
     
    8383            'parent' => $testcat->term_id
    8484        );
    85         $testcat2 = $this->factory->category->create_and_get( $testcat2_array );
     85        $testcat2 = self::$factory->category->create_and_get( $testcat2_array );
    8686        $testcat2_array['term_id'] = $testcat2->term_id;
    8787
     
    146146
    147147        // create Test Category
    148         $testcat = $this->factory->category->create_and_get(
     148        $testcat = self::$factory->category->create_and_get(
    149149            array(
    150150                'slug' => 'testcat',
     
    166166
    167167        // create Test Category
    168         $testcat = $this->factory->category->create_and_get(
     168        $testcat = self::$factory->category->create_and_get(
    169169            array(
    170170                'slug' => 'testcat',
     
    186186
    187187        // create Test Categories
    188         $root_id = $this->factory->category->create(
     188        $root_id = self::$factory->category->create(
    189189            array(
    190190                'slug' => 'root',
    191191            )
    192192        );
    193         $root_cat_id = $this->factory->category->create(
     193        $root_cat_id = self::$factory->category->create(
    194194            array(
    195195                'slug' => 'cat',
     
    197197            )
    198198        );
    199         $root_cat_cat_id = $this->factory->category->create(
     199        $root_cat_cat_id = self::$factory->category->create(
    200200            array(
    201201                'slug' => 'cat', //note this is modified on create
     
    203203            )
    204204        );
    205         $root_path_id = $this->factory->category->create(
     205        $root_path_id = self::$factory->category->create(
    206206            array(
    207207                'slug' => 'path',
     
    209209            )
    210210        );
    211         $root_path_cat_id = $this->factory->category->create(
     211        $root_path_cat_id = self::$factory->category->create(
    212212            array(
    213213                'slug' => 'cat', //note this is modified on create
     
    215215            )
    216216        );
    217         $root_level_id = $this->factory->category->create(
     217        $root_level_id = self::$factory->category->create(
    218218            array(
    219219                'slug' => 'level-1',
     
    221221            )
    222222        );
    223         $root_level_cat_id = $this->factory->category->create(
     223        $root_level_cat_id = self::$factory->category->create(
    224224            array(
    225225                'slug' => 'cat', //note this is modified on create
     
    249249    public function test_wp_dropdown_categories_value_field_should_default_to_term_id() {
    250250        // Create a test category.
    251         $cat_id = $this->factory->category->create( array(
     251        $cat_id = self::$factory->category->create( array(
    252252            'name' => 'Test Category',
    253253            'slug' => 'test_category',
     
    269269    public function test_wp_dropdown_categories_value_field_term_id() {
    270270        // Create a test category.
    271         $cat_id = $this->factory->category->create( array(
     271        $cat_id = self::$factory->category->create( array(
    272272            'name' => 'Test Category',
    273273            'slug' => 'test_category',
     
    290290    public function test_wp_dropdown_categories_value_field_slug() {
    291291        // Create a test category.
    292         $cat_id = $this->factory->category->create( array(
     292        $cat_id = self::$factory->category->create( array(
    293293            'name' => 'Test Category',
    294294            'slug' => 'test_category',
     
    311311    public function test_wp_dropdown_categories_value_field_should_fall_back_on_term_id_when_an_invalid_value_is_provided() {
    312312        // Create a test category.
    313         $cat_id = $this->factory->category->create( array(
     313        $cat_id = self::$factory->category->create( array(
    314314            'name' => 'Test Category',
    315315            'slug' => 'test_category',
     
    331331     */
    332332    public function test_wp_dropdown_categories_selected_should_respect_custom_value_field() {
    333         $c1 = $this->factory->category->create( array(
     333        $c1 = self::$factory->category->create( array(
    334334            'name' => 'Test Category 1',
    335335            'slug' => 'test_category_1',
    336336        ) );
    337337
    338         $c2 = $this->factory->category->create( array(
     338        $c2 = self::$factory->category->create( array(
    339339            'name' => 'Test Category 2',
    340340            'slug' => 'test_category_2',
     
    355355     */
    356356    public function test_wp_dropdown_categories_show_option_all_should_be_selected_if_no_selected_value_is_explicitly_passed_and_value_field_does_not_have_string_values() {
    357         $cats = $this->factory->category->create_many( 3 );
     357        $cats = self::$factory->category->create_many( 3 );
    358358
    359359        $found = wp_dropdown_categories( array(
     
    376376     */
    377377    public function test_wp_dropdown_categories_show_option_all_should_be_selected_if_selected_value_of_0_string_is_explicitly_passed_and_value_field_does_not_have_string_values() {
    378         $cats = $this->factory->category->create_many( 3 );
     378        $cats = self::$factory->category->create_many( 3 );
    379379
    380380        $found = wp_dropdown_categories( array(
  • trunk/tests/phpunit/tests/category/getCategoryParents.php

    r31299 r35225  
    1111        parent::setUp();
    1212
    13         $this->c1 = $this->factory->category->create_and_get();
    14         $this->c2 = $this->factory->category->create_and_get( array(
     13        $this->c1 = self::$factory->category->create_and_get();
     14        $this->c2 = self::$factory->category->create_and_get( array(
    1515            'parent' => $this->c1->term_id,
    1616        ) );
     
    5252
    5353    public function test_visited() {
    54         $c3 = $this->factory->category->create_and_get( array(
     54        $c3 = self::$factory->category->create_and_get( array(
    5555            'parent' => $this->c2->term_id,
    5656        ) );
    57         $c4 = $this->factory->category->create_and_get( array(
     57        $c4 = self::$factory->category->create_and_get( array(
    5858            'parent' => $c3->term_id,
    5959        ) );
  • trunk/tests/phpunit/tests/category/wpListCategories.php

    r34696 r35225  
    66class Tests_Category_WpListCategories extends WP_UnitTestCase {
    77    public function test_class() {
    8         $c = $this->factory->category->create();
     8        $c = self::$factory->category->create();
    99
    1010        $found = wp_list_categories( array(
     
    1717
    1818    public function test_class_containing_current_cat() {
    19         $c1 = $this->factory->category->create();
    20         $c2 = $this->factory->category->create();
     19        $c1 = self::$factory->category->create();
     20        $c2 = self::$factory->category->create();
    2121
    2222        $found = wp_list_categories( array(
     
    3131
    3232    public function test_class_containing_current_cat_parent() {
    33         $c1 = $this->factory->category->create();
    34         $c2 = $this->factory->category->create( array(
     33        $c1 = self::$factory->category->create();
     34        $c2 = self::$factory->category->create( array(
    3535            'parent' => $c1,
    3636        ) );
     
    5050     */
    5151    public function test_current_category_should_accept_an_array_of_ids() {
    52         $cats = $this->factory->category->create_many( 3 );
     52        $cats = self::$factory->category->create_many( 3 );
    5353
    5454        $found = wp_list_categories( array(
     
    6767     */
    6868    public function test_should_not_create_element_when_cat_name_is_filtered_to_empty_string() {
    69         $c1 = $this->factory->category->create( array(
     69        $c1 = self::$factory->category->create( array(
    7070            'name' => 'Test Cat 1',
    7171        ) );
    72         $c2 = $this->factory->category->create( array(
     72        $c2 = self::$factory->category->create( array(
    7373            'name' => 'Test Cat 2',
    7474        ) );
     
    8989
    9090    public function test_show_option_all_link_should_go_to_home_page_when_show_on_front_is_false() {
    91         $cats = $this->factory->category->create_many( 2 );
     91        $cats = self::$factory->category->create_many( 2 );
    9292
    9393        $found = wp_list_categories( array(
     
    102102
    103103    public function test_show_option_all_link_should_respect_page_for_posts() {
    104         $cats = $this->factory->category->create_many( 2 );
    105         $p = $this->factory->post->create( array( 'post_type' => 'page' ) );
     104        $cats = self::$factory->category->create_many( 2 );
     105        $p = self::$factory->post->create( array( 'post_type' => 'page' ) );
    106106
    107107        update_option( 'show_on_front', 'page' );
     
    126126        register_taxonomy( 'wptests_tax', array( 'foo', 'wptests_pt', 'wptests_pt2' ) );
    127127
    128         $terms = $this->factory->term->create_many( 2, array(
     128        $terms = self::$factory->term->create_many( 2, array(
    129129            'taxonomy' => 'wptests_tax',
    130130        ) );
     
    150150        register_taxonomy( 'wptests_tax', array( 'foo', 'wptests_pt', 'wptests_pt2' ) );
    151151
    152         $terms = $this->factory->term->create_many( 2, array(
     152        $terms = self::$factory->term->create_many( 2, array(
    153153            'taxonomy' => 'wptests_tax',
    154154        ) );
     
    171171        register_taxonomy( 'wptests_tax', array( 'foo', 'wptests_pt', 'post', 'wptests_pt2' ) );
    172172
    173         $terms = $this->factory->term->create_many( 2, array(
     173        $terms = self::$factory->term->create_many( 2, array(
    174174            'taxonomy' => 'wptests_tax',
    175175        ) );
     
    192192        register_taxonomy( 'wptests_tax', array( 'foo', 'wptests_pt', 'wptests_pt2' ) );
    193193
    194         $terms = $this->factory->term->create_many( 2, array(
     194        $terms = self::$factory->term->create_many( 2, array(
    195195            'taxonomy' => 'wptests_tax',
    196196        ) );
     
    255255     */
    256256    public function test_hide_title_if_empty_should_be_ignored_when_category_list_is_not_empty() {
    257         $cat = $this->factory->category->create();
     257        $cat = self::$factory->category->create();
    258258
    259259        $found = wp_list_categories( array(
     
    270270     */
    271271    public function test_exclude_tree_should_be_respected() {
    272         $c = $this->factory->category->create();
    273         $parent = $this->factory->category->create( array( 'name' => 'Parent', 'slug' => 'parent' ) );
    274         $child = $this->factory->category->create( array( 'name' => 'Child', 'slug' => 'child', 'parent' => $parent ) );
     272        $c = self::$factory->category->create();
     273        $parent = self::$factory->category->create( array( 'name' => 'Parent', 'slug' => 'parent' ) );
     274        $child = self::$factory->category->create( array( 'name' => 'Child', 'slug' => 'child', 'parent' => $parent ) );
    275275
    276276        $args = array( 'echo' => 0, 'hide_empty' => 0, 'exclude_tree' => $parent );
     
    287287     */
    288288    public function test_exclude_tree_should_be_merged_with_exclude() {
    289         $c = $this->factory->category->create();
    290         $parent = $this->factory->category->create( array( 'name' => 'Parent', 'slug' => 'parent' ) );
    291         $child = $this->factory->category->create( array( 'name' => 'Child', 'slug' => 'child', 'parent' => $parent ) );
    292         $parent2 = $this->factory->category->create( array( 'name' => 'Parent', 'slug' => 'parent2' ) );
    293         $child2 = $this->factory->category->create( array( 'name' => 'Child', 'slug' => 'child2', 'parent' => $parent2 ) );
     289        $c = self::$factory->category->create();
     290        $parent = self::$factory->category->create( array( 'name' => 'Parent', 'slug' => 'parent' ) );
     291        $child = self::$factory->category->create( array( 'name' => 'Child', 'slug' => 'child', 'parent' => $parent ) );
     292        $parent2 = self::$factory->category->create( array( 'name' => 'Parent', 'slug' => 'parent2' ) );
     293        $child2 = self::$factory->category->create( array( 'name' => 'Child', 'slug' => 'child2', 'parent' => $parent2 ) );
    294294
    295295        $args = array( 'echo' => 0, 'hide_empty' => 0, 'exclude_tree' => $parent );
  • trunk/tests/phpunit/tests/comment-submission.php

    r34801 r35225  
    3939        $this->assertSame( 0, did_action( $error ) );
    4040
    41         $post = $this->factory->post->create_and_get( array(
     41        $post = self::$factory->post->create_and_get( array(
    4242            'comment_status' => 'closed',
    4343        ) );
     
    5959        $this->assertSame( 0, did_action( $error ) );
    6060
    61         $post = $this->factory->post->create_and_get();
     61        $post = self::$factory->post->create_and_get();
    6262        wp_trash_post( $post );
    6363        $data = array(
     
    7878        $this->assertSame( 0, did_action( $error ) );
    7979
    80         $post = $this->factory->post->create_and_get( array(
     80        $post = self::$factory->post->create_and_get( array(
    8181            'post_status' => 'draft',
    8282        ) );
     
    9999        $this->assertSame( 0, did_action( $error ) );
    100100
    101         $post = $this->factory->post->create_and_get( array(
     101        $post = self::$factory->post->create_and_get( array(
    102102            'post_date' => date( 'Y-m-d H:i:s', strtotime( '+1 day' ) ),
    103103        ) );
     
    122122        $this->assertSame( 0, did_action( $error ) );
    123123
    124         $post = $this->factory->post->create_and_get( array(
     124        $post = self::$factory->post->create_and_get( array(
    125125            'post_password' => 'password',
    126126        ) );
     
    143143        $_COOKIE['wp-postpass_' . COOKIEHASH] = $hasher->HashPassword( $password );
    144144
    145         $post = $this->factory->post->create_and_get( array(
     145        $post = self::$factory->post->create_and_get( array(
    146146            'post_password' => $password,
    147147        ) );
     
    163163    public function test_submitting_valid_comment_as_logged_in_user_succeeds() {
    164164
    165         $user = $this->factory->user->create_and_get( array(
     165        $user = self::$factory->user->create_and_get( array(
    166166            'user_url' => 'http://user.example.org'
    167167        ) );
     
    169169        wp_set_current_user( $user->ID );
    170170
    171         $post = $this->factory->post->create_and_get();
     171        $post = self::$factory->post->create_and_get();
    172172        $data = array(
    173173            'comment_post_ID' => $post->ID,
     
    188188    public function test_submitting_valid_comment_anonymously_succeeds() {
    189189
    190         $post = $this->factory->post->create_and_get();
     190        $post = self::$factory->post->create_and_get();
    191191        $data = array(
    192192            'comment_post_ID' => $post->ID,
     
    215215    public function test_submitting_comment_handles_slashes_correctly_handles_slashes() {
    216216
    217         $post = $this->factory->post->create_and_get();
     217        $post = self::$factory->post->create_and_get();
    218218        $data = array(
    219219            'comment_post_ID' => $post->ID,
     
    237237        $error = 'not_logged_in';
    238238
    239         $post = $this->factory->post->create_and_get( array(
     239        $post = self::$factory->post->create_and_get( array(
    240240            'post_status' => 'private',
    241241        ) );
     
    253253    public function test_submitting_comment_to_own_private_post_succeeds() {
    254254
    255         $user = $this->factory->user->create_and_get();
    256 
    257         wp_set_current_user( $user->ID );
    258 
    259         $post = $this->factory->post->create_and_get( array(
     255        $user = self::$factory->user->create_and_get();
     256
     257        wp_set_current_user( $user->ID );
     258
     259        $post = self::$factory->post->create_and_get( array(
    260260            'post_status' => 'private',
    261261            'post_author' => $user->ID,
     
    275275    public function test_submitting_comment_to_accessible_private_post_succeeds() {
    276276
    277         $author = $this->factory->user->create_and_get( array(
     277        $author = self::$factory->user->create_and_get( array(
    278278            'role' => 'author',
    279279        ) );
    280         $user = $this->factory->user->create_and_get( array(
     280        $user = self::$factory->user->create_and_get( array(
    281281            'role' => 'editor',
    282282        ) );
     
    284284        wp_set_current_user( $user->ID );
    285285
    286         $post = $this->factory->post->create_and_get( array(
     286        $post = self::$factory->post->create_and_get( array(
    287287            'post_status' => 'private',
    288288            'post_author' => $author->ID,
     
    302302    public function test_anonymous_user_cannot_comment_unfiltered_html() {
    303303
    304         $post = $this->factory->post->create_and_get();
     304        $post = self::$factory->post->create_and_get();
    305305        $data = array(
    306306            'comment_post_ID' => $post->ID,
     
    319319    public function test_unprivileged_user_cannot_comment_unfiltered_html() {
    320320
    321         $user = $this->factory->user->create_and_get( array(
     321        $user = self::$factory->user->create_and_get( array(
    322322            'role' => 'author',
    323323        ) );
     
    326326        $this->assertFalse( current_user_can( 'unfiltered_html' ) );
    327327
    328         $post = $this->factory->post->create_and_get();
     328        $post = self::$factory->post->create_and_get();
    329329        $data = array(
    330330            'comment_post_ID' => $post->ID,
     
    341341    public function test_unprivileged_user_cannot_comment_unfiltered_html_even_with_valid_nonce() {
    342342
    343         $user = $this->factory->user->create_and_get( array(
     343        $user = self::$factory->user->create_and_get( array(
    344344            'role' => 'author',
    345345        ) );
     
    348348        $this->assertFalse( current_user_can( 'unfiltered_html' ) );
    349349
    350         $post   = $this->factory->post->create_and_get();
     350        $post   = self::$factory->post->create_and_get();
    351351        $action = 'unfiltered-html-comment_' . $post->ID;
    352352        $nonce  = wp_create_nonce( $action );
     
    371371        $this->assertFalse( defined( 'DISALLOW_UNFILTERED_HTML' ) );
    372372
    373         $user = $this->factory->user->create_and_get( array(
     373        $user = self::$factory->user->create_and_get( array(
    374374            'role' => 'editor',
    375375        ) );
     
    385385        $this->assertTrue( current_user_can( 'unfiltered_html' ) );
    386386
    387         $post   = $this->factory->post->create_and_get();
     387        $post   = self::$factory->post->create_and_get();
    388388        $action = 'unfiltered-html-comment_' . $post->ID;
    389389        $nonce  = wp_create_nonce( $action );
     
    406406    public function test_privileged_user_cannot_comment_unfiltered_html_without_valid_nonce() {
    407407
    408         $user = $this->factory->user->create_and_get( array(
     408        $user = self::$factory->user->create_and_get( array(
    409409            'role' => 'editor',
    410410        ) );
     
    420420        $this->assertTrue( current_user_can( 'unfiltered_html' ) );
    421421
    422         $post   = $this->factory->post->create_and_get();
     422        $post   = self::$factory->post->create_and_get();
    423423        $data = array(
    424424            'comment_post_ID' => $post->ID,
     
    440440        update_option( 'comment_registration', '1' );
    441441
    442         $post = $this->factory->post->create_and_get();
     442        $post = self::$factory->post->create_and_get();
    443443        $data = array(
    444444            'comment_post_ID' => $post->ID,
     
    460460        update_option( 'require_name_email', '1' );
    461461
    462         $post = $this->factory->post->create_and_get();
     462        $post = self::$factory->post->create_and_get();
    463463        $data = array(
    464464            'comment_post_ID' => $post->ID,
     
    482482        update_option( 'require_name_email', '1' );
    483483
    484         $post = $this->factory->post->create_and_get();
     484        $post = self::$factory->post->create_and_get();
    485485        $data = array(
    486486            'comment_post_ID' => $post->ID,
     
    504504        update_option( 'require_name_email', '1' );
    505505
    506         $post = $this->factory->post->create_and_get();
     506        $post = self::$factory->post->create_and_get();
    507507        $data = array(
    508508            'comment_post_ID' => $post->ID,
     
    524524        $error = 'require_valid_comment';
    525525
    526         $post = $this->factory->post->create_and_get();
     526        $post = self::$factory->post->create_and_get();
    527527        $data = array(
    528528            'comment_post_ID' => $post->ID,
  • trunk/tests/phpunit/tests/comment.php

    r35224 r35225  
    2222
    2323    function test_wp_update_comment() {
    24         $post = $this->factory->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post' ) );
    25         $post2 = $this->factory->post->create_and_get( array( 'post_title' => 'some-post-2', 'post_type' => 'post' ) );
    26         $comments = $this->factory->comment->create_post_comments( $post->ID, 5 );
     24        $post = self::$factory->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post' ) );
     25        $post2 = self::$factory->post->create_and_get( array( 'post_title' => 'some-post-2', 'post_type' => 'post' ) );
     26        $comments = self::$factory->comment->create_post_comments( $post->ID, 5 );
    2727        $result = wp_update_comment( array( 'comment_ID' => $comments[0], 'comment_parent' => $comments[1] ) );
    2828        $this->assertEquals( 1, $result );
     
    4040     */
    4141    function test_wp_update_comment_updates_comment_type() {
    42         $comment_id = $this->factory->comment->create( array( 'comment_post_ID' => self::$post_id ) );
     42        $comment_id = self::$factory->comment->create( array( 'comment_post_ID' => self::$post_id ) );
    4343
    4444        wp_update_comment( array( 'comment_ID' => $comment_id, 'comment_type' => 'pingback' ) );
     
    5252     */
    5353    function test_wp_update_comment_updates_user_id() {
    54         $comment_id = $this->factory->comment->create( array( 'comment_post_ID' => self::$post_id ) );
     54        $comment_id = self::$factory->comment->create( array( 'comment_post_ID' => self::$post_id ) );
    5555
    5656        wp_update_comment( array( 'comment_ID' => $comment_id, 'user_id' => 1 ) );
     
    6161
    6262    public function test_get_approved_comments() {
    63         $ca1 = $this->factory->comment->create( array(
     63        $ca1 = self::$factory->comment->create( array(
    6464            'comment_post_ID' => self::$post_id, 'comment_approved' => '1'
    6565        ) );
    66         $ca2 = $this->factory->comment->create( array(
     66        $ca2 = self::$factory->comment->create( array(
    6767            'comment_post_ID' => self::$post_id, 'comment_approved' => '1'
    6868        ) );
    69         $ca3 = $this->factory->comment->create( array(
     69        $ca3 = self::$factory->comment->create( array(
    7070            'comment_post_ID' => self::$post_id, 'comment_approved' => '0'
    7171        ) );
    72         $c2 = $this->factory->comment->create( array(
     72        $c2 = self::$factory->comment->create( array(
    7373            'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback'
    7474        ) );
    75         $c3 = $this->factory->comment->create( array(
     75        $c3 = self::$factory->comment->create( array(
    7676            'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback'
    7777        ) );
    78         $c4 = $this->factory->comment->create( array(
     78        $c4 = self::$factory->comment->create( array(
    7979            'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario'
    8080        ) );
    81         $c5 = $this->factory->comment->create( array(
     81        $c5 = self::$factory->comment->create( array(
    8282            'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'luigi'
    8383        ) );
     
    9393     */
    9494    public function test_get_approved_comments_with_post_id_0_should_return_empty_array() {
    95         $ca1 = $this->factory->comment->create( array(
     95        $ca1 = self::$factory->comment->create( array(
    9696            'comment_post_ID' => self::$post_id, 'comment_approved' => '1'
    9797        ) );
     
    257257     */
    258258    public function test_wp_notify_moderator_should_not_throw_notice_when_post_author_is_0() {
    259         $p = $this->factory->post->create( array(
     259        $p = self::$factory->post->create( array(
    260260            'post_author' => 0,
    261261        ) );
    262262
    263         $c = $this->factory->comment->create( array(
     263        $c = self::$factory->comment->create( array(
    264264            'comment_post_ID' => $p,
    265265        ) );
     
    272272     */
    273273    public function test_wp_new_comment_notify_postauthor_should_not_send_email_when_comment_has_been_marked_as_spam() {
    274         $c = $this->factory->comment->create( array(
     274        $c = self::$factory->comment->create( array(
    275275            'comment_post_ID' => self::$post_id,
    276276            'comment_approved' => 'spam',
     
    285285     */
    286286    public function test_wp_new_comment_with_meta() {
    287         $c = $this->factory->comment->create( array(
     287        $c = self::$factory->comment->create( array(
    288288            'comment_approved' => '1',
    289289            'comment_meta' => array(
     
    300300     */
    301301    public function test_wp_comment_get_children_should_fill_children() {
    302         $c1 = $this->factory->comment->create( array(
    303             'comment_post_ID' => self::$post_id,
    304             'comment_approved' => '1',
    305         ) );
    306 
    307         $c2 = $this->factory->comment->create( array(
     302        $c1 = self::$factory->comment->create( array(
     303            'comment_post_ID' => self::$post_id,
     304            'comment_approved' => '1',
     305        ) );
     306
     307        $c2 = self::$factory->comment->create( array(
    308308            'comment_post_ID' => self::$post_id,
    309309            'comment_approved' => '1',
     
    311311        ) );
    312312
    313         $c3 = $this->factory->comment->create( array(
     313        $c3 = self::$factory->comment->create( array(
    314314            'comment_post_ID' => self::$post_id,
    315315            'comment_approved' => '1',
     
    317317        ) );
    318318
    319         $c4 = $this->factory->comment->create( array(
     319        $c4 = self::$factory->comment->create( array(
    320320            'comment_post_ID' => self::$post_id,
    321321            'comment_approved' => '1',
     
    323323        ) );
    324324
    325         $c5 = $this->factory->comment->create( array(
    326             'comment_post_ID' => self::$post_id,
    327             'comment_approved' => '1',
    328         ) );
    329 
    330         $c6 = $this->factory->comment->create( array(
     325        $c5 = self::$factory->comment->create( array(
     326            'comment_post_ID' => self::$post_id,
     327            'comment_approved' => '1',
     328        ) );
     329
     330        $c6 = self::$factory->comment->create( array(
    331331            'comment_post_ID' => self::$post_id,
    332332            'comment_approved' => '1',
     
    348348     */
    349349    public function test_post_properties_should_be_lazyloaded() {
    350         $c = $this->factory->comment->create( array( 'comment_post_ID' => self::$post_id ) );
     350        $c = self::$factory->comment->create( array( 'comment_post_ID' => self::$post_id ) );
    351351
    352352        $post = get_post( self::$post_id );
  • trunk/tests/phpunit/tests/comment/checkComment.php

    r32519 r35225  
    3232
    3333    public function test_should_return_true_when_comment_whitelist_is_enabled_and_author_has_approved_comment() {
    34         $post_id = $this->factory->post->create();
     34        $post_id = self::$factory->post->create();
    3535        $prev_args = array(
    3636            'comment_post_ID'      => $post_id,
     
    4040            'comment_author'       => 'BobtheBuilder',
    4141        );
    42         $prev_comment_id = $this->factory->comment->create( $prev_args );
     42        $prev_comment_id = self::$factory->comment->create( $prev_args );
    4343
    4444        update_option( 'comment_whitelist', 1 );
  • trunk/tests/phpunit/tests/comment/commentForm.php

    r32511 r35225  
    66class Tests_Comment_CommentForm extends WP_UnitTestCase {
    77    public function test_default_markup_for_submit_button_and_wrapper() {
    8         $p = $this->factory->post->create();
     8        $p = self::$factory->post->create();
    99
    1010        $args = array(
     
    2222
    2323    public function test_custom_submit_button() {
    24         $p = $this->factory->post->create();
     24        $p = self::$factory->post->create();
    2525
    2626        $args = array(
     
    3838
    3939    public function test_custom_submit_field() {
    40         $p = $this->factory->post->create();
     40        $p = self::$factory->post->create();
    4141
    4242        $args = array(
     
    5858     */
    5959    public function test_submit_button_and_submit_field_should_fall_back_on_defaults_when_filtered_defaults_do_not_contain_the_keys() {
    60         $p = $this->factory->post->create();
     60        $p = self::$factory->post->create();
    6161
    6262        $args = array(
  • trunk/tests/phpunit/tests/comment/commentsTemplate.php

    r34802 r35225  
    1313    public function test_should_respect_comment_order_asc_when_default_comments_page_is_newest() {
    1414        $now = time();
    15         $p = $this->factory->post->create();
    16         $comment_1 = $this->factory->comment->create( array(
    17             'comment_post_ID' => $p,
    18             'comment_content' => '1',
    19             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    20         ) );
    21         $comment_2 = $this->factory->comment->create( array(
     15        $p = self::$factory->post->create();
     16        $comment_1 = self::$factory->comment->create( array(
     17            'comment_post_ID' => $p,
     18            'comment_content' => '1',
     19            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
     20        ) );
     21        $comment_2 = self::$factory->comment->create( array(
    2222            'comment_post_ID' => $p,
    2323            'comment_content' => '2',
     
    4343    public function test_should_respect_comment_order_desc_when_default_comments_page_is_newest() {
    4444        $now = time();
    45         $p = $this->factory->post->create();
    46         $comment_1 = $this->factory->comment->create( array(
    47             'comment_post_ID' => $p,
    48             'comment_content' => '1',
    49             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    50         ) );
    51         $comment_2 = $this->factory->comment->create( array(
     45        $p = self::$factory->post->create();
     46        $comment_1 = self::$factory->comment->create( array(
     47            'comment_post_ID' => $p,
     48            'comment_content' => '1',
     49            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
     50        ) );
     51        $comment_2 = self::$factory->comment->create( array(
    5252            'comment_post_ID' => $p,
    5353            'comment_content' => '2',
     
    7373    public function test_should_respect_comment_order_asc_when_default_comments_page_is_oldest() {
    7474        $now = time();
    75         $p = $this->factory->post->create();
    76         $comment_1 = $this->factory->comment->create( array(
    77             'comment_post_ID' => $p,
    78             'comment_content' => '1',
    79             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    80         ) );
    81         $comment_2 = $this->factory->comment->create( array(
     75        $p = self::$factory->post->create();
     76        $comment_1 = self::$factory->comment->create( array(
     77            'comment_post_ID' => $p,
     78            'comment_content' => '1',
     79            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
     80        ) );
     81        $comment_2 = self::$factory->comment->create( array(
    8282            'comment_post_ID' => $p,
    8383            'comment_content' => '2',
     
    103103    public function test_should_respect_comment_order_desc_when_default_comments_page_is_oldest() {
    104104        $now = time();
    105         $p = $this->factory->post->create();
    106         $comment_1 = $this->factory->comment->create( array(
    107             'comment_post_ID' => $p,
    108             'comment_content' => '1',
    109             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    110         ) );
    111         $comment_2 = $this->factory->comment->create( array(
     105        $p = self::$factory->post->create();
     106        $comment_1 = self::$factory->comment->create( array(
     107            'comment_post_ID' => $p,
     108            'comment_content' => '1',
     109            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
     110        ) );
     111        $comment_2 = self::$factory->comment->create( array(
    112112            'comment_post_ID' => $p,
    113113            'comment_content' => '2',
     
    133133    public function test_should_respect_comment_order_asc_when_default_comments_page_is_newest_on_subsequent_pages() {
    134134        $now = time();
    135         $p = $this->factory->post->create();
    136         $comment_1 = $this->factory->comment->create( array(
    137             'comment_post_ID' => $p,
    138             'comment_content' => '1',
    139             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    140         ) );
    141         $comment_2 = $this->factory->comment->create( array(
    142             'comment_post_ID' => $p,
    143             'comment_content' => '2',
    144             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    145         ) );
    146         $comment_3 = $this->factory->comment->create( array(
    147             'comment_post_ID' => $p,
    148             'comment_content' => '3',
    149             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
    150         ) );
    151         $comment_4 = $this->factory->comment->create( array(
     135        $p = self::$factory->post->create();
     136        $comment_1 = self::$factory->comment->create( array(
     137            'comment_post_ID' => $p,
     138            'comment_content' => '1',
     139            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
     140        ) );
     141        $comment_2 = self::$factory->comment->create( array(
     142            'comment_post_ID' => $p,
     143            'comment_content' => '2',
     144            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
     145        ) );
     146        $comment_3 = self::$factory->comment->create( array(
     147            'comment_post_ID' => $p,
     148            'comment_content' => '3',
     149            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
     150        ) );
     151        $comment_4 = self::$factory->comment->create( array(
    152152            'comment_post_ID' => $p,
    153153            'comment_content' => '4',
    154154            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ),
    155155        ) );
    156         $comment_5 = $this->factory->comment->create( array(
     156        $comment_5 = self::$factory->comment->create( array(
    157157            'comment_post_ID' => $p,
    158158            'comment_content' => '3',
    159159            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 500 ),
    160160        ) );
    161         $comment_6 = $this->factory->comment->create( array(
     161        $comment_6 = self::$factory->comment->create( array(
    162162            'comment_post_ID' => $p,
    163163            'comment_content' => '4',
     
    188188    public function test_should_respect_comment_order_desc_when_default_comments_page_is_newest_on_subsequent_pages() {
    189189        $now = time();
    190         $p = $this->factory->post->create();
    191         $comment_1 = $this->factory->comment->create( array(
    192             'comment_post_ID' => $p,
    193             'comment_content' => '1',
    194             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    195         ) );
    196         $comment_2 = $this->factory->comment->create( array(
    197             'comment_post_ID' => $p,
    198             'comment_content' => '2',
    199             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    200         ) );
    201         $comment_3 = $this->factory->comment->create( array(
    202             'comment_post_ID' => $p,
    203             'comment_content' => '3',
    204             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
    205         ) );
    206         $comment_4 = $this->factory->comment->create( array(
     190        $p = self::$factory->post->create();
     191        $comment_1 = self::$factory->comment->create( array(
     192            'comment_post_ID' => $p,
     193            'comment_content' => '1',
     194            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
     195        ) );
     196        $comment_2 = self::$factory->comment->create( array(
     197            'comment_post_ID' => $p,
     198            'comment_content' => '2',
     199            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
     200        ) );
     201        $comment_3 = self::$factory->comment->create( array(
     202            'comment_post_ID' => $p,
     203            'comment_content' => '3',
     204            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
     205        ) );
     206        $comment_4 = self::$factory->comment->create( array(
    207207            'comment_post_ID' => $p,
    208208            'comment_content' => '4',
    209209            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ),
    210210        ) );
    211         $comment_5 = $this->factory->comment->create( array(
     211        $comment_5 = self::$factory->comment->create( array(
    212212            'comment_post_ID' => $p,
    213213            'comment_content' => '3',
    214214            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 500 ),
    215215        ) );
    216         $comment_6 = $this->factory->comment->create( array(
     216        $comment_6 = self::$factory->comment->create( array(
    217217            'comment_post_ID' => $p,
    218218            'comment_content' => '4',
     
    243243    public function test_should_respect_comment_order_asc_when_default_comments_page_is_oldest_on_subsequent_pages() {
    244244        $now = time();
    245         $p = $this->factory->post->create();
    246         $comment_1 = $this->factory->comment->create( array(
    247             'comment_post_ID' => $p,
    248             'comment_content' => '1',
    249             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    250         ) );
    251         $comment_2 = $this->factory->comment->create( array(
    252             'comment_post_ID' => $p,
    253             'comment_content' => '2',
    254             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    255         ) );
    256         $comment_3 = $this->factory->comment->create( array(
    257             'comment_post_ID' => $p,
    258             'comment_content' => '3',
    259             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
    260         ) );
    261         $comment_4 = $this->factory->comment->create( array(
     245        $p = self::$factory->post->create();
     246        $comment_1 = self::$factory->comment->create( array(
     247            'comment_post_ID' => $p,
     248            'comment_content' => '1',
     249            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
     250        ) );
     251        $comment_2 = self::$factory->comment->create( array(
     252            'comment_post_ID' => $p,
     253            'comment_content' => '2',
     254            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
     255        ) );
     256        $comment_3 = self::$factory->comment->create( array(
     257            'comment_post_ID' => $p,
     258            'comment_content' => '3',
     259            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
     260        ) );
     261        $comment_4 = self::$factory->comment->create( array(
    262262            'comment_post_ID' => $p,
    263263            'comment_content' => '4',
     
    288288    public function test_should_respect_comment_order_desc_when_default_comments_page_is_oldest_on_subsequent_pages() {
    289289        $now = time();
    290         $p = $this->factory->post->create();
    291         $comment_1 = $this->factory->comment->create( array(
    292             'comment_post_ID' => $p,
    293             'comment_content' => '1',
    294             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    295         ) );
    296         $comment_2 = $this->factory->comment->create( array(
    297             'comment_post_ID' => $p,
    298             'comment_content' => '2',
    299             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    300         ) );
    301         $comment_3 = $this->factory->comment->create( array(
    302             'comment_post_ID' => $p,
    303             'comment_content' => '3',
    304             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
    305         ) );
    306         $comment_4 = $this->factory->comment->create( array(
     290        $p = self::$factory->post->create();
     291        $comment_1 = self::$factory->comment->create( array(
     292            'comment_post_ID' => $p,
     293            'comment_content' => '1',
     294            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
     295        ) );
     296        $comment_2 = self::$factory->comment->create( array(
     297            'comment_post_ID' => $p,
     298            'comment_content' => '2',
     299            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
     300        ) );
     301        $comment_3 = self::$factory->comment->create( array(
     302            'comment_post_ID' => $p,
     303            'comment_content' => '3',
     304            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
     305        ) );
     306        $comment_4 = self::$factory->comment->create( array(
    307307            'comment_post_ID' => $p,
    308308            'comment_content' => '4',
     
    335335    public function test_last_page_of_comments_should_be_full_when_default_comment_page_is_newest() {
    336336        $now = time();
    337         $p = $this->factory->post->create();
    338         $comment_1 = $this->factory->comment->create( array(
    339             'comment_post_ID' => $p,
    340             'comment_content' => '1',
    341             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    342         ) );
    343         $comment_2 = $this->factory->comment->create( array(
    344             'comment_post_ID' => $p,
    345             'comment_content' => '2',
    346             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    347         ) );
    348         $comment_3 = $this->factory->comment->create( array(
     337        $p = self::$factory->post->create();
     338        $comment_1 = self::$factory->comment->create( array(
     339            'comment_post_ID' => $p,
     340            'comment_content' => '1',
     341            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
     342        ) );
     343        $comment_2 = self::$factory->comment->create( array(
     344            'comment_post_ID' => $p,
     345            'comment_content' => '2',
     346            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
     347        ) );
     348        $comment_3 = self::$factory->comment->create( array(
    349349            'comment_post_ID' => $p,
    350350            'comment_content' => '3',
     
    377377    public function test_first_page_of_comments_should_have_remainder_when_default_comments_page_is_newest() {
    378378        $now = time();
    379         $p = $this->factory->post->create();
    380         $comment_1 = $this->factory->comment->create( array(
    381             'comment_post_ID' => $p,
    382             'comment_content' => '1',
    383             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    384         ) );
    385         $comment_2 = $this->factory->comment->create( array(
    386             'comment_post_ID' => $p,
    387             'comment_content' => '2',
    388             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    389         ) );
    390         $comment_3 = $this->factory->comment->create( array(
     379        $p = self::$factory->post->create();
     380        $comment_1 = self::$factory->comment->create( array(
     381            'comment_post_ID' => $p,
     382            'comment_content' => '1',
     383            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
     384        ) );
     385        $comment_2 = self::$factory->comment->create( array(
     386            'comment_post_ID' => $p,
     387            'comment_content' => '2',
     388            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
     389        ) );
     390        $comment_3 = self::$factory->comment->create( array(
    391391            'comment_post_ID' => $p,
    392392            'comment_content' => '3',
     
    417417    public function test_comment_permalinks_should_be_correct_when_using_default_display_callback_with_default_comment_page_oldest() {
    418418        $now = time();
    419         $p = $this->factory->post->create();
    420         $comment_1 = $this->factory->comment->create( array(
    421             'comment_post_ID' => $p,
    422             'comment_content' => '1',
    423             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    424         ) );
    425         $comment_2 = $this->factory->comment->create( array(
    426             'comment_post_ID' => $p,
    427             'comment_content' => '2',
    428             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    429         ) );
    430         $comment_3 = $this->factory->comment->create( array(
    431             'comment_post_ID' => $p,
    432             'comment_content' => '3',
    433             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
    434         ) );
    435         $comment_4 = $this->factory->comment->create( array(
     419        $p = self::$factory->post->create();
     420        $comment_1 = self::$factory->comment->create( array(
     421            'comment_post_ID' => $p,
     422            'comment_content' => '1',
     423            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
     424        ) );
     425        $comment_2 = self::$factory->comment->create( array(
     426            'comment_post_ID' => $p,
     427            'comment_content' => '2',
     428            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
     429        ) );
     430        $comment_3 = self::$factory->comment->create( array(
     431            'comment_post_ID' => $p,
     432            'comment_content' => '3',
     433            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
     434        ) );
     435        $comment_4 = self::$factory->comment->create( array(
    436436            'comment_post_ID' => $p,
    437437            'comment_content' => '4',
     
    481481    public function test_comment_permalinks_should_be_correct_when_using_default_display_callback_with_default_comment_page_newest() {
    482482        $now = time();
    483         $p = $this->factory->post->create();
    484         $comment_1 = $this->factory->comment->create( array(
    485             'comment_post_ID' => $p,
    486             'comment_content' => '1',
    487             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    488         ) );
    489         $comment_2 = $this->factory->comment->create( array(
    490             'comment_post_ID' => $p,
    491             'comment_content' => '2',
    492             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    493         ) );
    494         $comment_3 = $this->factory->comment->create( array(
    495             'comment_post_ID' => $p,
    496             'comment_content' => '3',
    497             'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
    498         ) );
    499         $comment_4 = $this->factory->comment->create( array(
     483        $p = self::$factory->post->create();
     484        $comment_1 = self::$factory->comment->create( array(
     485            'comment_post_ID' => $p,
     486            'comment_content' => '1',
     487            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
     488        ) );
     489        $comment_2 = self::$factory->comment->create( array(
     490            'comment_post_ID' => $p,
     491            'comment_content' => '2',
     492            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
     493        ) );
     494        $comment_3 = self::$factory->comment->create( array(
     495            'comment_post_ID' => $p,
     496            'comment_content' => '3',
     497            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
     498        ) );
     499        $comment_4 = self::$factory->comment->create( array(
    500500            'comment_post_ID' => $p,
    501501            'comment_content' => '4',
    502502            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ),
    503503        ) );
    504         $comment_5 = $this->factory->comment->create( array(
     504        $comment_5 = self::$factory->comment->create( array(
    505505            'comment_post_ID' => $p,
    506506            'comment_content' => '4',
    507507            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 500 ),
    508508        ) );
    509         $comment_6 = $this->factory->comment->create( array(
     509        $comment_6 = self::$factory->comment->create( array(
    510510            'comment_post_ID' => $p,
    511511            'comment_content' => '4',
  • trunk/tests/phpunit/tests/comment/dateQuery.php

    r25139 r35225  
    2323        // Just some dummy posts to use as parents for comments
    2424        for ( $i = 1; $i <= 2; $i++ ) {
    25             $this->posts[$i] = $this->factory->post->create();
     25            $this->posts[$i] = self::$factory->post->create();
    2626        }
    2727
     
    4040
    4141        foreach ( $comment_dates as $comment_date => $comment_parent ) {
    42             $result = $this->factory->comment->create( array(
     42            $result = self::$factory->comment->create( array(
    4343                'comment_date'    => $comment_date,
    4444                'comment_post_ID' => $this->posts[ $comment_parent ],
  • trunk/tests/phpunit/tests/comment/getCommentClass.php

    r34454 r35225  
    66class Tests_Comment_GetCommentClass extends WP_UnitTestCase {
    77    public function test_should_accept_comment_id() {
    8         $post_id    = $this->factory->post->create();
    9         $comment_id = $this->factory->comment->create( array( 'comment_post_ID' => $post_id ) );
     8        $post_id    = self::$factory->post->create();
     9        $comment_id = self::$factory->comment->create( array( 'comment_post_ID' => $post_id ) );
    1010
    1111        $classes = get_comment_class( '', $comment_id );
     
    1414
    1515    public function test_should_accept_comment_object() {
    16         $post_id = $this->factory->post->create();
    17         $comment = $this->factory->comment->create_and_get( array( 'comment_post_ID' => $post_id ) );
     16        $post_id = self::$factory->post->create();
     17        $comment = self::$factory->comment->create_and_get( array( 'comment_post_ID' => $post_id ) );
    1818
    1919        $classes = get_comment_class( '', $comment );
     
    2222
    2323    public function test_should_append_single_class() {
    24         $post_id    = $this->factory->post->create();
    25         $comment_id = $this->factory->comment->create( array( 'comment_post_ID' => $post_id ) );
     24        $post_id    = self::$factory->post->create();
     25        $comment_id = self::$factory->comment->create( array( 'comment_post_ID' => $post_id ) );
    2626
    2727        $classes = get_comment_class( 'foo', $comment_id );
     
    3030
    3131    public function test_should_append_array_of_classes() {
    32         $post_id    = $this->factory->post->create();
    33         $comment_id = $this->factory->comment->create( array( 'comment_post_ID' => $post_id ) );
     32        $post_id    = self::$factory->post->create();
     33        $comment_id = self::$factory->comment->create( array( 'comment_post_ID' => $post_id ) );
    3434
    3535        $classes = get_comment_class( array( 'foo', 'bar' ), $comment_id );
  • trunk/tests/phpunit/tests/comment/getCommentCount.php

    r33822 r35225  
    1515
    1616    public function test_get_comment_count_approved() {
    17         $this->factory->comment->create( array(
     17        self::$factory->comment->create( array(
    1818            'comment_approved' => 1
    1919        ) );
     
    3030
    3131    public function test_get_comment_count_awaiting() {
    32         $this->factory->comment->create( array(
     32        self::$factory->comment->create( array(
    3333            'comment_approved' => 0
    3434        ) );
     
    4545
    4646    public function test_get_comment_count_spam() {
    47         $this->factory->comment->create( array(
     47        self::$factory->comment->create( array(
    4848            'comment_approved' => 'spam'
    4949        ) );
     
    6060
    6161    public function test_get_comment_count_trash() {
    62         $this->factory->comment->create( array(
     62        self::$factory->comment->create( array(
    6363            'comment_approved' => 'trash'
    6464        ) );
     
    7575
    7676    public function test_get_comment_count_post_trashed() {
    77         $this->factory->comment->create( array(
     77        self::$factory->comment->create( array(
    7878            'comment_approved' => 'post-trashed'
    7979        ) );
  • trunk/tests/phpunit/tests/comment/getCommentExcerpt.php

    r34520 r35225  
    1515
    1616    public function test_get_comment_excerpt() {
    17         $comment_id = $this->factory->comment->create( array(
     17        $comment_id = self::$factory->comment->create( array(
    1818            'comment_content' => self::$bacon_comment
    1919        ) );
     
    2525
    2626    public function test_get_comment_excerpt_filtered() {
    27         $comment_id = $this->factory->comment->create( array(
     27        $comment_id = self::$factory->comment->create( array(
    2828            'comment_content' => self::$bacon_comment
    2929        ) );
  • trunk/tests/phpunit/tests/comment/getCommentLink.php

    r34735 r35225  
    1212
    1313        $now = time();
    14         $this->p = $this->factory->post->create();
    15         $this->comments[] = $this->factory->comment->create( array(
     14        $this->p = self::$factory->post->create();
     15        $this->comments[] = self::$factory->comment->create( array(
    1616            'comment_post_ID' => $this->p,
    1717            'comment_content' => '1',
    1818            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    1919        ) );
    20         $this->comments[] = $this->factory->comment->create( array(
     20        $this->comments[] = self::$factory->comment->create( array(
    2121            'comment_post_ID' => $this->p,
    2222            'comment_content' => '2',
    2323            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    2424        ) );
    25         $this->comments[] = $this->factory->comment->create( array(
     25        $this->comments[] = self::$factory->comment->create( array(
    2626            'comment_post_ID' => $this->p,
    2727            'comment_content' => '3',
    2828            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
    2929        ) );
    30         $this->comments[] = $this->factory->comment->create( array(
     30        $this->comments[] = self::$factory->comment->create( array(
    3131            'comment_post_ID' => $this->p,
    3232            'comment_content' => '4',
    3333            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ),
    3434        ) );
    35         $this->comments[] = $this->factory->comment->create( array(
     35        $this->comments[] = self::$factory->comment->create( array(
    3636            'comment_post_ID' => $this->p,
    3737            'comment_content' => '4',
    3838            'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 500 ),
    3939        ) );
    40         $this->comments[] = $this->factory->comment->create( array(
     40        $this->comments[] = self::$factory->comment->create( array(
    4141            'comment_post_ID' => $this->p,
    4242            'comment_content' => '4',
  • trunk/tests/phpunit/tests/comment/getCommentsPagesCount.php

    r34561 r35225  
    3939    function test_empty() {
    4040        //setup post and comments
    41         $post_id = $this->factory->post->create( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) );
     41        $post_id = self::$factory->post->create( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) );
    4242        $this->go_to( '/?p=' . $post_id );
    4343
     
    6161    function test_threaded_comments( ) {
    6262        //setup post and comments
    63         $post = $this->factory->post->create_and_get( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) );
    64         $comments = $this->factory->comment->create_post_comments( $post->ID, 15 );
    65         $this->factory->comment->create_post_comments( $post->ID, 6, array( 'comment_parent' => $comments[0] ) );
     63        $post = self::$factory->post->create_and_get( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) );
     64        $comments = self::$factory->comment->create_post_comments( $post->ID, 15 );
     65        self::$factory->comment->create_post_comments( $post->ID, 6, array( 'comment_parent' => $comments[0] ) );
    6666        $comments = get_comments( array( 'post_id' => $post->ID ) );
    6767
     
    7777
    7878        //setup post and comments
    79         $post = $this->factory->post->create_and_get( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) );
    80         $comments = $this->factory->comment->create_post_comments( $post->ID, 15 );
    81         $this->factory->comment->create_post_comments( $post->ID, 6, array('comment_parent' => $comments[0] ) );
     79        $post = self::$factory->post->create_and_get( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) );
     80        $comments = self::$factory->comment->create_post_comments( $post->ID, 15 );
     81        self::$factory->comment->create_post_comments( $post->ID, 6, array('comment_parent' => $comments[0] ) );
    8282        $comments = get_comments( array( 'post_id' => $post->ID ) );
    8383
     
    105105        update_option( 'posts_per_rss', 100 );
    106106
    107         $post = $this->factory->post->create_and_get( array( 'post_title' => 'comment-post', 'post_type' => 'post' ) );
    108         $comments = $this->factory->comment->create_post_comments( $post->ID, 25 );
     107        $post = self::$factory->post->create_and_get( array( 'post_title' => 'comment-post', 'post_type' => 'post' ) );
     108        $comments = self::$factory->comment->create_post_comments( $post->ID, 25 );
    109109
    110110        $wp_query = new WP_Query( array( 'p' => $post->ID, 'comments_per_page' => 10, 'feed' =>'comments-' ) );
  • trunk/tests/phpunit/tests/comment/getPageOfComment.php

    r34828 r35225  
    88
    99    public function test_last_comment() {
    10         $p = $this->factory->post->create();
     10        $p = self::$factory->post->create();
    1111
    1212        // page 4
    13         $comment_last = $this->factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-24 00:00:00' ) );
    14         $this->factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-23 00:00:00' ) );
     13        $comment_last = self::$factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-24 00:00:00' ) );
     14        self::$factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-23 00:00:00' ) );
    1515
    1616        // page 3
    17         $this->factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-22 00:00:00' ) );
    18         $this->factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-21 00:00:00' ) );
    19         $this->factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-20 00:00:00' ) );
     17        self::$factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-22 00:00:00' ) );
     18        self::$factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-21 00:00:00' ) );
     19        self::$factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-20 00:00:00' ) );
    2020
    2121        // page 2
    22         $this->factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-19 00:00:00' ) );
    23         $this->factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-18 00:00:00' ) );
    24         $this->factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-17 00:00:00' ) );
     22        self::$factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-19 00:00:00' ) );
     23        self::$factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-18 00:00:00' ) );
     24        self::$factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-17 00:00:00' ) );
    2525
    2626        // page 1
    27         $this->factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-16 00:00:00' ) );
    28         $this->factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-15 00:00:00' ) );
    29         $comment_first = $this->factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-14 00:00:00' ) );
     27        self::$factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-16 00:00:00' ) );
     28        self::$factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-15 00:00:00' ) );
     29        $comment_first = self::$factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-14 00:00:00' ) );
    3030
    3131        $this->assertEquals( 4, get_page_of_comment( $comment_last[0],  array( 'per_page' =>  3 ) ) );
     
    3737
    3838    public function test_type_pings() {
    39         $p = $this->factory->post->create();
     39        $p = self::$factory->post->create();
    4040        $now = time();
    4141
    4242        $trackbacks = array();
    4343        for ( $i = 0; $i <= 3; $i++ ) {
    44             $trackbacks[ $i ] = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_type' => 'trackback', 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ) ) );
     44            $trackbacks[ $i ] = self::$factory->comment->create( array( 'comment_post_ID' => $p, 'comment_type' => 'trackback', 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ) ) );
    4545            $now -= 10 * $i;
    4646        }
     
    4848        $pingbacks = array();
    4949        for ( $i = 0; $i <= 6; $i++ ) {
    50             $pingbacks[ $i ] = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_type' => 'pingback', 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ) ) );
     50            $pingbacks[ $i ] = self::$factory->comment->create( array( 'comment_post_ID' => $p, 'comment_type' => 'pingback', 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ) ) );
    5151            $now -= 10 * $i;
    5252        }
     
    6363        global $wpdb;
    6464
    65         $p = $this->factory->post->create();
    66         $c = $this->factory->comment->create( array( 'comment_post_ID' => $p ) );
     65        $p = self::$factory->post->create();
     66        $c = self::$factory->comment->create( array( 'comment_post_ID' => $p ) );
    6767
    6868        // Prime cache.
     
    8282        global $wpdb;
    8383
    84         $p = $this->factory->post->create();
    85         $comment = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_type' => 'comment' ) );
     84        $p = self::$factory->post->create();
     85        $comment = self::$factory->comment->create( array( 'comment_post_ID' => $p, 'comment_type' => 'comment' ) );
    8686
    8787        $now = time();
    8888        $trackbacks = array();
    8989        for ( $i = 0; $i <= 5; $i++ ) {
    90             $trackbacks[ $i ] = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_type' => 'trackback', 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( 10 * $i ) ) ) );
     90            $trackbacks[ $i ] = self::$factory->comment->create( array( 'comment_post_ID' => $p, 'comment_type' => 'trackback', 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( 10 * $i ) ) ) );
    9191        }
    9292
     
    106106     */
    107107    public function test_cache_should_be_invalidated_when_comment_is_approved() {
    108         $p = $this->factory->post->create();
    109         $c = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_approved' => 0 ) );
     108        $p = self::$factory->post->create();
     109        $c = self::$factory->comment->create( array( 'comment_post_ID' => $p, 'comment_approved' => 0 ) );
    110110
    111111        // Prime cache.
     
    122122     */
    123123    public function test_cache_should_be_invalidated_when_comment_is_deleted() {
    124         $p = $this->factory->post->create();
    125         $c = $this->factory->comment->create( array( 'comment_post_ID' => $p ) );
     124        $p = self::$factory->post->create();
     125        $c = self::$factory->comment->create( array( 'comment_post_ID' => $p ) );
    126126
    127127        // Prime cache.
     
    138138     */
    139139    public function test_cache_should_be_invalidated_when_comment_is_spammed() {
    140         $p = $this->factory->post->create();
    141         $c = $this->factory->comment->create( array( 'comment_post_ID' => $p ) );
     140        $p = self::$factory->post->create();
     141        $c = self::$factory->comment->create( array( 'comment_post_ID' => $p ) );
    142142
    143143        // Prime cache.
     
    156156        $now = time();
    157157
    158         $p = $this->factory->post->create();
    159         $c1 = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ) ) );
    160         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 20 ) ) );
    161         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_approved' => 0, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 30 ) ) );
     158        $p = self::$factory->post->create();
     159        $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ) ) );
     160        $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 20 ) ) );
     161        $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $p, 'comment_approved' => 0, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 30 ) ) );
    162162
    163163        $this->assertEquals( 1, get_page_of_comment( $c1, array( 'per_page' => 2 ) ) );
     
    172172     */
    173173    public function test_query_should_be_limited_to_comments_on_the_proper_post() {
    174         $posts = $this->factory->post->create_many( 2 );
     174        $posts = self::$factory->post->create_many( 2 );
    175175
    176176        $now = time();
    177177        $comments_0 = $comments_1 = array();
    178178        for ( $i = 0; $i < 5; $i++ ) {
    179             $comments_0[] = $this->factory->comment->create( array( 'comment_post_ID' => $posts[0], 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( $i * 60 ) ) ) );
    180             $comments_1[] = $this->factory->comment->create( array( 'comment_post_ID' => $posts[1], 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( $i * 60 ) ) ) );
     179            $comments_0[] = self::$factory->comment->create( array( 'comment_post_ID' => $posts[0], 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( $i * 60 ) ) ) );
     180            $comments_1[] = self::$factory->comment->create( array( 'comment_post_ID' => $posts[1], 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( $i * 60 ) ) ) );
    181181        }
    182182
     
    192192     */
    193193    public function test_only_top_level_comments_should_be_included_in_older_count() {
    194         $post = $this->factory->post->create();
     194        $post = self::$factory->post->create();
    195195
    196196        $now = time();
    197197        $comment_parents = $comment_children = array();
    198198        for ( $i = 0; $i < 5; $i++ ) {
    199             $parent = $this->factory->comment->create( array( 'comment_post_ID' => $post, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( $i * 60 ) ) ) );
     199            $parent = self::$factory->comment->create( array( 'comment_post_ID' => $post, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( $i * 60 ) ) ) );
    200200            $comment_parents[ $i ] = $parent;
    201201
    202             $child = $this->factory->comment->create( array( 'comment_post_ID' => $post, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( $i * 59 ) ), 'comment_parent' => $parent ) );
     202            $child = self::$factory->comment->create( array( 'comment_post_ID' => $post, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( $i * 59 ) ), 'comment_parent' => $parent ) );
    203203            $comment_children[ $i ] = $child;
    204204        }
     
    229229        $now = time();
    230230
    231         $p = $this->factory->post->create();
    232         $c1 = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ) ) );
    233         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 20 ) ) );
    234         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 30 ) ) );
     231        $p = self::$factory->post->create();
     232        $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ) ) );
     233        $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 20 ) ) );
     234        $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 30 ) ) );
    235235
    236236        update_option( 'comments_per_page', 2 );
  • trunk/tests/phpunit/tests/comment/metaCache.php

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

    r35192 r35225  
    1313        parent::setUp();
    1414
    15         $this->post_id = $this->factory->post->create();
     15        $this->post_id = self::$factory->post->create();
    1616    }
    1717
    1818    public function test_query() {
    19         $c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    20         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    21         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    22         $c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    23         $c5 = $this->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 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    50         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    51         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    52         $c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    53         $c5 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    69         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    70         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    71         $c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    72         $c5 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    85         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    86         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    87         $c4 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    101         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    102         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    103         $c4 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    120         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    121         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    122         $c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    123         $c5 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    140         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    141         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    142         $c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    143         $c5 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    144         $c6 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    160         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    161         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    162         $c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    163         $c5 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    164         $c6 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    180         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    181         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    182         $c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    183         $c5 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    184         $c6 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    201         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    202         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    203         $c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    204         $c5 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    205         $c6 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    222         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    223         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    224         $c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    225         $c5 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    226         $c6 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    242         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    243         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    244         $c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    245         $c5 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    261         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    262         $c3 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    278         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    279         $c3 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    295         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    296         $c3 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    312         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    313         $c3 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    329         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    330         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    331         $c4 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    348         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    349         $c3 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    365         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    366         $c3 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    382         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    383         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    384         $c4 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    401         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
    402         $c3 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    418         $c2 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    434         $c2 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    447         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
    448         $c3 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    461         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
    462         $c3 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    475         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
    476         $c3 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    491         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
    492         $c3 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    508         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
    509         $c3 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    525         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
    526         $c3 = $this->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 = $this->factory->post->create();
    541         $this->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 = $this->factory->post->create();
    549         $this->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 = $this->factory->post->create();
    557         $this->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         $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
    586         $comment_id2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
    587         $comment_id3 = $this->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 = $this->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 = $this->factory->comment->create( array(
     660        $c1 = self::$factory->comment->create( array(
    661661            'comment_date' => '2015-01-28 03:00:00',
    662662        ) );
    663         $c2 = $this->factory->comment->create( array(
     663        $c2 = self::$factory->comment->create( array(
    664664            'comment_date' => '2015-01-28 05:00:00',
    665665        ) );
    666         $c3 = $this->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 = $this->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 = $this->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 = $this->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 = $this->factory->user->create_many( 2 );
    780         $this->factory->comment->create( array( 'user_id' => $users[0], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    781         $this->factory->comment->create( array( 'user_id' => $users[0], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    782         $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    812         $comment_2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    813         $comment_3 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    830         $comment_2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    831         $comment_3 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    846         $comment_2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    847         $comment_3 = $this->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 = $this->factory->post->create();
    862         $p2 = $this->factory->post->create();
    863         $p3 = $this->factory->post->create();
    864 
    865         $c1 = $this->factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 7, 'comment_approved' => '1' ) );
    866         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) );
    867         $c3 = $this->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 = $this->factory->post->create();
    882         $p2 = $this->factory->post->create();
    883         $p3 = $this->factory->post->create();
    884 
    885         $c1 = $this->factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 7, 'comment_approved' => '1' ) );
    886         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) );
    887         $c3 = $this->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 = $this->factory->post->create( array( 'post_author' => $author_id1 ) );
    905         $p2 = $this->factory->post->create( array( 'post_author' => $author_id1 ) );
    906         $p3 = $this->factory->post->create( array( 'post_author' => $author_id2 ) );
    907 
    908         $c1 = $this->factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) );
    909         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) );
    910         $c3 = $this->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 = $this->factory->post->create( array( 'post_author' => $author_id1 ) );
    928         $p2 = $this->factory->post->create( array( 'post_author' => $author_id1 ) );
    929         $p3 = $this->factory->post->create( array( 'post_author' => $author_id2 ) );
    930 
    931         $c1 = $this->factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) );
    932         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) );
    933         $c3 = $this->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 = $this->factory->post->create();
    948         $p2 = $this->factory->post->create();
    949         $p3 = $this->factory->post->create();
    950         $p4 = $this->factory->post->create();
    951 
    952         $c1 = $this->factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) );
    953         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 2, 'comment_approved' => '1' ) );
    954         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 3, 'comment_approved' => '1' ) );
    955         $c4 = $this->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 = $this->factory->post->create();
    970         $p2 = $this->factory->post->create();
    971         $p3 = $this->factory->post->create();
    972         $p4 = $this->factory->post->create();
    973 
    974         $c1 = $this->factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) );
    975         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 2, 'comment_approved' => '1' ) );
    976         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 3, 'comment_approved' => '1' ) );
    977         $c4 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    992         $comment_2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    993         $comment_3 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    1005         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    1006         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
    1007         $c4 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    1023         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    1024         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
    1025         $c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );
    1026         $c5 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    1042         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    1043         $c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
    1044         $c4 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );
    1045         $c5 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    1061         $c2 = $this->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 = $this->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 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    1079         $c2 = $this->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 = $this->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 = $this->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 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    1098         $c2 = $this->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 = $this->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 = $this->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 = $this->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 = $this->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 = $this->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 = $this->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 = $this->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 = $this->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 = $this->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 = $this->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 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
    1420         $c2 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
    1435         $c2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
    1436         $c3 = $this->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 = $this->factory->post->create( array( 'post_type' => 'post-type-1' ) );
    1459         $p2 = $this->factory->post->create( array( 'post_type' => 'post-type-2' ) );
    1460 
    1461         $c1 = $this->factory->comment->create_post_comments( $p1, 1 );
    1462         $c2 = $this->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 = $this->factory->post->create( array( 'post_type' => 'post-type-1' ) );
    1484         $p2 = $this->factory->post->create( array( 'post_type' => 'post-type-2' ) );
    1485 
    1486         $c1 = $this->factory->comment->create_post_comments( $p1, 1 );
    1487         $c2 = $this->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 = $this->factory->post->create( array( 'post_type' => 'post-type-1' ) );
    1509         $p2 = $this->factory->post->create( array( 'post_type' => 'post-type-2' ) );
    1510         $p3 = $this->factory->post->create( array( 'post_type' => 'post-type-3' ) );
    1511 
    1512         $c1 = $this->factory->comment->create_post_comments( $p1, 1 );
    1513         $c2 = $this->factory->comment->create_post_comments( $p2, 1 );
    1514         $c3 = $this->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 = $this->factory->post->create( array( 'post_name' => 'foo' ) );
    1530         $p2 = $this->factory->post->create( array( 'post_name' => 'bar' ) );
    1531 
    1532         $c1 = $this->factory->comment->create_post_comments( $p1, 1 );
    1533         $c2 = $this->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 = $this->factory->post->create( array( 'post_name' => 'foo' ) );
    1549         $p2 = $this->factory->post->create( array( 'post_name' => 'bar' ) );
    1550 
    1551         $c1 = $this->factory->comment->create_post_comments( $p1, 1 );
    1552         $c2 = $this->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 = $this->factory->post->create( array( 'post_name' => 'foo' ) );
    1568         $p2 = $this->factory->post->create( array( 'post_name' => 'bar' ) );
    1569         $p3 = $this->factory->post->create( array( 'post_name' => 'baz' ) );
    1570 
    1571         $c1 = $this->factory->comment->create_post_comments( $p1, 1 );
    1572         $c2 = $this->factory->comment->create_post_comments( $p2, 1 );
    1573         $c3 = $this->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 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
    1586         $p2 = $this->factory->post->create( array( 'post_status' => 'draft' ) );
    1587 
    1588         $c1 = $this->factory->comment->create_post_comments( $p1, 1 );
    1589         $c2 = $this->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 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
    1605         $p2 = $this->factory->post->create( array( 'post_status' => 'draft' ) );
    1606 
    1607         $c1 = $this->factory->comment->create_post_comments( $p1, 1 );
    1608         $c2 = $this->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 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
    1624         $p2 = $this->factory->post->create( array( 'post_status' => 'draft' ) );
    1625         $p3 = $this->factory->post->create( array( 'post_status' => 'future' ) );
    1626 
    1627         $c1 = $this->factory->comment->create_post_comments( $p1, 1 );
    1628         $c2 = $this->factory->comment->create_post_comments( $p2, 1 );
    1629         $c3 = $this->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 = $this->factory->comment->create();
     1644        $comment_id = self::$factory->comment->create();
    16451645
    16461646        $query1 = new WP_Comment_Query();
     
    16641664        global $wpdb;
    16651665
    1666         $p = $this->factory->post->create();
    1667         $c = $this->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 = $this->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 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    1750         $c2 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    1770         $c2 = $this->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 = $this->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 = $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    1799 
    1800         $this->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 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    1820         $c2 = $this->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         $this->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         $this->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         $this->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 = $this->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 = $this->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         $this->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 = $this->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 = $this->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 = $this->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 = $this->factory->comment->create( array(
    1931             'comment_post_ID' => $this->post_id,
    1932             'comment_approved' => '1',
    1933         ) );
    1934 
    1935         $child_of_0 = $this->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 = $this->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 = $this->factory->comment->create( array(
    1964             'comment_post_ID' => $this->post_id,
    1965             'comment_approved' => '1',
    1966         ) );
    1967 
    1968         $child_of_0 = $this->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 = $this->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 = $this->factory->comment->create( array(
    1995             'comment_post_ID' => $this->post_id,
    1996             'comment_approved' => '1',
    1997         ) );
    1998 
    1999         $c2 = $this->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 = $this->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 = $this->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 = $this->factory->comment->create( array(
    2018             'comment_post_ID' => $this->post_id,
    2019             'comment_approved' => '1',
    2020         ) );
    2021 
    2022         $c6 = $this->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 = $this->factory->comment->create( array(
    2058             'comment_post_ID' => $this->post_id,
    2059             'comment_approved' => '1',
    2060         ) );
    2061 
    2062         $c2 = $this->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 = $this->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 = $this->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 = $this->factory->comment->create( array(
    2081             'comment_post_ID' => $this->post_id,
    2082             'comment_approved' => '1',
    2083         ) );
    2084 
    2085         $this->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 = $this->factory->post->create();
    2121         $c = $this->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 = $this->factory->post->create();
    2139         $c = $this->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(
  • trunk/tests/phpunit/tests/comment/slashes.php

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

    r28558 r35225  
    66
    77    function test_get_comments_number() {
    8         $post_id = $this->factory->post->create();
     8        $post_id = self::$factory->post->create();
    99
    1010        $this->assertEquals( 0, get_comments_number( 0 ) );
     
    1212        $this->assertEquals( 0, get_comments_number( get_post( $post_id ) ) );
    1313
    14         $this->factory->comment->create_post_comments( $post_id, 12 );
     14        self::$factory->comment->create_post_comments( $post_id, 12 );
    1515
    1616        $this->assertEquals( 12, get_comments_number( $post_id ) );
     
    1919
    2020    function test_get_comments_number_without_arg() {
    21         $post_id = $this->factory->post->create();
     21        $post_id = self::$factory->post->create();
    2222        $permalink = get_permalink( $post_id );
    2323        $this->go_to( $permalink );
     
    2525        $this->assertEquals( 0, get_comments_number() );
    2626
    27         $this->factory->comment->create_post_comments( $post_id, 12 );
     27        self::$factory->comment->create_post_comments( $post_id, 12 );
    2828        $this->go_to( $permalink );
    2929
  • trunk/tests/phpunit/tests/comment/walker.php

    r28824 r35225  
    99        parent::setUp();
    1010
    11         $this->post_id = $this->factory->post->create();
     11        $this->post_id = self::$factory->post->create();
    1212    }
    1313
     
    1616     */
    1717    function test_has_children() {
    18         $comment_parent = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
    19         $comment_child  = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_parent' => $comment_parent ) );
     18        $comment_parent = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
     19        $comment_child  = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_parent' => $comment_parent ) );
    2020        $comment_parent = get_comment( $comment_parent );
    2121        $comment_child  = get_comment( $comment_child  );
  • trunk/tests/phpunit/tests/comment/wpCountComments.php

    r34161 r35225  
    1616
    1717    public function test_wp_count_comments_approved() {
    18         $this->factory->comment->create( array(
     18        self::$factory->comment->create( array(
    1919            'comment_approved' => 1
    2020        ) );
     
    3232
    3333    public function test_wp_count_comments_awaiting() {
    34         $this->factory->comment->create( array(
     34        self::$factory->comment->create( array(
    3535            'comment_approved' => 0
    3636        ) );
     
    4848
    4949    public function test_wp_count_comments_spam() {
    50         $this->factory->comment->create( array(
     50        self::$factory->comment->create( array(
    5151            'comment_approved' => 'spam'
    5252        ) );
     
    6464
    6565    public function test_wp_count_comments_trash() {
    66         $this->factory->comment->create( array(
     66        self::$factory->comment->create( array(
    6767            'comment_approved' => 'trash'
    6868        ) );
     
    8080
    8181    public function test_wp_count_comments_post_trashed() {
    82         $this->factory->comment->create( array(
     82        self::$factory->comment->create( array(
    8383            'comment_approved' => 'post-trashed'
    8484        ) );
     
    9696
    9797    public function test_wp_count_comments_cache() {
    98         $post_id = $this->factory->post->create( array(
     98        $post_id = self::$factory->post->create( array(
    9999            'post_status' => 'publish'
    100100        ) );
    101         $comment_id = $this->factory->comment->create( array(
     101        $comment_id = self::$factory->comment->create( array(
    102102            'comment_approved' => '1',
    103103            'comment_post_ID' => $post_id
  • trunk/tests/phpunit/tests/customize/manager.php

    r34269 r35225  
    252252     */
    253253    function test_return_url() {
    254         wp_set_current_user( $this->factory->user->create( array( 'role' => 'author' ) ) );
     254        wp_set_current_user( self::$factory->user->create( array( 'role' => 'author' ) ) );
    255255        $this->assertEquals( get_admin_url(), $this->manager->get_return_url() );
    256256
    257         wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     257        wp_set_current_user( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    258258        $this->assertTrue( current_user_can( 'edit_theme_options' ) );
    259259        $this->assertEquals( admin_url( 'themes.php' ), $this->manager->get_return_url() );
     
    302302     */
    303303    function test_customize_pane_settings() {
    304         wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     304        wp_set_current_user( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    305305        $this->manager->register_controls();
    306306        $this->manager->prepare_controls();
  • trunk/tests/phpunit/tests/customize/nav-menu-item-setting.php

    r33366 r35225  
    2222        parent::setUp();
    2323        require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
    24         wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     24        wp_set_current_user( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    2525
    2626        global $wp_customize;
     
    150150        do_action( 'customize_register', $this->wp_customize );
    151151
    152         $post_id = $this->factory->post->create( array( 'post_title' => 'Hello World' ) );
     152        $post_id = self::$factory->post->create( array( 'post_title' => 'Hello World' ) );
    153153
    154154        $menu_id = wp_create_nav_menu( 'Menu' );
     
    193193        do_action( 'customize_register', $this->wp_customize );
    194194
    195         $tax_id = $this->factory->category->create( array( 'name' => 'Salutations' ) );
     195        $tax_id = self::$factory->category->create( array( 'name' => 'Salutations' ) );
    196196
    197197        $menu_id = wp_create_nav_menu( 'Menu' );
     
    271271        $this->assertEquals( $post_value, $value );
    272272
    273         $post_id = $this->factory->post->create( array( 'post_title' => 'Hello World' ) );
     273        $post_id = self::$factory->post->create( array( 'post_title' => 'Hello World' ) );
    274274        $item_id = wp_update_nav_menu_item( $menu_id, 0, array(
    275275            'menu-item-type' => 'post_type',
     
    297297        do_action( 'customize_register', $this->wp_customize );
    298298
    299         $first_post_id = $this->factory->post->create( array( 'post_title' => 'Hello World' ) );
    300         $second_post_id = $this->factory->post->create( array( 'post_title' => 'Hola Muno' ) );
     299        $first_post_id = self::$factory->post->create( array( 'post_title' => 'Hello World' ) );
     300        $second_post_id = self::$factory->post->create( array( 'post_title' => 'Hola Muno' ) );
    301301
    302302        $primary_menu_id = wp_create_nav_menu( 'Primary' );
     
    349349
    350350        $menu_id = wp_create_nav_menu( 'Primary' );
    351         $post_id = $this->factory->post->create( array( 'post_title' => 'Hello World' ) );
     351        $post_id = self::$factory->post->create( array( 'post_title' => 'Hello World' ) );
    352352        $item_ids = array();
    353353        for ( $i = 0; $i < 5; $i += 1 ) {
     
    404404
    405405        $menu_id = wp_create_nav_menu( 'Primary' );
    406         $post_id = $this->factory->post->create( array( 'post_title' => 'Hello World' ) );
     406        $post_id = self::$factory->post->create( array( 'post_title' => 'Hello World' ) );
    407407        $item_ids = array();
    408408        for ( $i = 0; $i < 5; $i += 1 ) {
     
    489489        do_action( 'customize_register', $this->wp_customize );
    490490
    491         $first_post_id = $this->factory->post->create( array( 'post_title' => 'Hello World' ) );
    492         $second_post_id = $this->factory->post->create( array( 'post_title' => 'Hola Muno' ) );
     491        $first_post_id = self::$factory->post->create( array( 'post_title' => 'Hello World' ) );
     492        $second_post_id = self::$factory->post->create( array( 'post_title' => 'Hola Muno' ) );
    493493
    494494        $primary_menu_id = wp_create_nav_menu( 'Primary' );
     
    555555
    556556        $menu_id = wp_create_nav_menu( 'Primary' );
    557         $post_id = $this->factory->post->create( array( 'post_title' => 'Hello World' ) );
     557        $post_id = self::$factory->post->create( array( 'post_title' => 'Hello World' ) );
    558558        $item_ids = array();
    559559        for ( $i = 0; $i < 5; $i += 1 ) {
     
    624624
    625625        $menu_id = wp_create_nav_menu( 'Primary' );
    626         $post_id = $this->factory->post->create( array( 'post_title' => 'Hello World' ) );
     626        $post_id = self::$factory->post->create( array( 'post_title' => 'Hello World' ) );
    627627        $item_ids = array();
    628628        for ( $i = 0; $i < 5; $i += 1 ) {
  • trunk/tests/phpunit/tests/customize/nav-menu-setting.php

    r33526 r35225  
    2323        parent::setUp();