Make WordPress Core

Ticket #33968: awesome-2.diff

File awesome-2.diff, 740.9 KB (added by nerrad, 9 years ago)

expands on awesome.diff and implements factory() to grab the WP_UnitTestFactory instance for all wp tests. (Search and Replace self::$factory with self::factory()

  • .gitignore

    diff --git .gitignore .gitignore
    index dd18e54..b7ac88d 100644
     
    44wp-config.php
    55wp-tests-config.php
    66.htaccess
    7 
     7.idea
    88# Files and folders related to build/test tools
    99/phpunit.xml
    1010/tests/phpunit/data/plugins/wordpress-importer
  • tests/phpunit/includes/testcase-ajax.php

    diff --git tests/phpunit/includes/testcase-ajax.php tests/phpunit/includes/testcase-ajax.php
    index 6296ced..3227fa6 100644
    abstract class WP_Ajax_UnitTestCase extends WP_UnitTestCase { 
    7575                error_reporting( $this->_error_level & ~E_WARNING );
    7676
    7777                // Make some posts
    78                 self::$factory->post->create_many( 5 );
     78                self::factory()->post->create_many( 5 );
    7979        }
    8080
    8181        /**
    abstract class WP_Ajax_UnitTestCase extends WP_UnitTestCase { 
    148148         */
    149149        protected function _setRole( $role ) {
    150150                $post = $_POST;
    151                 $user_id = self::$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);
    154154        }
  • tests/phpunit/includes/testcase-canonical.php

    diff --git tests/phpunit/includes/testcase-canonical.php tests/phpunit/includes/testcase-canonical.php
    index 6470a64..a82c8c5 100644
    class WP_Canonical_UnitTestCase extends WP_UnitTestCase { 
    4949                wp_set_current_user( self::$author_id );
    5050
    5151                // Already created by install defaults:
    52                 // self::$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' ) );
    5555                self::$post_ids[] = $post_id = $factory->post->create( array( 'post_title' => 'post-format-test-gallery', 'post_date' => '2008-06-10 00:00:00' ) );
  • tests/phpunit/includes/testcase-xmlrpc.php

    diff --git tests/phpunit/includes/testcase-xmlrpc.php tests/phpunit/includes/testcase-xmlrpc.php
    index 6f69569..5fefb51 100644
    class WP_XMLRPC_UnitTestCase extends WP_UnitTestCase { 
    2222        }
    2323
    2424        protected function make_user_by_role( $role ) {
    25                 return self::$factory->user->create( array(
     25                return self::factory()->user->create( array(
    2626                        'user_login' => $role,
    2727                        'user_pass'  => $role,
    2828                        'role'       => $role
  • tests/phpunit/includes/testcase.php

    diff --git tests/phpunit/includes/testcase.php tests/phpunit/includes/testcase.php
    index e7c3308..e3cc573 100644
    class WP_UnitTestCase extends PHPUnit_Framework_TestCase { 
    1414        protected static $hooks_saved = array();
    1515        protected static $ignore_files;
    1616
    17         /**
    18          * @var WP_UnitTest_Factory
    19          */
    20         protected static $factory;
     17
     18        function __isset( $name ) {
     19                return 'factory' === $name;
     20        }
     21
     22
     23        function __get( $name ) {
     24                if ( 'factory' === $name ) {
     25                        return self::factory();
     26            }
     27        }
     28
     29
     30
     31        protected static function factory() {
     32                static $factory = null;
     33                if ( ! $factory ) {
     34                        $factory = new WP_UnitTest_Factory();
     35                }
     36                return $factory;
     37        }
    2138
    2239        public static function get_called_class() {
    2340                if ( function_exists( 'get_called_class' ) ) {
    class WP_UnitTestCase extends PHPUnit_Framework_TestCase { 
    3754        public static function setUpBeforeClass() {
    3855                parent::setUpBeforeClass();
    3956
    40                 if ( ! self::$factory ) {
    41                         self::$factory = new WP_UnitTest_Factory();
    42                 }
    43 
    4457                $c = self::get_called_class();
    4558                if ( ! method_exists( $c, 'wpSetUpBeforeClass' ) ) {
    4659                        return;
    4760                }
    4861
    49                 call_user_func( array( $c, 'wpSetUpBeforeClass' ), self::$factory );
     62                call_user_func( array( $c, 'wpSetUpBeforeClass' ), self::factory() );
    5063
    5164                self::commit_transaction();
    5265        }
  • tests/phpunit/tests/admin/includesComment.php

    diff --git tests/phpunit/tests/admin/includesComment.php tests/phpunit/tests/admin/includesComment.php
    index 46f3b11..36f9897 100644
     
    66 */
    77class Tests_Admin_IncludesComment extends WP_UnitTestCase {
    88        public function test_must_match_date_and_author() {
    9                 $p1 = self::$factory->post->create();
    10                 $c1 = self::$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',
    1313                        'comment_post_ID' => $p1,
    1414                ) );
    1515
    16                 $p2 = self::$factory->post->create();
    17                 $c2 = self::$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',
    2020                        'comment_post_ID' => $p2,
    class Tests_Admin_IncludesComment extends WP_UnitTestCase { 
    2828         * @ticket 33871
    2929         */
    3030        public function test_default_value_of_timezone_should_be_blog() {
    31                 $p = self::$factory->post->create();
    32                 $c = self::$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,
    3535                        'comment_date' => '2014-05-06 12:00:00',
    class Tests_Admin_IncludesComment extends WP_UnitTestCase { 
    4343         * @ticket 33871
    4444         */
    4545        public function test_should_respect_timezone_blog() {
    46                 $p = self::$factory->post->create();
    47                 $c = self::$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,
    5050                        'comment_date' => '2014-05-06 12:00:00',
    class Tests_Admin_IncludesComment extends WP_UnitTestCase { 
    5858         * @ticket 33871
    5959         */
    6060        public function test_should_respect_timezone_gmt() {
    61                 $p = self::$factory->post->create();
    62                 $c = self::$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,
    6565                        'comment_date' => '2014-05-06 12:00:00',
    class Tests_Admin_IncludesComment extends WP_UnitTestCase { 
    7373         * @ticket 33871
    7474         */
    7575        public function test_invalid_timezone_should_fall_back_on_blog() {
    76                 $p = self::$factory->post->create();
    77                 $c = self::$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,
    8080                        'comment_date' => '2014-05-06 12:00:00',
  • tests/phpunit/tests/admin/includesPlugin.php

    diff --git tests/phpunit/tests/admin/includesPlugin.php tests/phpunit/tests/admin/includesPlugin.php
    index a51a929..b7ed20d 100644
    class Tests_Admin_includesPlugin extends WP_UnitTestCase { 
    2929
    3030        function test_menu_page_url() {
    3131                $current_user = get_current_user_id();
    32                 wp_set_current_user( self::$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
    3535                // add some pages
  • tests/phpunit/tests/admin/includesPost.php

    diff --git tests/phpunit/tests/admin/includesPost.php tests/phpunit/tests/admin/includesPost.php
    index 7fa3dd3..8874a1c 100644
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    1111        }
    1212
    1313        function test__wp_translate_postdata_cap_checks_contributor() {
    14                 $contributor_id = self::$factory->user->create( array( 'role' => 'contributor' ) );
    15                 $editor_id = self::$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 );
    1818
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    5151
    5252                // Edit Draft Post for another user
    5353                $_post_data = array();
    54                 $_post_data['post_ID'] = self::$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';
    5757                $_post_data['post_status'] = 'draft';
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    6464        }
    6565
    6666        function test__wp_translate_postdata_cap_checks_editor() {
    67                 $contributor_id = self::$factory->user->create( array( 'role' => 'contributor' ) );
    68                 $editor_id = self::$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 );
    7171
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    104104
    105105                // Edit Draft Post for another user
    106106                $_post_data = array();
    107                 $_post_data['post_ID'] = self::$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';
    110110                $_post_data['post_status'] = 'draft';
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    122122         * @ticket 25272
    123123         */
    124124        function test_edit_post_auto_draft() {
    125                 $user_id = self::$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 = self::$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(
    130130                        'post_title' => 'Post title',
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    140140         * @ticket 30615
    141141         */
    142142        public function test_edit_post_should_parse_tax_input_by_name_rather_than_slug_for_nonhierarchical_taxonomies() {
    143                 $u = self::$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 = self::$factory->term->create( array(
     147                $t1 = self::factory()->term->create( array(
    148148                        'taxonomy' => 'wptests_tax',
    149149                        'name' => 'foo',
    150150                        'slug' => 'bar',
    151151                ) );
    152                 $t2 = self::$factory->term->create( array(
     152                $t2 = self::factory()->term->create( array(
    153153                        'taxonomy' => 'wptests_tax',
    154154                        'name' => 'bar',
    155155                        'slug' => 'foo',
    156156                ) );
    157157
    158                 $p = self::$factory->post->create();
     158                $p = self::factory()->post->create();
    159159
    160160                $post_data = array(
    161161                        'post_ID' => $p,
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    179179         * @ticket 30615
    180180         */
    181181        public function test_edit_post_should_not_create_terms_for_an_empty_tag_input_field() {
    182                 $u = self::$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 = self::$factory->term->create( array(
     186                $t1 = self::factory()->term->create( array(
    187187                        'taxonomy' => 'wptests_tax',
    188188                        'name' => 'foo',
    189189                        'slug' => 'bar',
    190190                ) );
    191191
    192                 $p = self::$factory->post->create();
     192                $p = self::factory()->post->create();
    193193
    194194                $post_data = array(
    195195                        'post_ID' => $p,
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    209209         * @ticket 27792
    210210         */
    211211        function test_bulk_edit_posts_stomping() {
    212                 $admin = self::$factory->user->create( array( 'role' => 'administrator' ) );
    213                 $users = self::$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 = self::$factory->post->create( array(
     216                $post1 = self::factory()->post->create( array(
    217217                        'post_author'    => $users[0],
    218218                        'comment_status' => 'open',
    219219                        'ping_status'    => 'open',
    220220                        'post_status'    => 'publish',
    221221                ) );
    222222
    223                 $post2 = self::$factory->post->create( array(
     223                $post2 = self::factory()->post->create( array(
    224224                        'post_author'    => $users[1],
    225225                        'comment_status' => 'closed',
    226226                        'ping_status'    => 'closed',
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    255255                $this->set_permalink_structure( "/$permalink_structure/" );
    256256
    257257                $future_date = date( 'Y-m-d H:i:s', time() + 100 );
    258                 $p = self::$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 );
    261261                $expected = trailingslashit( home_url( $permalink_structure ) );
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    268268         * @ticket 18306
    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( self::$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 = self::$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 );
    277277                $this->assertContains( 'href="' . get_option( 'home' ) . '/?p=' . $p . '"', $found );
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    284284        public function test_get_sample_permalink_html_should_use_pretty_permalink_for_view_post_link_when_pretty_permalinks_are_enabled() {
    285285                $this->set_permalink_structure( '/%postname%/' );
    286286
    287                 wp_set_current_user( self::$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 = self::$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 );
    293293                $post = get_post( $p );
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    301301        public function test_get_sample_permalink_html_should_use_correct_permalink_for_view_post_link_when_changing_slug() {
    302302                $this->set_permalink_structure( '/%postname%/' );
    303303
    304                 wp_set_current_user( self::$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 = self::$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' );
    310310                $post = get_post( $p );
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    313313
    314314                // Scheduled posts should use published permalink
    315315                $future_date = date( 'Y-m-d H:i:s', time() + 100 );
    316                 $p = self::$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' );
    319319                $post = get_post( $p );
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    321321                $this->assertContains( 'href="' . get_option( 'home' ) . "/" . $post->post_name . '/"', $found, $message );
    322322
    323323                // Draft posts should use preview link
    324                 $p = self::$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' );
    327327                $post = get_post( $p );
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    339339        public function test_get_sample_permalink_should_avoid_slugs_that_would_create_clashes_with_year_archives() {
    340340                $this->set_permalink_structure( '/%postname%/' );
    341341
    342                 $p = self::$factory->post->create( array(
     342                $p = self::factory()->post->create( array(
    343343                        'post_name' => '2015',
    344344                ) );
    345345
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    353353        public function test_get_sample_permalink_should_allow_yearlike_slugs_if_permastruct_does_not_cause_an_archive_conflict() {
    354354                $this->set_permalink_structure( '/%year%/%postname%/' );
    355355
    356                 $p = self::$factory->post->create( array(
     356                $p = self::factory()->post->create( array(
    357357                        'post_name' => '2015',
    358358                ) );
    359359
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    367367        public function test_get_sample_permalink_should_avoid_slugs_that_would_create_clashes_with_month_archives() {
    368368                $this->set_permalink_structure( '/%year%/%postname%/' );
    369369
    370                 $p = self::$factory->post->create( array(
     370                $p = self::factory()->post->create( array(
    371371                        'post_name' => '11',
    372372                ) );
    373373
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    381381        public function test_get_sample_permalink_should_ignore_potential_month_conflicts_for_invalid_monthnum() {
    382382                $this->set_permalink_structure( '/%year%/%postname%/' );
    383383
    384                 $p = self::$factory->post->create( array(
     384                $p = self::factory()->post->create( array(
    385385                        'post_name' => '13',
    386386                ) );
    387387
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    395395        public function test_get_sample_permalink_should_avoid_slugs_that_would_create_clashes_with_day_archives() {
    396396                $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' );
    397397
    398                 $p = self::$factory->post->create( array(
     398                $p = self::factory()->post->create( array(
    399399                        'post_name' => '30',
    400400                ) );
    401401
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    409409        public function test_get_sample_permalink_should_iterate_slug_suffix_when_a_date_conflict_is_found() {
    410410                $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' );
    411411
    412                 self::$factory->post->create( array(
     412                self::factory()->post->create( array(
    413413                        'post_name' => '30-2',
    414414                ) );
    415415
    416                 $p = self::$factory->post->create( array(
     416                $p = self::factory()->post->create( array(
    417417                        'post_name' => '30',
    418418                ) );
    419419
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    427427        public function test_get_sample_permalink_should_ignore_potential_day_conflicts_for_invalid_day() {
    428428                $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' );
    429429
    430                 $p = self::$factory->post->create( array(
     430                $p = self::factory()->post->create( array(
    431431                        'post_name' => '32',
    432432                ) );
    433433
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    441441        public function test_get_sample_permalink_should_allow_daylike_slugs_if_permastruct_does_not_cause_an_archive_conflict() {
    442442                $this->set_permalink_structure( '/%year%/%month%/%day%/%postname%/' );
    443443
    444                 $p = self::$factory->post->create( array(
     444                $p = self::factory()->post->create( array(
    445445                        'post_name' => '30',
    446446                ) );
    447447
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    450450        }
    451451
    452452        public function test_post_exists_should_match_title() {
    453                 $p = self::$factory->post->create( array(
     453                $p = self::factory()->post->create( array(
    454454                        'post_title' => 'Foo Bar',
    455455                ) );
    456456
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    458458        }
    459459
    460460        public function test_post_exists_should_not_match_nonexistent_title() {
    461                 $p = self::$factory->post->create( array(
     461                $p = self::factory()->post->create( array(
    462462                        'post_title' => 'Foo Bar',
    463463                ) );
    464464
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    468468        public function test_post_exists_should_match_nonempty_content() {
    469469                $title = 'Foo Bar';
    470470                $content = 'Foo Bar Baz';
    471                 $p = self::$factory->post->create( array(
     471                $p = self::factory()->post->create( array(
    472472                        'post_title' => $title,
    473473                        'post_content' => $content,
    474474                ) );
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    479479        public function test_post_exists_should_not_match_when_nonempty_content_doesnt_match() {
    480480                $title = 'Foo Bar';
    481481                $content = 'Foo Bar Baz';
    482                 $p = self::$factory->post->create( array(
     482                $p = self::factory()->post->create( array(
    483483                        'post_title' => $title,
    484484                        'post_content' => $content . ' Quz',
    485485                ) );
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    490490        public function test_post_exists_should_match_nonempty_date() {
    491491                $title = 'Foo Bar';
    492492                $date = '2014-05-08 12:00:00';
    493                 $p = self::$factory->post->create( array(
     493                $p = self::factory()->post->create( array(
    494494                        'post_title' => $title,
    495495                        'post_date' => $date,
    496496                ) );
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    501501        public function test_post_exists_should_not_match_when_nonempty_date_doesnt_match() {
    502502                $title = 'Foo Bar';
    503503                $date = '2014-05-08 12:00:00';
    504                 $p = self::$factory->post->create( array(
     504                $p = self::factory()->post->create( array(
    505505                        'post_title' => $title,
    506506                        'post_date' => '2015-10-10 00:00:00',
    507507                ) );
    class Tests_Admin_includesPost extends WP_UnitTestCase { 
    513513                $title = 'Foo Bar';
    514514                $content = 'Foo Bar Baz';
    515515                $date = '2014-05-08 12:00:00';
    516                 $p = self::$factory->post->create( array(
     516                $p = self::factory()->post->create( array(
    517517                        'post_title' => $title,
    518518                        'post_content' => $content,
    519519                        'post_date' => $date,
  • tests/phpunit/tests/adminbar.php

    diff --git tests/phpunit/tests/adminbar.php tests/phpunit/tests/adminbar.php
    index 0ef6647..cf83adc 100644
    class Tests_AdminBar extends WP_UnitTestCase { 
    1515         * @ticket 21117
    1616         */
    1717        function test_content_post_type() {
    18                 wp_set_current_user( self::$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 ) );
    2121
    class Tests_AdminBar extends WP_UnitTestCase { 
    3434         * @ticket 21117
    3535         */
    3636        function test_merging_existing_meta_values() {
    37                 wp_set_current_user( self::$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;
    4040
    class Tests_AdminBar extends WP_UnitTestCase { 
    6262                        $this->markTestSkipped( 'Test does not run in multisite' );
    6363                }
    6464
    65                 $nobody = self::$factory->user->create( array( 'role' => '' ) );
     65                $nobody = self::factory()->user->create( array( 'role' => '' ) );
    6666                $this->assertFalse( user_can( $nobody, 'read' ) );
    6767
    6868                wp_set_current_user( $nobody );
    class Tests_AdminBar extends WP_UnitTestCase { 
    9292                        $this->markTestSkipped( 'Test does not run in multisite' );
    9393                }
    9494
    95                 $editor = self::$factory->user->create( array( 'role' => 'editor' ) );
     95                $editor = self::factory()->user->create( array( 'role' => 'editor' ) );
    9696                $this->assertTrue( user_can( $editor, 'read' ) );
    9797
    9898                wp_set_current_user( $editor );
    class Tests_AdminBar extends WP_UnitTestCase { 
    125125                        $this->markTestSkipped( 'Test only runs in multisite' );
    126126                }
    127127
    128                 $admin  = self::$factory->user->create( array( 'role' => 'administrator' ) );
    129                 $editor = self::$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 = self::$factory->blog->create( array(
     134                $new_blog_id = self::factory()->blog->create( array(
    135135                        'user_id' => $admin,
    136136                ) );
    137137
    class Tests_AdminBar extends WP_UnitTestCase { 
    179179                        $this->markTestSkipped( 'Test only runs in multisite' );
    180180                }
    181181
    182                 $admin  = self::$factory->user->create( array( 'role' => 'administrator' ) );
    183                 $nobody = self::$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 = self::$factory->blog->create( array(
     188                $new_blog_id = self::factory()->blog->create( array(
    189189                        'user_id' => $admin,
    190190                ) );
    191191
  • tests/phpunit/tests/ajax/Autosave.php

    diff --git tests/phpunit/tests/ajax/Autosave.php tests/phpunit/tests/ajax/Autosave.php
    index aac9274..4b2b26c 100644
    class Tests_Ajax_Autosave extends WP_Ajax_UnitTestCase { 
    3333        public function setUp() {
    3434                parent::setUp();
    3535                // Set a user so the $post has 'post_author'
    36                 $this->user_id = self::$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 = self::$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        }
    4242
    class Tests_Ajax_Autosave extends WP_Ajax_UnitTestCase { 
    9797         */
    9898        public function test_autosave_locked_post() {
    9999                // Lock the post to another user
    100                 $another_user_id = self::$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 );
    103103
  • tests/phpunit/tests/ajax/CustomizeMenus.php

    diff --git tests/phpunit/tests/ajax/CustomizeMenus.php tests/phpunit/tests/ajax/CustomizeMenus.php
    index 94fc646..87191c6 100644
    class Tests_Ajax_CustomizeMenus extends WP_Ajax_UnitTestCase { 
    2222        public function setUp() {
    2323                parent::setUp();
    2424                require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
    25                 wp_set_current_user( self::$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();
    2828                $wp_customize = $this->wp_customize;
    class Tests_Ajax_CustomizeMenus extends WP_Ajax_UnitTestCase { 
    6565                        $this->setExpectedException( 'WPAjaxDieStopException' );
    6666                }
    6767
    68                 wp_set_current_user( self::$factory->user->create( array( 'role' => $role ) ) );
     68                wp_set_current_user( self::factory()->user->create( array( 'role' => $role ) ) );
    6969
    7070                $_POST = array(
    7171                        'action'                => 'load-available-menu-items-customizer',
    class Tests_Ajax_CustomizeMenus extends WP_Ajax_UnitTestCase { 
    307307                );
    308308
    309309                // Create some terms and pages.
    310                 self::$factory->term->create_many( 5 );
    311                 self::$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(
    314314                        'action'                => 'load-available-menu-items-customizer',
    class Tests_Ajax_CustomizeMenus extends WP_Ajax_UnitTestCase { 
    396396                        $this->setExpectedException( 'WPAjaxDieStopException' );
    397397                }
    398398
    399                 wp_set_current_user( self::$factory->user->create( array( 'role' => $role ) ) );
     399                wp_set_current_user( self::factory()->user->create( array( 'role' => $role ) ) );
    400400
    401401                $_POST = array(
    402402                        'action'                => 'search-available-menu-items-customizer',
    class Tests_Ajax_CustomizeMenus extends WP_Ajax_UnitTestCase { 
    469469         */
    470470        function test_ajax_search_available_items_results( $post_args, $expected_results ) {
    471471
    472                 self::$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(
    475475                        'action'                => 'search-available-menu-items-customizer',
  • tests/phpunit/tests/ajax/DeleteComment.php

    diff --git tests/phpunit/tests/ajax/DeleteComment.php tests/phpunit/tests/ajax/DeleteComment.php
    index 8b3282a..182894e 100644
    class Tests_Ajax_DeleteComment extends WP_Ajax_UnitTestCase { 
    2626         */
    2727        public function setUp() {
    2828                parent::setUp();
    29                 $post_id = self::$factory->post->create();
    30                 $this->_comments = self::$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        }
    3333
  • tests/phpunit/tests/ajax/DimComment.php

    diff --git tests/phpunit/tests/ajax/DimComment.php tests/phpunit/tests/ajax/DimComment.php
    index 9795f7b..ba06f42 100644
    class Tests_Ajax_DimComment extends WP_Ajax_UnitTestCase { 
    2626         */
    2727        public function setUp() {
    2828                parent::setUp();
    29                 $post_id = self::$factory->post->create();
    30                 $this->_comments = self::$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        }
    3333
  • tests/phpunit/tests/ajax/EditComment.php

    diff --git tests/phpunit/tests/ajax/EditComment.php tests/phpunit/tests/ajax/EditComment.php
    index b29690d..ef5c647 100644
    class Tests_Ajax_EditComment extends WP_Ajax_UnitTestCase { 
    2626         */
    2727        public function setUp() {
    2828                parent::setUp();
    29                 $post_id = self::$factory->post->create();
    30                 self::$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        }
    3333
  • tests/phpunit/tests/ajax/GetComments.php

    diff --git tests/phpunit/tests/ajax/GetComments.php tests/phpunit/tests/ajax/GetComments.php
    index 3702b0b..911bf00 100644
    class Tests_Ajax_GetComments extends WP_Ajax_UnitTestCase { 
    3232         */
    3333        public function setUp() {
    3434                parent::setUp();
    35                 $post_id = self::$factory->post->create();
    36                 self::$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 = self::$factory->post->create();
     39                $post_id = self::factory()->post->create();
    4040                $this->_no_comment_post = get_post( $post_id );
    4141
    4242                unset( $GLOBALS['post_id'] );
  • tests/phpunit/tests/ajax/QuickEdit.php

    diff --git tests/phpunit/tests/ajax/QuickEdit.php tests/phpunit/tests/ajax/QuickEdit.php
    index a7ce874..357ab1f 100644
    class Tests_Ajax_QuickEdit extends WP_Ajax_UnitTestCase { 
    2525                        'hierarchical' => true,
    2626                ) );
    2727
    28                 $t1 = self::$factory->term->create( array(
     28                $t1 = self::factory()->term->create( array(
    2929                        'taxonomy' => 'wptests_tax_1',
    3030                ) );
    31                 $t2 = self::$factory->term->create( array(
     31                $t2 = self::factory()->term->create( array(
    3232                        'taxonomy' => 'wptests_tax_2',
    3333                ) );
    3434
    3535                // Become an administrator.
    3636                $this->_setRole( 'administrator' );
    3737
    38                 $post = self::$factory->post->create_and_get( array(
     38                $post = self::factory()->post->create_and_get( array(
    3939                        'post_author' => get_current_user_id(),
    4040                ) );
    4141
  • tests/phpunit/tests/ajax/ReplytoComment.php

    diff --git tests/phpunit/tests/ajax/ReplytoComment.php tests/phpunit/tests/ajax/ReplytoComment.php
    index 98e7965..e0f001c 100644
    class Tests_Ajax_ReplytoComment extends WP_Ajax_UnitTestCase { 
    3232         */
    3333        public function setUp() {
    3434                parent::setUp();
    35                 $post_id = self::$factory->post->create();
    36                 self::$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 = self::$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        }
    4242
  • tests/phpunit/tests/attachment/slashes.php

    diff --git tests/phpunit/tests/attachment/slashes.php tests/phpunit/tests/attachment/slashes.php
    index b44d5a9..724e6a9 100644
     
    88class Tests_Attachment_Slashes extends WP_UnitTestCase {
    99        function setUp() {
    1010                parent::setUp();
    11                 $this->author_id = self::$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 );
    1414
  • tests/phpunit/tests/avatar.php

    diff --git tests/phpunit/tests/avatar.php tests/phpunit/tests/avatar.php
    index 7475e45..e777f10 100644
    class Tests_Avatar extends WP_UnitTestCase { 
    8787                $url2 = get_avatar_url( $user );
    8888                $this->assertEquals( $url, $url2 );
    8989
    90                 $post_id = self::$factory->post->create( array( 'post_author' => 1 ) );
     90                $post_id = self::factory()->post->create( array( 'post_author' => 1 ) );
    9191                $post = get_post( $post_id );
    9292                $url2 = get_avatar_url( $post );
    9393                $this->assertEquals( $url, $url2 );
    9494
    95                 $comment_id = self::$factory->comment->create( array( 'comment_post_ID' => $post_id, 'user_id' => 1 ) );
     95                $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => $post_id, 'user_id' => 1 ) );
    9696                $comment = get_comment( $comment_id );
    9797                $url2 = get_avatar_url( $comment );
    9898                $this->assertEquals( $url, $url2 );
    class Tests_Avatar extends WP_UnitTestCase { 
    138138        public function test_get_avatar_comment_types_filter() {
    139139                $url = get_avatar_url( 1 );
    140140
    141                 $post_id = self::$factory->post->create( array( 'post_author' => 1 ) );
    142                 $comment_id = self::$factory->comment->create( array( 'comment_post_ID' => $post_id, 'user_id' => 1, 'comment_type' => 'pingback' ) );
     141                $post_id = self::factory()->post->create( array( 'post_author' => 1 ) );
     142                $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => $post_id, 'user_id' => 1, 'comment_type' => 'pingback' ) );
    143143                $comment = get_comment( $comment_id );
    144144
    145145                $url2 = get_avatar_url( $comment );
  • tests/phpunit/tests/canonical/pageOnFront.php

    diff --git tests/phpunit/tests/canonical/pageOnFront.php tests/phpunit/tests/canonical/pageOnFront.php
    index 53afc8c..030befa 100644
    class Tests_Canonical_PageOnFront extends WP_Canonical_UnitTestCase { 
    1818                parent::setUp();
    1919
    2020                update_option( 'show_on_front', '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' ) ) );
     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
    2525        /**
  • tests/phpunit/tests/canonical/paged.php

    diff --git tests/phpunit/tests/canonical/paged.php tests/phpunit/tests/canonical/paged.php
    index f734f40..8f1dbfd 100644
    class Tests_Canonical_Paged extends WP_Canonical_UnitTestCase { 
    1212                        This is a paragraph.';
    1313                $next = '<!--nextpage-->';
    1414
    15                 $post_id = self::$factory->post->create( array(
     15                $post_id = self::factory()->post->create( array(
    1616                        'post_status' => 'publish',
    1717                        'post_content' => "{$para}{$next}{$para}{$next}{$para}"
    1818                ) );
  • tests/phpunit/tests/category.php

    diff --git tests/phpunit/tests/category.php tests/phpunit/tests/category.php
    index 613e6d5..913f4dc 100644
    class Tests_Category extends WP_UnitTestCase { 
    2121         */
    2222        function test_get_all_category_ids() {
    2323                // create categories
    24                 self::$factory->category->create_many( 2 );
     24                self::factory()->category->create_many( 2 );
    2525
    2626                // create new taxonomy to ensure not included
    2727                register_taxonomy( 'test_tax_cat', 'post' );
    class Tests_Category extends WP_UnitTestCase { 
    3838        function test_get_category_by_slug() {
    3939
    4040                // create Test Categories
    41                 $testcat = self::$factory->category->create_and_get(
     41                $testcat = self::factory()->category->create_and_get(
    4242                        array(
    4343                                'slug' => 'testcat',
    4444                                'name' => 'Test Category 1'
    4545                        )
    4646                );
    47                 $testcat2 = self::$factory->category->create_and_get(
     47                $testcat2 = self::factory()->category->create_and_get(
    4848                        array(
    4949                                'slug' => 'testcat2',
    5050                                'name' => 'Test Category 2'
    class Tests_Category extends WP_UnitTestCase { 
    7373                        'name' => 'Test MCC',
    7474                        'description' => 'Category Test'
    7575                );
    76                 $testcat = self::$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
    7979                $testcat2_array = array(
    class Tests_Category extends WP_UnitTestCase { 
    8282                        'description' => 'Category Test',
    8383                        'parent' => $testcat->term_id
    8484                );
    85                 $testcat2 = self::$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
    8888                // unset properties to enable validation of object
    class Tests_Category extends WP_UnitTestCase { 
    145145        function test_get_cat_name() {
    146146
    147147                // create Test Category
    148                 $testcat = self::$factory->category->create_and_get(
     148                $testcat = self::factory()->category->create_and_get(
    149149                        array(
    150150                                'slug' => 'testcat',
    151151                                'name' => 'Test Category 1'
    class Tests_Category extends WP_UnitTestCase { 
    165165        function test_get_cat_ID() {
    166166
    167167                // create Test Category
    168                 $testcat = self::$factory->category->create_and_get(
     168                $testcat = self::factory()->category->create_and_get(
    169169                        array(
    170170                                'slug' => 'testcat',
    171171                                'name' => 'Test Category 1'
    class Tests_Category extends WP_UnitTestCase { 
    185185        function test_get_category_by_path() {
    186186
    187187                // create Test Categories
    188                 $root_id = self::$factory->category->create(
     188                $root_id = self::factory()->category->create(
    189189                        array(
    190190                                'slug' => 'root',
    191191                        )
    192192                );
    193                 $root_cat_id = self::$factory->category->create(
     193                $root_cat_id = self::factory()->category->create(
    194194                        array(
    195195                                'slug' => 'cat',
    196196                                'parent' => $root_id
    197197                        )
    198198                );
    199                 $root_cat_cat_id = self::$factory->category->create(
     199                $root_cat_cat_id = self::factory()->category->create(
    200200                        array(
    201201                                'slug' => 'cat', //note this is modified on create
    202202                                'parent' => $root_cat_id
    203203                        )
    204204                );
    205                 $root_path_id = self::$factory->category->create(
     205                $root_path_id = self::factory()->category->create(
    206206                        array(
    207207                                'slug' => 'path',
    208208                                'parent' => $root_id
    209209                        )
    210210                );
    211                 $root_path_cat_id = self::$factory->category->create(
     211                $root_path_cat_id = self::factory()->category->create(
    212212                        array(
    213213                                'slug' => 'cat', //note this is modified on create
    214214                                'parent' => $root_path_id
    215215                        )
    216216                );
    217                 $root_level_id = self::$factory->category->create(
     217                $root_level_id = self::factory()->category->create(
    218218                        array(
    219219                                'slug' => 'level-1',
    220220                                'parent' => $root_id
    221221                        )
    222222                );
    223                 $root_level_cat_id = self::$factory->category->create(
     223                $root_level_cat_id = self::factory()->category->create(
    224224                        array(
    225225                                'slug' => 'cat', //note this is modified on create
    226226                                'parent' => $root_level_id
    class Tests_Category extends WP_UnitTestCase { 
    248248         */
    249249        public function test_wp_dropdown_categories_value_field_should_default_to_term_id() {
    250250                // Create a test category.
    251                 $cat_id = self::$factory->category->create( array(
     251                $cat_id = self::factory()->category->create( array(
    252252                        'name' => 'Test Category',
    253253                        'slug' => 'test_category',
    254254                ) );
    class Tests_Category extends WP_UnitTestCase { 
    268268         */
    269269        public function test_wp_dropdown_categories_value_field_term_id() {
    270270                // Create a test category.
    271                 $cat_id = self::$factory->category->create( array(
     271                $cat_id = self::factory()->category->create( array(
    272272                        'name' => 'Test Category',
    273273                        'slug' => 'test_category',
    274274                ) );
    class Tests_Category extends WP_UnitTestCase { 
    289289         */
    290290        public function test_wp_dropdown_categories_value_field_slug() {
    291291                // Create a test category.
    292                 $cat_id = self::$factory->category->create( array(
     292                $cat_id = self::factory()->category->create( array(
    293293                        'name' => 'Test Category',
    294294                        'slug' => 'test_category',
    295295                ) );
    class Tests_Category extends WP_UnitTestCase { 
    310310         */
    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 = self::$factory->category->create( array(
     313                $cat_id = self::factory()->category->create( array(
    314314                        'name' => 'Test Category',
    315315                        'slug' => 'test_category',
    316316                ) );
    class Tests_Category extends WP_UnitTestCase { 
    330330         * @ticket 32330
    331331         */
    332332        public function test_wp_dropdown_categories_selected_should_respect_custom_value_field() {
    333                 $c1 = self::$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 = self::$factory->category->create( array(
     338                $c2 = self::factory()->category->create( array(
    339339                        'name' => 'Test Category 2',
    340340                        'slug' => 'test_category_2',
    341341                ) );
    class Tests_Category extends WP_UnitTestCase { 
    354354         * @ticket 33452
    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 = self::$factory->category->create_many( 3 );
     357                $cats = self::factory()->category->create_many( 3 );
    358358
    359359                $found = wp_dropdown_categories( array(
    360360                        'echo' => 0,
    class Tests_Category extends WP_UnitTestCase { 
    375375         * @ticket 33452
    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 = self::$factory->category->create_many( 3 );
     378                $cats = self::factory()->category->create_many( 3 );
    379379
    380380                $found = wp_dropdown_categories( array(
    381381                        'echo' => 0,
  • tests/phpunit/tests/category/getCategoryParents.php

    diff --git tests/phpunit/tests/category/getCategoryParents.php tests/phpunit/tests/category/getCategoryParents.php
    index b9c6998..9805de9 100644
    class Tests_Category_GetCategoryParents extends WP_UnitTestCase { 
    1010        public function setUp() {
    1111                parent::setUp();
    1212
    13                 $this->c1 = self::$factory->category->create_and_get();
    14                 $this->c2 = self::$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                ) );
    1717        }
    class Tests_Category_GetCategoryParents extends WP_UnitTestCase { 
    5151        }
    5252
    5353        public function test_visited() {
    54                 $c3 = self::$factory->category->create_and_get( array(
     54                $c3 = self::factory()->category->create_and_get( array(
    5555                        'parent' => $this->c2->term_id,
    5656                ) );
    57                 $c4 = self::$factory->category->create_and_get( array(
     57                $c4 = self::factory()->category->create_and_get( array(
    5858                        'parent' => $c3->term_id,
    5959                ) );
    6060
  • tests/phpunit/tests/category/wpListCategories.php

    diff --git tests/phpunit/tests/category/wpListCategories.php tests/phpunit/tests/category/wpListCategories.php
    index 0a49f0f..048f72d 100644
     
    55 */
    66class Tests_Category_WpListCategories extends WP_UnitTestCase {
    77        public function test_class() {
    8                 $c = self::$factory->category->create();
     8                $c = self::factory()->category->create();
    99
    1010                $found = wp_list_categories( array(
    1111                        'hide_empty' => false,
    class Tests_Category_WpListCategories extends WP_UnitTestCase { 
    1616        }
    1717
    1818        public function test_class_containing_current_cat() {
    19                 $c1 = self::$factory->category->create();
    20                 $c2 = self::$factory->category->create();
     19                $c1 = self::factory()->category->create();
     20                $c2 = self::factory()->category->create();
    2121
    2222                $found = wp_list_categories( array(
    2323                        'hide_empty' => false,
    class Tests_Category_WpListCategories extends WP_UnitTestCase { 
    3030        }
    3131
    3232        public function test_class_containing_current_cat_parent() {
    33                 $c1 = self::$factory->category->create();
    34                 $c2 = self::$factory->category->create( array(
     33                $c1 = self::factory()->category->create();
     34                $c2 = self::factory()->category->create( array(
    3535                        'parent' => $c1,
    3636                ) );
    3737
    class Tests_Category_WpListCategories extends WP_UnitTestCase { 
    4949         * @ticket 33565
    5050         */
    5151        public function test_current_category_should_accept_an_array_of_ids() {
    52                 $cats = self::$factory->category->create_many( 3 );
     52                $cats = self::factory()->category->create_many( 3 );
    5353
    5454                $found = wp_list_categories( array(
    5555                        'echo' => false,
    class Tests_Category_WpListCategories extends WP_UnitTestCase { 
    6666         * @ticket 16792
    6767         */
    6868        public function test_should_not_create_element_when_cat_name_is_filtered_to_empty_string() {
    69                 $c1 = self::$factory->category->create( array(
     69                $c1 = self::factory()->category->create( array(
    7070                        'name' => 'Test Cat 1',
    7171                ) );
    72                 $c2 = self::$factory->category->create( array(
     72                $c2 = self::factory()->category->create( array(
    7373                        'name' => 'Test Cat 2',
    7474                ) );
    7575
    class Tests_Category_WpListCategories extends WP_UnitTestCase { 
    8888        }
    8989
    9090        public function test_show_option_all_link_should_go_to_home_page_when_show_on_front_is_false() {
    91                 $cats = self::$factory->category->create_many( 2 );
     91                $cats = self::factory()->category->create_many( 2 );
    9292
    9393                $found = wp_list_categories( array(
    9494                        'echo' => false,
    class Tests_Category_WpListCategories extends WP_UnitTestCase { 
    101101        }
    102102
    103103        public function test_show_option_all_link_should_respect_page_for_posts() {
    104                 $cats = self::$factory->category->create_many( 2 );
    105                 $p = self::$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' );
    108108                update_option( 'page_for_posts', $p );
    class Tests_Category_WpListCategories extends WP_UnitTestCase { 
    125125                register_post_type( 'wptests_pt2', array( 'has_archive' => true ) );
    126126                register_taxonomy( 'wptests_tax', array( 'foo', 'wptests_pt', 'wptests_pt2' ) );
    127127
    128                 $terms = self::$factory->term->create_many( 2, array(
     128                $terms = self::factory()->term->create_many( 2, array(
    129129                        'taxonomy' => 'wptests_tax',
    130130                ) );
    131131
    class Tests_Category_WpListCategories extends WP_UnitTestCase { 
    149149                register_post_type( 'wptests_pt2', array( 'has_archive' => true ) );
    150150                register_taxonomy( 'wptests_tax', array( 'foo', 'wptests_pt', 'wptests_pt2' ) );
    151151
    152                 $terms = self::$factory->term->create_many( 2, array(
     152                $terms = self::factory()->term->create_many( 2, array(
    153153                        'taxonomy' => 'wptests_tax',
    154154                ) );
    155155
    class Tests_Category_WpListCategories extends WP_UnitTestCase { 
    170170                register_post_type( 'wptests_pt2', array( 'has_archive' => true ) );
    171171                register_taxonomy( 'wptests_tax', array( 'foo', 'wptests_pt', 'post', 'wptests_pt2' ) );
    172172
    173                 $terms = self::$factory->term->create_many( 2, array(
     173                $terms = self::factory()->term->create_many( 2, array(
    174174                        'taxonomy' => 'wptests_tax',
    175175                ) );
    176176
    class Tests_Category_WpListCategories extends WP_UnitTestCase { 
    191191                register_post_type( 'wptests_pt2', array( 'has_archive' => false ) );
    192192                register_taxonomy( 'wptests_tax', array( 'foo', 'wptests_pt', 'wptests_pt2' ) );
    193193
    194                 $terms = self::$factory->term->create_many( 2, array(
     194                $terms = self::factory()->term->create_many( 2, array(
    195195                        'taxonomy' => 'wptests_tax',
    196196                ) );
    197197
    class Tests_Category_WpListCategories extends WP_UnitTestCase { 
    254254         * @ticket 33460
    255255         */
    256256        public function test_hide_title_if_empty_should_be_ignored_when_category_list_is_not_empty() {
    257                 $cat = self::$factory->category->create();
     257                $cat = self::factory()->category->create();
    258258
    259259                $found = wp_list_categories( array(
    260260                        'echo' => false,
    class Tests_Category_WpListCategories extends WP_UnitTestCase { 
    269269         * @ticket 12981
    270270         */
    271271        public function test_exclude_tree_should_be_respected() {
    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 ) );
     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 );
    277277
    class Tests_Category_WpListCategories extends WP_UnitTestCase { 
    286286         * @ticket 12981
    287287         */
    288288        public function test_exclude_tree_should_be_merged_with_exclude() {
    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 ) );
     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 );
    296296
  • tests/phpunit/tests/comment-submission.php

    diff --git tests/phpunit/tests/comment-submission.php tests/phpunit/tests/comment-submission.php
    index 1fed4f4..96ba7a2 100644
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    3838
    3939                $this->assertSame( 0, did_action( $error ) );
    4040
    41                 $post = self::$factory->post->create_and_get( array(
     41                $post = self::factory()->post->create_and_get( array(
    4242                        'comment_status' => 'closed',
    4343                ) );
    4444                $data = array(
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    5858
    5959                $this->assertSame( 0, did_action( $error ) );
    6060
    61                 $post = self::$factory->post->create_and_get();
     61                $post = self::factory()->post->create_and_get();
    6262                wp_trash_post( $post );
    6363                $data = array(
    6464                        'comment_post_ID' => $post->ID,
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    7777
    7878                $this->assertSame( 0, did_action( $error ) );
    7979
    80                 $post = self::$factory->post->create_and_get( array(
     80                $post = self::factory()->post->create_and_get( array(
    8181                        'post_status' => 'draft',
    8282                ) );
    8383                $data = array(
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    9898
    9999                $this->assertSame( 0, did_action( $error ) );
    100100
    101                 $post = self::$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                ) );
    104104
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    121121
    122122                $this->assertSame( 0, did_action( $error ) );
    123123
    124                 $post = self::$factory->post->create_and_get( array(
     124                $post = self::factory()->post->create_and_get( array(
    125125                        'post_password' => 'password',
    126126                ) );
    127127                $data = array(
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    142142
    143143                $_COOKIE['wp-postpass_' . COOKIEHASH] = $hasher->HashPassword( $password );
    144144
    145                 $post = self::$factory->post->create_and_get( array(
     145                $post = self::factory()->post->create_and_get( array(
    146146                        'post_password' => $password,
    147147                ) );
    148148                $data = array(
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    162162
    163163        public function test_submitting_valid_comment_as_logged_in_user_succeeds() {
    164164
    165                 $user = self::$factory->user->create_and_get( array(
     165                $user = self::factory()->user->create_and_get( array(
    166166                        'user_url' => 'http://user.example.org'
    167167                ) );
    168168
    169169                wp_set_current_user( $user->ID );
    170170
    171                 $post = self::$factory->post->create_and_get();
     171                $post = self::factory()->post->create_and_get();
    172172                $data = array(
    173173                        'comment_post_ID' => $post->ID,
    174174                        'comment'         => 'Comment',
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    187187
    188188        public function test_submitting_valid_comment_anonymously_succeeds() {
    189189
    190                 $post = self::$factory->post->create_and_get();
     190                $post = self::factory()->post->create_and_get();
    191191                $data = array(
    192192                        'comment_post_ID' => $post->ID,
    193193                        'comment'         => 'Comment',
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    214214         */
    215215        public function test_submitting_comment_handles_slashes_correctly_handles_slashes() {
    216216
    217                 $post = self::$factory->post->create_and_get();
     217                $post = self::factory()->post->create_and_get();
    218218                $data = array(
    219219                        'comment_post_ID' => $post->ID,
    220220                        'comment'         => 'Comment with 1 slash: \\',
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    236236
    237237                $error = 'not_logged_in';
    238238
    239                 $post = self::$factory->post->create_and_get( array(
     239                $post = self::factory()->post->create_and_get( array(
    240240                        'post_status' => 'private',
    241241                ) );
    242242                $data = array(
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    252252
    253253        public function test_submitting_comment_to_own_private_post_succeeds() {
    254254
    255                 $user = self::$factory->user->create_and_get();
     255                $user = self::factory()->user->create_and_get();
    256256
    257257                wp_set_current_user( $user->ID );
    258258
    259                 $post = self::$factory->post->create_and_get( array(
     259                $post = self::factory()->post->create_and_get( array(
    260260                        'post_status' => 'private',
    261261                        'post_author' => $user->ID,
    262262                ) );
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    274274
    275275        public function test_submitting_comment_to_accessible_private_post_succeeds() {
    276276
    277                 $author = self::$factory->user->create_and_get( array(
     277                $author = self::factory()->user->create_and_get( array(
    278278                        'role' => 'author',
    279279                ) );
    280                 $user = self::$factory->user->create_and_get( array(
     280                $user = self::factory()->user->create_and_get( array(
    281281                        'role' => 'editor',
    282282                ) );
    283283
    284284                wp_set_current_user( $user->ID );
    285285
    286                 $post = self::$factory->post->create_and_get( array(
     286                $post = self::factory()->post->create_and_get( array(
    287287                        'post_status' => 'private',
    288288                        'post_author' => $author->ID,
    289289                ) );
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    301301
    302302        public function test_anonymous_user_cannot_comment_unfiltered_html() {
    303303
    304                 $post = self::$factory->post->create_and_get();
     304                $post = self::factory()->post->create_and_get();
    305305                $data = array(
    306306                        'comment_post_ID' => $post->ID,
    307307                        'comment'         => 'Comment <script>alert(document.cookie);</script>',
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    318318
    319319        public function test_unprivileged_user_cannot_comment_unfiltered_html() {
    320320
    321                 $user = self::$factory->user->create_and_get( array(
     321                $user = self::factory()->user->create_and_get( array(
    322322                        'role' => 'author',
    323323                ) );
    324324                wp_set_current_user( $user->ID );
    325325
    326326                $this->assertFalse( current_user_can( 'unfiltered_html' ) );
    327327
    328                 $post = self::$factory->post->create_and_get();
     328                $post = self::factory()->post->create_and_get();
    329329                $data = array(
    330330                        'comment_post_ID' => $post->ID,
    331331                        'comment'         => 'Comment <script>alert(document.cookie);</script>',
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    340340
    341341        public function test_unprivileged_user_cannot_comment_unfiltered_html_even_with_valid_nonce() {
    342342
    343                 $user = self::$factory->user->create_and_get( array(
     343                $user = self::factory()->user->create_and_get( array(
    344344                        'role' => 'author',
    345345                ) );
    346346                wp_set_current_user( $user->ID );
    347347
    348348                $this->assertFalse( current_user_can( 'unfiltered_html' ) );
    349349
    350                 $post   = self::$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 );
    353353
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    370370
    371371                $this->assertFalse( defined( 'DISALLOW_UNFILTERED_HTML' ) );
    372372
    373                 $user = self::$factory->user->create_and_get( array(
     373                $user = self::factory()->user->create_and_get( array(
    374374                        'role' => 'editor',
    375375                ) );
    376376
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    384384
    385385                $this->assertTrue( current_user_can( 'unfiltered_html' ) );
    386386
    387                 $post   = self::$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 );
    390390
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    405405
    406406        public function test_privileged_user_cannot_comment_unfiltered_html_without_valid_nonce() {
    407407
    408                 $user = self::$factory->user->create_and_get( array(
     408                $user = self::factory()->user->create_and_get( array(
    409409                        'role' => 'editor',
    410410                ) );
    411411
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    419419
    420420                $this->assertTrue( current_user_can( 'unfiltered_html' ) );
    421421
    422                 $post   = self::$factory->post->create_and_get();
     422                $post   = self::factory()->post->create_and_get();
    423423                $data = array(
    424424                        'comment_post_ID' => $post->ID,
    425425                        'comment'         => 'Comment <script>alert(document.cookie);</script>',
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    439439                $_comment_registration = get_option( 'comment_registration' );
    440440                update_option( 'comment_registration', '1' );
    441441
    442                 $post = self::$factory->post->create_and_get();
     442                $post = self::factory()->post->create_and_get();
    443443                $data = array(
    444444                        'comment_post_ID' => $post->ID,
    445445                );
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    459459                $_require_name_email = get_option( 'require_name_email' );
    460460                update_option( 'require_name_email', '1' );
    461461
    462                 $post = self::$factory->post->create_and_get();
     462                $post = self::factory()->post->create_and_get();
    463463                $data = array(
    464464                        'comment_post_ID' => $post->ID,
    465465                        'comment'         => 'Comment',
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    481481                $_require_name_email = get_option( 'require_name_email' );
    482482                update_option( 'require_name_email', '1' );
    483483
    484                 $post = self::$factory->post->create_and_get();
     484                $post = self::factory()->post->create_and_get();
    485485                $data = array(
    486486                        'comment_post_ID' => $post->ID,
    487487                        'comment'         => 'Comment',
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    503503                $_require_name_email = get_option( 'require_name_email' );
    504504                update_option( 'require_name_email', '1' );
    505505
    506                 $post = self::$factory->post->create_and_get();
     506                $post = self::factory()->post->create_and_get();
    507507                $data = array(
    508508                        'comment_post_ID' => $post->ID,
    509509                        'comment'         => 'Comment',
    class Tests_Comment_Submission extends WP_UnitTestCase { 
    523523
    524524                $error = 'require_valid_comment';
    525525
    526                 $post = self::$factory->post->create_and_get();
     526                $post = self::factory()->post->create_and_get();
    527527                $data = array(
    528528                        'comment_post_ID' => $post->ID,
    529529                        'comment'         => '',
  • tests/phpunit/tests/comment.php

    diff --git tests/phpunit/tests/comment.php tests/phpunit/tests/comment.php
    index a059149..cf55e07 100644
    class Tests_Comment extends WP_UnitTestCase { 
    2121        }
    2222
    2323        function test_wp_update_comment() {
    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 );
     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 );
    2929                $comment = get_comment( $comments[0] );
    class Tests_Comment extends WP_UnitTestCase { 
    3939         * @ticket 30627
    4040         */
    4141        function test_wp_update_comment_updates_comment_type() {
    42                 $comment_id = self::$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' ) );
    4545
    class Tests_Comment extends WP_UnitTestCase { 
    5151         * @ticket 30307
    5252         */
    5353        function test_wp_update_comment_updates_user_id() {
    54                 $comment_id = self::$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 ) );
    5757
    class Tests_Comment extends WP_UnitTestCase { 
    6060        }
    6161
    6262        public function test_get_approved_comments() {
    63                 $ca1 = self::$factory->comment->create( array(
     63                $ca1 = self::factory()->comment->create( array(
    6464                        'comment_post_ID' => self::$post_id, 'comment_approved' => '1'
    6565                ) );
    66                 $ca2 = self::$factory->comment->create( array(
     66                $ca2 = self::factory()->comment->create( array(
    6767                        'comment_post_ID' => self::$post_id, 'comment_approved' => '1'
    6868                ) );
    69                 $ca3 = self::$factory->comment->create( array(
     69                $ca3 = self::factory()->comment->create( array(
    7070                        'comment_post_ID' => self::$post_id, 'comment_approved' => '0'
    7171                ) );
    72                 $c2 = self::$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 = self::$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 = self::$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 = self::$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                ) );
    8484
    class Tests_Comment extends WP_UnitTestCase { 
    9292         * @ticket 30412
    9393         */
    9494        public function test_get_approved_comments_with_post_id_0_should_return_empty_array() {
    95                 $ca1 = self::$factory->comment->create( array(
     95                $ca1 = self::factory()->comment->create( array(
    9696                        'comment_post_ID' => self::$post_id, 'comment_approved' => '1'
    9797                ) );
    9898
    class Tests_Comment extends WP_UnitTestCase { 
    256256         * @ticket 32566
    257257         */
    258258        public function test_wp_notify_moderator_should_not_throw_notice_when_post_author_is_0() {
    259                 $p = self::$factory->post->create( array(
     259                $p = self::factory()->post->create( array(
    260260                        'post_author' => 0,
    261261                ) );
    262262
    263                 $c = self::$factory->comment->create( array(
     263                $c = self::factory()->comment->create( array(
    264264                        'comment_post_ID' => $p,
    265265                ) );
    266266
    class Tests_Comment extends WP_UnitTestCase { 
    271271         * @ticket 33587
    272272         */
    273273        public function test_wp_new_comment_notify_postauthor_should_not_send_email_when_comment_has_been_marked_as_spam() {
    274                 $c = self::$factory->comment->create( array(
     274                $c = self::factory()->comment->create( array(
    275275                        'comment_post_ID' => self::$post_id,
    276276                        'comment_approved' => 'spam',
    277277                ) );
    class Tests_Comment extends WP_UnitTestCase { 
    284284         * @ticket 12431
    285285         */
    286286        public function test_wp_new_comment_with_meta() {
    287                 $c = self::$factory->comment->create( array(
     287                $c = self::factory()->comment->create( array(
    288288                        'comment_approved' => '1',
    289289                        'comment_meta' => array(
    290290                                'food' => 'taco',
    class Tests_Comment extends WP_UnitTestCase { 
    299299         * @ticket 8071
    300300         */
    301301        public function test_wp_comment_get_children_should_fill_children() {
    302                 $c1 = self::$factory->comment->create( array(
     302                $c1 = self::factory()->comment->create( array(
    303303                        'comment_post_ID' => self::$post_id,
    304304                        'comment_approved' => '1',
    305305                ) );
    306306
    307                 $c2 = self::$factory->comment->create( array(
     307                $c2 = self::factory()->comment->create( array(
    308308                        'comment_post_ID' => self::$post_id,
    309309                        'comment_approved' => '1',
    310310                        'comment_parent' => $c1,
    311311                ) );
    312312
    313                 $c3 = self::$factory->comment->create( array(
     313                $c3 = self::factory()->comment->create( array(
    314314                        'comment_post_ID' => self::$post_id,
    315315                        'comment_approved' => '1',
    316316                        'comment_parent' => $c2,
    317317                ) );
    318318
    319                 $c4 = self::$factory->comment->create( array(
     319                $c4 = self::factory()->comment->create( array(
    320320                        'comment_post_ID' => self::$post_id,
    321321                        'comment_approved' => '1',
    322322                        'comment_parent' => $c1,
    323323                ) );
    324324
    325                 $c5 = self::$factory->comment->create( array(
     325                $c5 = self::factory()->comment->create( array(
    326326                        'comment_post_ID' => self::$post_id,
    327327                        'comment_approved' => '1',
    328328                ) );
    329329
    330                 $c6 = self::$factory->comment->create( array(
     330                $c6 = self::factory()->comment->create( array(
    331331                        'comment_post_ID' => self::$post_id,
    332332                        'comment_approved' => '1',
    333333                        'comment_parent' => $c5,
    class Tests_Comment extends WP_UnitTestCase { 
    347347         * @group 27571
    348348         */
    349349        public function test_post_properties_should_be_lazyloaded() {
    350                 $c = self::$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 );
    353353                $comment = get_comment( $c );
  • tests/phpunit/tests/comment/checkComment.php

    diff --git tests/phpunit/tests/comment/checkComment.php tests/phpunit/tests/comment/checkComment.php
    index 40bca3a..576b838 100644
    class Tests_Comment_CheckComment extends WP_UnitTestCase { 
    3131        }
    3232
    3333        public function test_should_return_true_when_comment_whitelist_is_enabled_and_author_has_approved_comment() {
    34                 $post_id = self::$factory->post->create();
     34                $post_id = self::factory()->post->create();
    3535                $prev_args = array(
    3636                        'comment_post_ID'      => $post_id,
    3737                        'comment_content'      => 'Can we build it?',
    class Tests_Comment_CheckComment extends WP_UnitTestCase { 
    3939                        'comment_author_email' => 'bob@example.com',
    4040                        'comment_author'       => 'BobtheBuilder',
    4141                );
    42                 $prev_comment_id = self::$factory->comment->create( $prev_args );
     42                $prev_comment_id = self::factory()->comment->create( $prev_args );
    4343
    4444                update_option( 'comment_whitelist', 1 );
    4545
  • tests/phpunit/tests/comment/commentForm.php

    diff --git tests/phpunit/tests/comment/commentForm.php tests/phpunit/tests/comment/commentForm.php
    index bd91dbf..c6bb43f 100644
     
    55 */
    66class Tests_Comment_CommentForm extends WP_UnitTestCase {
    77        public function test_default_markup_for_submit_button_and_wrapper() {
    8                 $p = self::$factory->post->create();
     8                $p = self::factory()->post->create();
    99
    1010                $args = array(
    1111                        'name_submit' => 'foo-name',
    class Tests_Comment_CommentForm extends WP_UnitTestCase { 
    2121        }
    2222
    2323        public function test_custom_submit_button() {
    24                 $p = self::$factory->post->create();
     24                $p = self::factory()->post->create();
    2525
    2626                $args = array(
    2727                        'name_submit' => 'foo-name',
    class Tests_Comment_CommentForm extends WP_UnitTestCase { 
    3737        }
    3838
    3939        public function test_custom_submit_field() {
    40                 $p = self::$factory->post->create();
     40                $p = self::factory()->post->create();
    4141
    4242                $args = array(
    4343                        'name_submit' => 'foo-name',
    class Tests_Comment_CommentForm extends WP_UnitTestCase { 
    5757         * @ticket 32312
    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 = self::$factory->post->create();
     60                $p = self::factory()->post->create();
    6161
    6262                $args = array(
    6363                        'name_submit' => 'foo-name',
  • tests/phpunit/tests/comment/commentsTemplate.php

    diff --git tests/phpunit/tests/comment/commentsTemplate.php tests/phpunit/tests/comment/commentsTemplate.php
    index 31f7cbf..3e134ad 100644
    class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 
    1212         */
    1313        public function test_should_respect_comment_order_asc_when_default_comments_page_is_newest() {
    1414                $now = time();
    15                 $p = self::$factory->post->create();
    16                 $comment_1 = self::$factory->comment->create( array(
     15                $p = self::factory()->post->create();
     16                $comment_1 = self::factory()->comment->create( array(
    1717                        'comment_post_ID' => $p,
    1818                        'comment_content' => '1',
    1919                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    2020                ) );
    21                 $comment_2 = self::$factory->comment->create( array(
     21                $comment_2 = self::factory()->comment->create( array(
    2222                        'comment_post_ID' => $p,
    2323                        'comment_content' => '2',
    2424                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 
    4242         */
    4343        public function test_should_respect_comment_order_desc_when_default_comments_page_is_newest() {
    4444                $now = time();
    45                 $p = self::$factory->post->create();
    46                 $comment_1 = self::$factory->comment->create( array(
     45                $p = self::factory()->post->create();
     46                $comment_1 = self::factory()->comment->create( array(
    4747                        'comment_post_ID' => $p,
    4848                        'comment_content' => '1',
    4949                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    5050                ) );
    51                 $comment_2 = self::$factory->comment->create( array(
     51                $comment_2 = self::factory()->comment->create( array(
    5252                        'comment_post_ID' => $p,
    5353                        'comment_content' => '2',
    5454                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 
    7272         */
    7373        public function test_should_respect_comment_order_asc_when_default_comments_page_is_oldest() {
    7474                $now = time();
    75                 $p = self::$factory->post->create();
    76                 $comment_1 = self::$factory->comment->create( array(
     75                $p = self::factory()->post->create();
     76                $comment_1 = self::factory()->comment->create( array(
    7777                        'comment_post_ID' => $p,
    7878                        'comment_content' => '1',
    7979                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    8080                ) );
    81                 $comment_2 = self::$factory->comment->create( array(
     81                $comment_2 = self::factory()->comment->create( array(
    8282                        'comment_post_ID' => $p,
    8383                        'comment_content' => '2',
    8484                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 
    102102         */
    103103        public function test_should_respect_comment_order_desc_when_default_comments_page_is_oldest() {
    104104                $now = time();
    105                 $p = self::$factory->post->create();
    106                 $comment_1 = self::$factory->comment->create( array(
     105                $p = self::factory()->post->create();
     106                $comment_1 = self::factory()->comment->create( array(
    107107                        'comment_post_ID' => $p,
    108108                        'comment_content' => '1',
    109109                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    110110                ) );
    111                 $comment_2 = self::$factory->comment->create( array(
     111                $comment_2 = self::factory()->comment->create( array(
    112112                        'comment_post_ID' => $p,
    113113                        'comment_content' => '2',
    114114                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 
    132132         */
    133133        public function test_should_respect_comment_order_asc_when_default_comments_page_is_newest_on_subsequent_pages() {
    134134                $now = time();
    135                 $p = self::$factory->post->create();
    136                 $comment_1 = self::$factory->comment->create( array(
     135                $p = self::factory()->post->create();
     136                $comment_1 = self::factory()->comment->create( array(
    137137                        'comment_post_ID' => $p,
    138138                        'comment_content' => '1',
    139139                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    140140                ) );
    141                 $comment_2 = self::$factory->comment->create( array(
     141                $comment_2 = self::factory()->comment->create( array(
    142142                        'comment_post_ID' => $p,
    143143                        'comment_content' => '2',
    144144                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    145145                ) );
    146                 $comment_3 = self::$factory->comment->create( array(
     146                $comment_3 = self::factory()->comment->create( array(
    147147                        'comment_post_ID' => $p,
    148148                        'comment_content' => '3',
    149149                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
    150150                ) );
    151                 $comment_4 = self::$factory->comment->create( array(
     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 = self::$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 = self::$factory->comment->create( array(
     161                $comment_6 = self::factory()->comment->create( array(
    162162                        'comment_post_ID' => $p,
    163163                        'comment_content' => '4',
    164164                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 600 ),
    class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 
    187187         */
    188188        public function test_should_respect_comment_order_desc_when_default_comments_page_is_newest_on_subsequent_pages() {
    189189                $now = time();
    190                 $p = self::$factory->post->create();
    191                 $comment_1 = self::$factory->comment->create( array(
     190                $p = self::factory()->post->create();
     191                $comment_1 = self::factory()->comment->create( array(
    192192                        'comment_post_ID' => $p,
    193193                        'comment_content' => '1',
    194194                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    195195                ) );
    196                 $comment_2 = self::$factory->comment->create( array(
     196                $comment_2 = self::factory()->comment->create( array(
    197197                        'comment_post_ID' => $p,
    198198                        'comment_content' => '2',
    199199                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    200200                ) );
    201                 $comment_3 = self::$factory->comment->create( array(
     201                $comment_3 = self::factory()->comment->create( array(
    202202                        'comment_post_ID' => $p,
    203203                        'comment_content' => '3',
    204204                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
    205205                ) );
    206                 $comment_4 = self::$factory->comment->create( array(
     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 = self::$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 = self::$factory->comment->create( array(
     216                $comment_6 = self::factory()->comment->create( array(
    217217                        'comment_post_ID' => $p,
    218218                        'comment_content' => '4',
    219219                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 600 ),
    class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 
    242242         */
    243243        public function test_should_respect_comment_order_asc_when_default_comments_page_is_oldest_on_subsequent_pages() {
    244244                $now = time();
    245                 $p = self::$factory->post->create();
    246                 $comment_1 = self::$factory->comment->create( array(
     245                $p = self::factory()->post->create();
     246                $comment_1 = self::factory()->comment->create( array(
    247247                        'comment_post_ID' => $p,
    248248                        'comment_content' => '1',
    249249                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    250250                ) );
    251                 $comment_2 = self::$factory->comment->create( array(
     251                $comment_2 = self::factory()->comment->create( array(
    252252                        'comment_post_ID' => $p,
    253253                        'comment_content' => '2',
    254254                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    255255                ) );
    256                 $comment_3 = self::$factory->comment->create( array(
     256                $comment_3 = self::factory()->comment->create( array(
    257257                        'comment_post_ID' => $p,
    258258                        'comment_content' => '3',
    259259                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
    260260                ) );
    261                 $comment_4 = self::$factory->comment->create( array(
     261                $comment_4 = self::factory()->comment->create( array(
    262262                        'comment_post_ID' => $p,
    263263                        'comment_content' => '4',
    264264                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ),
    class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 
    287287         */
    288288        public function test_should_respect_comment_order_desc_when_default_comments_page_is_oldest_on_subsequent_pages() {
    289289                $now = time();
    290                 $p = self::$factory->post->create();
    291                 $comment_1 = self::$factory->comment->create( array(
     290                $p = self::factory()->post->create();
     291                $comment_1 = self::factory()->comment->create( array(
    292292                        'comment_post_ID' => $p,
    293293                        'comment_content' => '1',
    294294                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    295295                ) );
    296                 $comment_2 = self::$factory->comment->create( array(
     296                $comment_2 = self::factory()->comment->create( array(
    297297                        'comment_post_ID' => $p,
    298298                        'comment_content' => '2',
    299299                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    300300                ) );
    301                 $comment_3 = self::$factory->comment->create( array(
     301                $comment_3 = self::factory()->comment->create( array(
    302302                        'comment_post_ID' => $p,
    303303                        'comment_content' => '3',
    304304                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
    305305                ) );
    306                 $comment_4 = self::$factory->comment->create( array(
     306                $comment_4 = self::factory()->comment->create( array(
    307307                        'comment_post_ID' => $p,
    308308                        'comment_content' => '4',
    309309                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ),
    class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 
    334334         */
    335335        public function test_last_page_of_comments_should_be_full_when_default_comment_page_is_newest() {
    336336                $now = time();
    337                 $p = self::$factory->post->create();
    338                 $comment_1 = self::$factory->comment->create( array(
     337                $p = self::factory()->post->create();
     338                $comment_1 = self::factory()->comment->create( array(
    339339                        'comment_post_ID' => $p,
    340340                        'comment_content' => '1',
    341341                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    342342                ) );
    343                 $comment_2 = self::$factory->comment->create( array(
     343                $comment_2 = self::factory()->comment->create( array(
    344344                        'comment_post_ID' => $p,
    345345                        'comment_content' => '2',
    346346                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    347347                ) );
    348                 $comment_3 = self::$factory->comment->create( array(
     348                $comment_3 = self::factory()->comment->create( array(
    349349                        'comment_post_ID' => $p,
    350350                        'comment_content' => '3',
    351351                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
    class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 
    376376         */
    377377        public function test_first_page_of_comments_should_have_remainder_when_default_comments_page_is_newest() {
    378378                $now = time();
    379                 $p = self::$factory->post->create();
    380                 $comment_1 = self::$factory->comment->create( array(
     379                $p = self::factory()->post->create();
     380                $comment_1 = self::factory()->comment->create( array(
    381381                        'comment_post_ID' => $p,
    382382                        'comment_content' => '1',
    383383                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    384384                ) );
    385                 $comment_2 = self::$factory->comment->create( array(
     385                $comment_2 = self::factory()->comment->create( array(
    386386                        'comment_post_ID' => $p,
    387387                        'comment_content' => '2',
    388388                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    389389                ) );
    390                 $comment_3 = self::$factory->comment->create( array(
     390                $comment_3 = self::factory()->comment->create( array(
    391391                        'comment_post_ID' => $p,
    392392                        'comment_content' => '3',
    393393                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
    class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 
    416416         */
    417417        public function test_comment_permalinks_should_be_correct_when_using_default_display_callback_with_default_comment_page_oldest() {
    418418                $now = time();
    419                 $p = self::$factory->post->create();
    420                 $comment_1 = self::$factory->comment->create( array(
     419                $p = self::factory()->post->create();
     420                $comment_1 = self::factory()->comment->create( array(
    421421                        'comment_post_ID' => $p,
    422422                        'comment_content' => '1',
    423423                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    424424                ) );
    425                 $comment_2 = self::$factory->comment->create( array(
     425                $comment_2 = self::factory()->comment->create( array(
    426426                        'comment_post_ID' => $p,
    427427                        'comment_content' => '2',
    428428                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    429429                ) );
    430                 $comment_3 = self::$factory->comment->create( array(
     430                $comment_3 = self::factory()->comment->create( array(
    431431                        'comment_post_ID' => $p,
    432432                        'comment_content' => '3',
    433433                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
    434434                ) );
    435                 $comment_4 = self::$factory->comment->create( array(
     435                $comment_4 = self::factory()->comment->create( array(
    436436                        'comment_post_ID' => $p,
    437437                        'comment_content' => '4',
    438438                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ),
    class Tests_Comment_CommentsTemplate extends WP_UnitTestCase { 
    480480         */
    481481        public function test_comment_permalinks_should_be_correct_when_using_default_display_callback_with_default_comment_page_newest() {
    482482                $now = time();
    483                 $p = self::$factory->post->create();
    484                 $comment_1 = self::$factory->comment->create( array(
     483                $p = self::factory()->post->create();
     484                $comment_1 = self::factory()->comment->create( array(
    485485                        'comment_post_ID' => $p,
    486486                        'comment_content' => '1',
    487487                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),
    488488                ) );
    489                 $comment_2 = self::$factory->comment->create( array(
     489                $comment_2 = self::factory()->comment->create( array(
    490490                        'comment_post_ID' => $p,
    491491                        'comment_content' => '2',
    492492                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),
    493493                ) );
    494                 $comment_3 = self::$factory->comment->create( array(
     494                $comment_3 = self::factory()->comment->create( array(
    495495                        'comment_post_ID' => $p,
    496496                        'comment_content' => '3',
    497497                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),
    498498                ) );
    499                 $comment_4 = self::$factory->comment->create( array(
     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 = self::$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 = self::$factory->comment->create( array(
     509                $comment_6 = self::factory()->comment->create( array(
    510510                        'comment_post_ID' => $p,
    511511                        'comment_content' => '4',
    512512                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 600 ),
  • tests/phpunit/tests/comment/dateQuery.php

    diff --git tests/phpunit/tests/comment/dateQuery.php tests/phpunit/tests/comment/dateQuery.php
    index cccdb97..5859b5c 100644
    class Tests_Comment_DateQuery extends WP_UnitTestCase { 
    2222
    2323                // Just some dummy posts to use as parents for comments
    2424                for ( $i = 1; $i <= 2; $i++ ) {
    25                         $this->posts[$i] = self::$factory->post->create();
     25                        $this->posts[$i] = self::factory()->post->create();
    2626                }
    2727
    2828                // Be careful modifying this. Tests are coded to expect this exact sample data.
    class Tests_Comment_DateQuery extends WP_UnitTestCase { 
    3939                );
    4040
    4141                foreach ( $comment_dates as $comment_date => $comment_parent ) {
    42                         $result = self::$factory->comment->create( array(
     42                        $result = self::factory()->comment->create( array(
    4343                                'comment_date'    => $comment_date,
    4444                                'comment_post_ID' => $this->posts[ $comment_parent ],
    4545                        ) );
  • tests/phpunit/tests/comment/getCommentClass.php

    diff --git tests/phpunit/tests/comment/getCommentClass.php tests/phpunit/tests/comment/getCommentClass.php
    index 09bd5c8..a4518a2 100644
     
    55 */
    66class Tests_Comment_GetCommentClass extends WP_UnitTestCase {
    77        public function test_should_accept_comment_id() {
    8                 $post_id    = self::$factory->post->create();
    9                 $comment_id = self::$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 );
    1212                $this->assertContains( 'comment', $classes );
    1313        }
    1414
    1515        public function test_should_accept_comment_object() {
    16                 $post_id = self::$factory->post->create();
    17                 $comment = self::$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 );
    2020                $this->assertContains( 'comment', $classes );
    2121        }
    2222
    2323        public function test_should_append_single_class() {
    24                 $post_id    = self::$factory->post->create();
    25                 $comment_id = self::$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 );
    2828                $this->assertContains( 'foo', $classes );
    2929        }
    3030
    3131        public function test_should_append_array_of_classes() {
    32                 $post_id    = self::$factory->post->create();
    33                 $comment_id = self::$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 );
    3636                $this->assertContains( 'foo', $classes );
  • tests/phpunit/tests/comment/getCommentCount.php

    diff --git tests/phpunit/tests/comment/getCommentCount.php tests/phpunit/tests/comment/getCommentCount.php
    index 45ba8e7..34e2219 100644
    class Tests_Get_Comment_Count extends WP_UnitTestCase { 
    1414        }
    1515
    1616        public function test_get_comment_count_approved() {
    17                 self::$factory->comment->create( array(
     17                self::factory()->comment->create( array(
    1818                        'comment_approved' => 1
    1919                ) );
    2020
    class Tests_Get_Comment_Count extends WP_UnitTestCase { 
    2929        }
    3030
    3131        public function test_get_comment_count_awaiting() {
    32                 self::$factory->comment->create( array(
     32                self::factory()->comment->create( array(
    3333                        'comment_approved' => 0
    3434                ) );
    3535
    class Tests_Get_Comment_Count extends WP_UnitTestCase { 
    4444        }
    4545
    4646        public function test_get_comment_count_spam() {
    47                 self::$factory->comment->create( array(
     47                self::factory()->comment->create( array(
    4848                        'comment_approved' => 'spam'
    4949                ) );
    5050
    class Tests_Get_Comment_Count extends WP_UnitTestCase { 
    5959        }
    6060
    6161        public function test_get_comment_count_trash() {
    62                 self::$factory->comment->create( array(
     62                self::factory()->comment->create( array(
    6363                        'comment_approved' => 'trash'
    6464                ) );
    6565
    class Tests_Get_Comment_Count extends WP_UnitTestCase { 
    7474        }
    7575
    7676        public function test_get_comment_count_post_trashed() {
    77                 self::$factory->comment->create( array(
     77                self::factory()->comment->create( array(
    7878                        'comment_approved' => 'post-trashed'
    7979                ) );
    8080
  • tests/phpunit/tests/comment/getCommentExcerpt.php

    diff --git tests/phpunit/tests/comment/getCommentExcerpt.php tests/phpunit/tests/comment/getCommentExcerpt.php
    index 6eee6e6..cfb66e7 100644
    Shankle pork chop prosciutto ribeye ham hock pastrami. T-bone shank brisket baco 
    1414        }
    1515
    1616        public function test_get_comment_excerpt() {
    17                 $comment_id = self::$factory->comment->create( array(
     17                $comment_id = self::factory()->comment->create( array(
    1818                        'comment_content' => self::$bacon_comment
    1919                ) );
    2020
    Shankle pork chop prosciutto ribeye ham hock pastrami. T-bone shank brisket baco 
    2424        }
    2525
    2626        public function test_get_comment_excerpt_filtered() {
    27                 $comment_id = self::$factory->comment->create( array(
     27                $comment_id = self::factory()->comment->create( array(
    2828                        'comment_content' => self::$bacon_comment
    2929                ) );
    3030
  • tests/phpunit/tests/comment/getCommentLink.php

    diff --git tests/phpunit/tests/comment/getCommentLink.php tests/phpunit/tests/comment/getCommentLink.php
    index 0b4e44c..c0ce30e 100644
    class Tests_Comment_GetCommentLink extends WP_UnitTestCase { 
    1111                parent::setUp();
    1212
    1313                $now = time();
    14                 $this->p = self::$factory->post->create();
    15                 $this->comments[] = self::$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[] = self::$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[] = self::$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[] = self::$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[] = self::$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[] = self::$factory->comment->create( array(
     40                $this->comments[] = self::factory()->comment->create( array(
    4141                        'comment_post_ID' => $this->p,
    4242                        'comment_content' => '4',
    4343                        'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 600 ),
  • tests/phpunit/tests/comment/getCommentsPagesCount.php

    diff --git tests/phpunit/tests/comment/getCommentsPagesCount.php tests/phpunit/tests/comment/getCommentsPagesCount.php
    index d6e21bc..9246f71 100644
    class Tests_Comment_GetCommentsPagesCount extends WP_UnitTestCase { 
    3838         */
    3939        function test_empty() {
    4040                //setup post and comments
    41                 $post_id = self::$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
    4444                global $wp_query;
    class Tests_Comment_GetCommentsPagesCount extends WP_UnitTestCase { 
    6060         */
    6161        function test_threaded_comments( ) {
    6262                //setup post and comments
    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] ) );
     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
    6868                $this->assertEquals( 3, get_comment_pages_count( $comments, 10, false ) );
    class Tests_Comment_GetCommentsPagesCount extends WP_UnitTestCase { 
    7676        function test_option_thread_comments() {
    7777
    7878                //setup post and comments
    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] ) );
     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
    8484                update_option( 'thread_comments', false );
    class Tests_Comment_GetCommentsPagesCount extends WP_UnitTestCase { 
    104104
    105105                update_option( 'posts_per_rss', 100 );
    106106
    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 );
     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-' ) );
    111111
  • tests/phpunit/tests/comment/getPageOfComment.php

    diff --git tests/phpunit/tests/comment/getPageOfComment.php tests/phpunit/tests/comment/getPageOfComment.php
    index 390b6ed..7de16a9 100644
     
    77class Tests_Comment_GetPageOfComment extends WP_UnitTestCase {
    88
    99        public function test_last_comment() {
    10                 $p = self::$factory->post->create();
     10                $p = self::factory()->post->create();
    1111
    1212                // page 4
    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' ) );
     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                 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' ) );
     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                 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' ) );
     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                 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' ) );
     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 ) ) );
    3232                $this->assertEquals( 2, get_page_of_comment( $comment_last[0],  array( 'per_page' => 10 ) ) );
    class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { 
    3636        }
    3737
    3838        public function test_type_pings() {
    39                 $p = self::$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 ] = self::$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                }
    4747
    4848                $pingbacks = array();
    4949                for ( $i = 0; $i <= 6; $i++ ) {
    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 ) ) );
     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                }
    5353
    class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { 
    6262        public function test_subsequent_calls_should_hit_cache() {
    6363                global $wpdb;
    6464
    65                 $p = self::$factory->post->create();
    66                 $c = self::$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.
    6969                $page_1 = get_page_of_comment( $c, array( 'per_page' => 3 ) );
    class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { 
    8181        public function test_cache_hits_should_be_sensitive_to_comment_type() {
    8282                global $wpdb;
    8383
    84                 $p = self::$factory->post->create();
    85                 $comment = self::$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 ] = 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 ) ) ) );
     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
    9393                // Prime cache for trackbacks.
    class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { 
    105105         * @ticket 11334
    106106         */
    107107        public function test_cache_should_be_invalidated_when_comment_is_approved() {
    108                 $p = self::$factory->post->create();
    109                 $c = self::$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.
    112112                $page_1 = get_page_of_comment( $c, array( 'per_page' => 3 ) );
    class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { 
    121121         * @ticket 11334
    122122         */
    123123        public function test_cache_should_be_invalidated_when_comment_is_deleted() {
    124                 $p = self::$factory->post->create();
    125                 $c = self::$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.
    128128                $page_1 = get_page_of_comment( $c, array( 'per_page' => 3 ) );
    class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { 
    137137         * @ticket 11334
    138138         */
    139139        public function test_cache_should_be_invalidated_when_comment_is_spammed() {
    140                 $p = self::$factory->post->create();
    141                 $c = self::$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.
    144144                $page_1 = get_page_of_comment( $c, array( 'per_page' => 3 ) );
    class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { 
    155155        public function test_cache_should_be_invalidated_when_older_comment_is_published() {
    156156                $now = time();
    157157
    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 ) ) );
     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 ) ) );
    164164
    class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { 
    171171         * @ticket 34057
    172172         */
    173173        public function test_query_should_be_limited_to_comments_on_the_proper_post() {
    174                 $posts = self::$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[] = 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 ) ) ) );
     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
    183183                $found_0 = get_page_of_comment( $comments_0[0], array( 'per_page' => 2 ) );
    class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { 
    191191         * @ticket 13939
    192192         */
    193193        public function test_only_top_level_comments_should_be_included_in_older_count() {
    194                 $post = self::$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 = self::$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 = 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 ) );
     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                }
    205205
    class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { 
    228228        public function test_comments_per_page_option_should_be_fallback_when_query_var_is_not_available() {
    229229                $now = time();
    230230
    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 ) ) );
     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 );
    237237
  • tests/phpunit/tests/comment/metaCache.php

    diff --git tests/phpunit/tests/comment/metaCache.php tests/phpunit/tests/comment/metaCache.php
    index 6756325..166ad25 100644
    class Tests_Comment_Meta_Cache extends WP_UnitTestCase { 
    1010        public function test_update_comment_meta_cache_should_default_to_true() {
    1111                global $wpdb;
    1212
    13                 $p = self::$factory->post->create( array( 'post_status' => 'publish' ) );
    14                 $comment_ids = self::$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 ) {
    1717                        update_comment_meta( $cid, 'foo', 'bar' );
    class Tests_Comment_Meta_Cache extends WP_UnitTestCase { 
    3838        public function test_update_comment_meta_cache_true() {
    3939                global $wpdb;
    4040
    41                 $p = self::$factory->post->create( array( 'post_status' => 'publish' ) );
    42                 $comment_ids = self::$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 ) {
    4545                        update_comment_meta( $cid, 'foo', 'bar' );
    class Tests_Comment_Meta_Cache extends WP_UnitTestCase { 
    6767        public function test_update_comment_meta_cache_false() {
    6868                global $wpdb;
    6969
    70                 $p = self::$factory->post->create( array( 'post_status' => 'publish' ) );
    71                 $comment_ids = self::$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 ) {
    7474                        update_comment_meta( $cid, 'foo', 'bar' );
    class Tests_Comment_Meta_Cache extends WP_UnitTestCase { 
    9393        public function test_comment_meta_should_be_lazy_loaded_for_all_comments_in_comments_template() {
    9494                global $wpdb;
    9595
    96                 $p = self::$factory->post->create( array( 'post_status' => 'publish' ) );
    97                 $comment_ids = self::$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 ) {
    100100                        update_comment_meta( $cid, 'sauce', 'fire' );
    class Tests_Comment_Meta_Cache extends WP_UnitTestCase { 
    128128        public function test_comment_meta_should_be_lazy_loaded_in_comment_feed_queries() {
    129129                global $wpdb;
    130130
    131                 $posts = self::$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[] = self::$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 ) ),
    139139                        ) );
    class Tests_Comment_Meta_Cache extends WP_UnitTestCase { 
    172172        public function test_comment_meta_should_be_lazy_loaded_in_single_post_comment_feed_queries() {
    173173                global $wpdb;
    174174
    175                 $posts = self::$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[] = self::$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 ) ),
    183183                        ) );
  • tests/phpunit/tests/comment/query.php

    diff --git tests/phpunit/tests/comment/query.php tests/phpunit/tests/comment/query.php
    index 9a1c79b..4ccfe8c 100644
    class Tests_Comment_Query extends WP_UnitTestCase { 
    1212        function setUp() {
    1313                parent::setUp();
    1414
    15                 $this->post_id = self::$factory->post->create();
     15                $this->post_id = self::factory()->post->create();
    1616        }
    1717
    1818        public function test_query() {
    19                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    20                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    21                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    22                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    23                 $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
     19                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     20                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     21                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     22                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     23                $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    2424
    2525                $q = new WP_Comment_Query();
    2626                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    3131        }
    3232
    3333        public function test_query_post_id_0() {
    34                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     34                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    3535
    3636                $q = new WP_Comment_Query();
    3737                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    4646         * @ticket 12668
    4747         */
    4848        public function test_query_type_empty_string() {
    49                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    50                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    51                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    52                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    53                 $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
     49                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     50                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     51                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     52                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     53                $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    5454
    5555                $q = new WP_Comment_Query();
    5656                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    6565         * @ticket 12668
    6666         */
    6767        public function test_query_type_comment() {
    68                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    69                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    70                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    71                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    72                 $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
     68                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     69                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     70                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     71                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     72                $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    7373
    7474                $q = new WP_Comment_Query();
    7575                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    8181        }
    8282
    8383        public function test_query_type_pingback() {
    84                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    85                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    86                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    87                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     84                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     85                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     86                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     87                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    8888
    8989                $q = new WP_Comment_Query();
    9090                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    9797        }
    9898
    9999        public function test_query_type_trackback() {
    100                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    101                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    102                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    103                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     100                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     101                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     102                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     103                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    104104
    105105                $q = new WP_Comment_Query();
    106106                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    116116         * 'pings' is an alias for 'trackback' + 'pingback'.
    117117         */
    118118        public function test_query_type_pings() {
    119                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    120                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    121                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    122                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    123                 $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
     119                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     120                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     121                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     122                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     123                $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    124124
    125125                $q = new WP_Comment_Query();
    126126                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    136136         * @ticket 12668
    137137         */
    138138        public function test_type_array_comments_and_custom() {
    139                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    140                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    141                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    142                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    143                 $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    144                 $c6 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     139                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     140                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     141                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     142                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     143                $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
     144                $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    145145
    146146                $q = new WP_Comment_Query();
    147147                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    156156         * @ticket 12668
    157157         */
    158158        public function test_type_not__in_array_custom() {
    159                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    160                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    161                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    162                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    163                 $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    164                 $c6 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     159                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     160                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     161                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     162                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     163                $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
     164                $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    165165
    166166                $q = new WP_Comment_Query();
    167167                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    176176         * @ticket 12668
    177177         */
    178178        public function test_type__in_array_and_not_type_array_custom() {
    179                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    180                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    181                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    182                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    183                 $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    184                 $c6 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     179                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     180                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     181                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     182                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     183                $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
     184                $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    185185
    186186                $q = new WP_Comment_Query();
    187187                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    197197         * @ticket 12668
    198198         */
    199199        public function test_type_array_and_type__not_in_array_custom() {
    200                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    201                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    202                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    203                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    204                 $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    205                 $c6 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     200                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     201                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     202                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     203                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     204                $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
     205                $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    206206
    207207                $q = new WP_Comment_Query();
    208208                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    218218         * @ticket 12668
    219219         */
    220220        public function test_type__not_in_custom() {
    221                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    222                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    223                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    224                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    225                 $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    226                 $c6 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     221                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     222                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     223                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     224                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     225                $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
     226                $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    227227
    228228                $q = new WP_Comment_Query();
    229229                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    238238         * @ticket 12668
    239239         */
    240240        public function test_type_array_comments_and_pings() {
    241                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    242                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    243                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    244                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
    245                 $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
     241                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     242                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     243                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     244                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );
     245                $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );
    246246
    247247                $q = new WP_Comment_Query();
    248248                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    257257         * @ticket 12668
    258258         */
    259259        public function test_type_array_comment_pings() {
    260                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    261                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    262                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     260                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     261                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     262                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    263263
    264264                $q = new WP_Comment_Query();
    265265                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    274274         * @ticket 12668
    275275         */
    276276        public function test_type_array_pingback() {
    277                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    278                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    279                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     277                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     278                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     279                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    280280
    281281                $q = new WP_Comment_Query();
    282282                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    291291         * @ticket 12668
    292292         */
    293293        public function test_type_array_custom_pingpack() {
    294                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    295                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    296                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     294                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     295                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     296                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    297297
    298298                $q = new WP_Comment_Query();
    299299                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    308308         * @ticket 12668
    309309         */
    310310        public function test_type_array_pings() {
    311                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    312                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    313                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     311                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     312                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     313                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    314314
    315315                $q = new WP_Comment_Query();
    316316                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    325325         * @ticket 12668
    326326         */
    327327        public function test_type_status_approved_array_comment_pings() {
    328                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    329                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    330                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    331                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0', 'comment_type' => 'pingback' ) );
     328                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     329                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     330                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     331                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0', 'comment_type' => 'pingback' ) );
    332332
    333333                $q = new WP_Comment_Query();
    334334                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    344344         * @ticket 12668
    345345         */
    346346        public function test_type_array_trackback() {
    347                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    348                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    349                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     347                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     348                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     349                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    350350
    351351                $q = new WP_Comment_Query();
    352352                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    361361         * @ticket 12668
    362362         */
    363363        public function test_type_array_custom_trackback() {
    364                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    365                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    366                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
     364                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     365                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     366                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );
    367367
    368368                $q = new WP_Comment_Query();
    369369                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    378378         * @ticket 12668
    379379         */
    380380        public function test_type_array_pings_approved() {
    381                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    382                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    383                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
    384                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0', 'comment_type' => 'trackback' ) );
     381                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     382                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     383                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );
     384                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0', 'comment_type' => 'trackback' ) );
    385385
    386386                $q = new WP_Comment_Query();
    387387                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    397397         * @ticket 29612
    398398         */
    399399        public function test_status_empty_string() {
    400                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    401                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
    402                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'spam' ) );
     400                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     401                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
     402                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'spam' ) );
    403403
    404404                $q = new WP_Comment_Query();
    405405                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    414414         * @ticket 21101
    415415         */
    416416        public function test_status_hold() {
    417                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    418                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
     417                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     418                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
    419419
    420420                $q = new WP_Comment_Query();
    421421                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    430430         * @ticket 21101
    431431         */
    432432        public function test_status_approve() {
    433                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    434                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
     433                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     434                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
    435435
    436436                $q = new WP_Comment_Query();
    437437                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    443443        }
    444444
    445445        public function test_status_custom() {
    446                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    447                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
    448                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo1' ) );
     446                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     447                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
     448                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo1' ) );
    449449
    450450                $q = new WP_Comment_Query();
    451451                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    457457        }
    458458
    459459        public function test_status_all() {
    460                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    461                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
    462                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
     460                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     461                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
     462                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
    463463
    464464                $q = new WP_Comment_Query();
    465465                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    471471        }
    472472
    473473        public function test_status_default_to_all() {
    474                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    475                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
    476                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
     474                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     475                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
     476                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
    477477
    478478                $q = new WP_Comment_Query();
    479479                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    487487         * @ticket 29612
    488488         */
    489489        public function test_status_comma_any() {
    490                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    491                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
    492                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
     490                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     491                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
     492                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
    493493
    494494                $q = new WP_Comment_Query();
    495495                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    504504         * @ticket 29612
    505505         */
    506506        public function test_status_comma_separated() {
    507                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    508                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
    509                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
     507                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     508                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
     509                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
    510510
    511511                $q = new WP_Comment_Query();
    512512                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    521521         * @ticket 29612
    522522         */
    523523        public function test_status_array() {
    524                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    525                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
    526                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
     524                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     525                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );
     526                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );
    527527
    528528                $q = new WP_Comment_Query();
    529529                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    537537        function test_get_comments_for_post() {
    538538                $limit = 5;
    539539
    540                 $post_id = self::$factory->post->create();
    541                 self::$factory->comment->create_post_comments( $post_id, $limit );
     540                $post_id = self::factory()->post->create();
     541                self::factory()->comment->create_post_comments( $post_id, $limit );
    542542                $comments = get_comments( array( 'post_id' => $post_id ) );
    543543                $this->assertEquals( $limit, count( $comments ) );
    544544                foreach ( $comments as $comment ) {
    545545                        $this->assertEquals( $post_id, $comment->comment_post_ID );
    546546                }
    547547
    548                 $post_id2 = self::$factory->post->create();
    549                 self::$factory->comment->create_post_comments( $post_id2, $limit );
     548                $post_id2 = self::factory()->post->create();
     549                self::factory()->comment->create_post_comments( $post_id2, $limit );
    550550                $comments = get_comments( array( 'post_id' => $post_id2 ) );
    551551                $this->assertEquals( $limit, count( $comments ) );
    552552                foreach ( $comments as $comment ) {
    553553                        $this->assertEquals( $post_id2, $comment->comment_post_ID );
    554554                }
    555555
    556                 $post_id3 = self::$factory->post->create();
    557                 self::$factory->comment->create_post_comments( $post_id3, $limit, array( 'comment_approved' => '0' ) );
     556                $post_id3 = self::factory()->post->create();
     557                self::factory()->comment->create_post_comments( $post_id3, $limit, array( 'comment_approved' => '0' ) );
    558558                $comments = get_comments( array( 'post_id' => $post_id3 ) );
    559559                $this->assertEquals( $limit, count( $comments ) );
    560560                foreach ( $comments as $comment ) {
    class Tests_Comment_Query extends WP_UnitTestCase { 
    570570                $comments = get_comments( array( 'post_id' => $post_id3, 'status' => 'approve' ) );
    571571                $this->assertEquals( 0, count( $comments ) );
    572572
    573                 self::$factory->comment->create_post_comments( $post_id3, $limit, array( 'comment_approved' => '1' ) );
     573                self::factory()->comment->create_post_comments( $post_id3, $limit, array( 'comment_approved' => '1' ) );
    574574                $comments = get_comments( array( 'post_id' => $post_id3 ) );
    575575                $this->assertEquals( $limit * 2, count( $comments ) );
    576576                foreach ( $comments as $comment ) {
    class Tests_Comment_Query extends WP_UnitTestCase { 
    582582         * @ticket 21003
    583583         */
    584584        function test_orderby_meta() {
    585                 $comment_id = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
    586                 $comment_id2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
    587                 $comment_id3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
     585                $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id ) );
     586                $comment_id2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id ) );
     587                $comment_id3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id ) );
    588588
    589589                add_comment_meta( $comment_id, 'key', 'value1', true );
    590590                add_comment_meta( $comment_id, 'key1', 'value1', true );
    class Tests_Comment_Query extends WP_UnitTestCase { 
    632632         * @ticket 30478
    633633         */
    634634        public function test_orderby_clause_key() {
    635                 $comments = self::$factory->comment->create_many( 3 );
     635                $comments = self::factory()->comment->create_many( 3 );
    636636                add_comment_meta( $comments[0], 'foo', 'aaa' );
    637637                add_comment_meta( $comments[1], 'foo', 'zzz' );
    638638                add_comment_meta( $comments[2], 'foo', 'jjj' );
    class Tests_Comment_Query extends WP_UnitTestCase { 
    657657         * @ticket 30478
    658658         */
    659659        public function test_orderby_clause_key_as_secondary_sort() {
    660                 $c1 = self::$factory->comment->create( array(
     660                $c1 = self::factory()->comment->create( array(
    661661                        'comment_date' => '2015-01-28 03:00:00',
    662662                ) );
    663                 $c2 = self::$factory->comment->create( array(
     663                $c2 = self::factory()->comment->create( array(
    664664                        'comment_date' => '2015-01-28 05:00:00',
    665665                ) );
    666                 $c3 = self::$factory->comment->create( array(
     666                $c3 = self::factory()->comment->create( array(
    667667                        'comment_date' => '2015-01-28 03:00:00',
    668668                ) );
    669669
    class Tests_Comment_Query extends WP_UnitTestCase { 
    693693         * @ticket 30478
    694694         */
    695695        public function test_orderby_more_than_one_clause_key() {
    696                 $comments = self::$factory->comment->create_many( 3 );
     696                $comments = self::factory()->comment->create_many( 3 );
    697697
    698698                add_comment_meta( $comments[0], 'foo', 'jjj' );
    699699                add_comment_meta( $comments[1], 'foo', 'zzz' );
    class Tests_Comment_Query extends WP_UnitTestCase { 
    728728         * @group 32081
    729729         */
    730730        public function test_meta_query_should_work_with_comment__in() {
    731                 $comments = self::$factory->comment->create_many( 3 );
     731                $comments = self::factory()->comment->create_many( 3 );
    732732
    733733                add_comment_meta( $comments[0], 'foo', 'jjj' );
    734734                add_comment_meta( $comments[1], 'foo', 'zzz' );
    class Tests_Comment_Query extends WP_UnitTestCase { 
    752752         * @group 32081
    753753         */
    754754        public function test_meta_query_should_work_with_comment__not_in() {
    755                 $comments = self::$factory->comment->create_many( 3 );
     755                $comments = self::factory()->comment->create_many( 3 );
    756756
    757757                add_comment_meta( $comments[0], 'foo', 'jjj' );
    758758                add_comment_meta( $comments[1], 'foo', 'zzz' );
    class Tests_Comment_Query extends WP_UnitTestCase { 
    776776         * @ticket 27064
    777777         */
    778778        function test_get_comments_by_user() {
    779                 $users = self::$factory->user->create_many( 2 );
    780                 self::$factory->comment->create( array( 'user_id' => $users[0], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    781                 self::$factory->comment->create( array( 'user_id' => $users[0], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    782                 self::$factory->comment->create( array( 'user_id' => $users[1], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     779                $users = self::factory()->user->create_many( 2 );
     780                self::factory()->comment->create( array( 'user_id' => $users[0], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     781                self::factory()->comment->create( array( 'user_id' => $users[0], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     782                self::factory()->comment->create( array( 'user_id' => $users[1], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    783783
    784784                $comments = get_comments( array(
    785785                        'user_id' => $users[0],
    class Tests_Comment_Query extends WP_UnitTestCase { 
    808808         * @ticket 28434
    809809         */
    810810        function test_fields_ids_query() {
    811                 $comment_1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    812                 $comment_2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    813                 $comment_3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     811                $comment_1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     812                $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     813                $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    814814
    815815                // Ensure we are dealing with integers, and not objects.
    816816                $this->assertInternalType( 'integer', $comment_1 );
    class Tests_Comment_Query extends WP_UnitTestCase { 
    826826         * @ticket 29189
    827827         */
    828828        function test_fields_comment__in() {
    829                 $comment_1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    830                 $comment_2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    831                 $comment_3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     829                $comment_1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     830                $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     831                $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    832832
    833833                $comment_ids = get_comments( array(
    834834                        'fields' => 'ids',
    class Tests_Comment_Query extends WP_UnitTestCase { 
    842842         * @ticket 29189
    843843         */
    844844        function test_fields_comment__not_in() {
    845                 $comment_1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    846                 $comment_2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    847                 $comment_3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     845                $comment_1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     846                $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     847                $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    848848
    849849                $comment_ids = get_comments( array(
    850850                        'fields' => 'ids',
    class Tests_Comment_Query extends WP_UnitTestCase { 
    858858         * @ticket 29189
    859859         */
    860860        function test_fields_post__in() {
    861                 $p1 = self::$factory->post->create();
    862                 $p2 = self::$factory->post->create();
    863                 $p3 = self::$factory->post->create();
     861                $p1 = self::factory()->post->create();
     862                $p2 = self::factory()->post->create();
     863                $p3 = self::factory()->post->create();
    864864
    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' ) );
     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(
    870870                        'fields' => 'ids',
    class Tests_Comment_Query extends WP_UnitTestCase { 
    878878         * @ticket 29189
    879879         */
    880880        function test_fields_post__not_in() {
    881                 $p1 = self::$factory->post->create();
    882                 $p2 = self::$factory->post->create();
    883                 $p3 = self::$factory->post->create();
     881                $p1 = self::factory()->post->create();
     882                $p2 = self::factory()->post->create();
     883                $p3 = self::factory()->post->create();
    884884
    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' ) );
     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(
    890890                        'fields' => 'ids',
    class Tests_Comment_Query extends WP_UnitTestCase { 
    901901                $author_id1 = 105;
    902902                $author_id2 = 106;
    903903
    904                 $p1 = self::$factory->post->create( array( 'post_author' => $author_id1 ) );
    905                 $p2 = self::$factory->post->create( array( 'post_author' => $author_id1 ) );
    906                 $p3 = self::$factory->post->create( array( 'post_author' => $author_id2 ) );
     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        ) );
    907907
    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' ) );
     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(
    913913                        'fields' => 'ids',
    class Tests_Comment_Query extends WP_UnitTestCase { 
    924924                $author_id1 = 111;
    925925                $author_id2 = 112;
    926926
    927                 $p1 = self::$factory->post->create( array( 'post_author' => $author_id1 ) );
    928                 $p2 = self::$factory->post->create( array( 'post_author' => $author_id1 ) );
    929                 $p3 = self::$factory->post->create( array( 'post_author' => $author_id2 ) );
     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        ) );
    930930
    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' ) );
     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(
    936936                        'fields' => 'ids',
    class Tests_Comment_Query extends WP_UnitTestCase { 
    944944         * @ticket 29885
    945945         */
    946946        function test_fields_author__in() {
    947                 $p1 = self::$factory->post->create();
    948                 $p2 = self::$factory->post->create();
    949                 $p3 = self::$factory->post->create();
    950                 $p4 = self::$factory->post->create();
     947                $p1 = self::factory()->post->create();
     948                $p2 = self::factory()->post->create();
     949                $p3 = self::factory()->post->create();
     950                $p4 = self::factory()->post->create();
    951951
    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' ) );
     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(
    958958                        'fields' => 'ids',
    class Tests_Comment_Query extends WP_UnitTestCase { 
    966966         * @ticket 29885
    967967         */
    968968        function test_fields_author__not_in() {
    969                 $p1 = self::$factory->post->create();
    970                 $p2 = self::$factory->post->create();
    971                 $p3 = self::$factory->post->create();
    972                 $p4 = self::$factory->post->create();
     969                $p1 = self::factory()->post->create();
     970                $p2 = self::factory()->post->create();
     971                $p3 = self::factory()->post->create();
     972                $p4 = self::factory()->post->create();
    973973
    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' ) );
     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(
    980980                        'fields' => 'ids',
    class Tests_Comment_Query extends WP_UnitTestCase { 
    988988         * @ticket 19623
    989989         */
    990990        public function test_get_comments_with_status_all() {
    991                 $comment_1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    992                 $comment_2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    993                 $comment_3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
     991                $comment_1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     992                $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     993                $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
    994994                $comments_approved_1 = get_comments( array( 'status' => 'all' ) );
    995995
    996996                $comment_ids = get_comments( array( 'fields' => 'ids' ) );
    class Tests_Comment_Query extends WP_UnitTestCase { 
    10011001         * @ticket 19623
    10021002         */
    10031003        public function test_get_comments_with_include_unapproved_user_id() {
    1004                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    1005                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    1006                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
    1007                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );
     1004                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     1005                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     1006                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
     1007                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );
    10081008
    10091009                $found = get_comments( array(
    10101010                        'fields' => 'ids',
    class Tests_Comment_Query extends WP_UnitTestCase { 
    10191019         * @ticket 19623
    10201020         */
    10211021        public function test_get_comments_with_include_unapproved_user_id_array() {
    1022                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    1023                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    1024                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
    1025                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );
    1026                 $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 8, 'comment_approved' => '0' ) );
     1022                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     1023                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     1024                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
     1025                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );
     1026                $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 8, 'comment_approved' => '0' ) );
    10271027
    10281028                $found = get_comments( array(
    10291029                        'fields' => 'ids',
    class Tests_Comment_Query extends WP_UnitTestCase { 
    10381038         * @ticket 19623
    10391039         */
    10401040        public function test_get_comments_with_include_unapproved_user_id_comma_separated() {
    1041                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    1042                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
    1043                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
    1044                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );
    1045                 $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 8, 'comment_approved' => '0' ) );
     1041                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     1042                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     1043                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );
     1044                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );
     1045                $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 8, 'comment_approved' => '0' ) );
    10461046
    10471047                $found = get_comments( array(
    10481048                        'fields' => 'ids',
    class Tests_Comment_Query extends WP_UnitTestCase { 
    10571057         * @ticket 19623
    10581058         */
    10591059        public function test_get_comments_with_include_unapproved_author_email() {
    1060                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    1061                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
    1062                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
    1063                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
     1060                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     1061                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
     1062                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
     1063                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
    10641064
    10651065                $found = get_comments( array(
    10661066                        'fields' => 'ids',
    class Tests_Comment_Query extends WP_UnitTestCase { 
    10751075         * @ticket 19623
    10761076         */
    10771077        public function test_get_comments_with_include_unapproved_mixed_array() {
    1078                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    1079                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
    1080                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
    1081                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
    1082                 $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
     1078                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     1079                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
     1080                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
     1081                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
     1082                $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
    10831083
    10841084                $found = get_comments( array(
    10851085                        'fields' => 'ids',
    class Tests_Comment_Query extends WP_UnitTestCase { 
    10941094         * @ticket 19623
    10951095         */
    10961096        public function test_get_comments_with_include_unapproved_mixed_comma_separated() {
    1097                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
    1098                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
    1099                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
    1100                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
    1101                 $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
     1097                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     1098                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
     1099                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );
     1100                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
     1101                $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
    11021102
    11031103                $found = get_comments( array(
    11041104                        'fields' => 'ids',
    class Tests_Comment_Query extends WP_UnitTestCase { 
    11101110        }
    11111111
    11121112        public function test_search() {
    1113                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
    1114                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'foo@example.com' ) );
    1115                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://foo.bar' ) );
    1116                 $c4 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com', 'comment_author_IP' => 'foo.bar' ) );
    1117                 $c5 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com', 'comment_content' => 'Nice foo comment' ) );
    1118                 $c6 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com' ) );
     1113                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );
     1114                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'foo@example.com' ) );
     1115                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://foo.bar' ) );
     1116                $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com', 'comment_author_IP' => 'foo.bar' ) );
     1117                $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com', 'comment_content' => 'Nice foo comment' ) );
     1118                $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com' ) );
    11191119
    11201120                $q = new WP_Comment_Query();
    11211121                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    13631363         */
    13641364        public function test_orderby_date_modified_gmt_should_order_by_comment_ID_in_case_of_tie_ASC() {
    13651365                $now = current_time( 'mysql', 1 );
    1366                 $comments = self::$factory->comment->create_many( 5, array(
     1366                $comments = self::factory()->comment->create_many( 5, array(
    13671367                        'comment_post_ID' => $this->post_id,
    13681368                        'comment_date_gmt' => $now,
    13691369                ) );
    class Tests_Comment_Query extends WP_UnitTestCase { 
    13831383         */
    13841384        public function test_orderby_date_modified_gmt_should_order_by_comment_ID_in_case_of_tie_DESC() {
    13851385                $now = current_time( 'mysql', 1 );
    1386                 $comments = self::$factory->comment->create_many( 5, array(
     1386                $comments = self::factory()->comment->create_many( 5, array(
    13871387                        'comment_post_ID' => $this->post_id,
    13881388                        'comment_date_gmt' => $now,
    13891389                ) );
    class Tests_Comment_Query extends WP_UnitTestCase { 
    14161416        }
    14171417
    14181418        public function test_count() {
    1419                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
    1420                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
     1419                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
     1420                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
    14211421
    14221422                $q = new WP_Comment_Query();
    14231423                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    14311431         * @ticket 23369
    14321432         */
    14331433        public function test_count_with_meta_query() {
    1434                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
    1435                 $c2 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
    1436                 $c3 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
     1434                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
     1435                $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
     1436                $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
    14371437                add_comment_meta( $c1, 'foo', 'bar' );
    14381438                add_comment_meta( $c3, 'foo', 'bar' );
    14391439
    class Tests_Comment_Query extends WP_UnitTestCase { 
    14551455                register_post_type( 'post-type-1' );
    14561456                register_post_type( 'post-type-2' );
    14571457
    1458                 $p1 = self::$factory->post->create( array( 'post_type' => 'post-type-1' ) );
    1459                 $p2 = self::$factory->post->create( array( 'post_type' => 'post-type-2' ) );
     1458                $p1 = self::factory()->post->create( array( 'post_type' => 'post-type-1' ) );
     1459                $p2 = self::factory()->post->create( array( 'post_type' => 'post-type-2' ) );
    14601460
    1461                 $c1 = self::$factory->comment->create_post_comments( $p1, 1 );
    1462                 $c2 = self::$factory->comment->create_post_comments( $p2, 1 );
     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();
    14651465                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    14801480                register_post_type( 'post-type-1' );
    14811481                register_post_type( 'post-type-2' );
    14821482
    1483                 $p1 = self::$factory->post->create( array( 'post_type' => 'post-type-1' ) );
    1484                 $p2 = self::$factory->post->create( array( 'post_type' => 'post-type-2' ) );
     1483                $p1 = self::factory()->post->create( array( 'post_type' => 'post-type-1' ) );
     1484                $p2 = self::factory()->post->create( array( 'post_type' => 'post-type-2' ) );
    14851485
    1486                 $c1 = self::$factory->comment->create_post_comments( $p1, 1 );
    1487                 $c2 = self::$factory->comment->create_post_comments( $p2, 1 );
     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();
    14901490                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    15051505                register_post_type( 'post-type-1' );
    15061506                register_post_type( 'post-type-2' );
    15071507
    1508                 $p1 = self::$factory->post->create( array( 'post_type' => 'post-type-1' ) );
    1509                 $p2 = self::$factory->post->create( array( 'post_type' => 'post-type-2' ) );
    1510                 $p3 = self::$factory->post->create( array( 'post_type' => 'post-type-3' ) );
     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' ) );
    15111511
    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 );
     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();
    15171517                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    15261526        }
    15271527
    15281528        public function test_post_name_single_value() {
    1529                 $p1 = self::$factory->post->create( array( 'post_name' => 'foo' ) );
    1530                 $p2 = self::$factory->post->create( array( 'post_name' => 'bar' ) );
     1529                $p1 = self::factory()->post->create( array( 'post_name' => 'foo' ) );
     1530                $p2 = self::factory()->post->create( array( 'post_name' => 'bar' ) );
    15311531
    1532                 $c1 = self::$factory->comment->create_post_comments( $p1, 1 );
    1533                 $c2 = self::$factory->comment->create_post_comments( $p2, 1 );
     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();
    15361536                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    15451545         * @ticket 20006
    15461546         */
    15471547        public function test_post_name_singleton_array() {
    1548                 $p1 = self::$factory->post->create( array( 'post_name' => 'foo' ) );
    1549                 $p2 = self::$factory->post->create( array( 'post_name' => 'bar' ) );
     1548                $p1 = self::factory()->post->create( array( 'post_name' => 'foo' ) );
     1549                $p2 = self::factory()->post->create( array( 'post_name' => 'bar' ) );
    15501550
    1551                 $c1 = self::$factory->comment->create_post_comments( $p1, 1 );
    1552                 $c2 = self::$factory->comment->create_post_comments( $p2, 1 );
     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();
    15551555                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    15641564         * @ticket 20006
    15651565         */
    15661566        public function test_post_name_array() {
    1567                 $p1 = self::$factory->post->create( array( 'post_name' => 'foo' ) );
    1568                 $p2 = self::$factory->post->create( array( 'post_name' => 'bar' ) );
    1569                 $p3 = self::$factory->post->create( array( 'post_name' => 'baz' ) );
     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' ) );
    15701570
    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 );
     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();
    15761576                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    15821582        }
    15831583
    15841584        public function test_post_status_single_value() {
    1585                 $p1 = self::$factory->post->create( array( 'post_status' => 'publish' ) );
    1586                 $p2 = self::$factory->post->create( array( 'post_status' => 'draft' ) );
     1585                $p1 = self::factory()->post->create( array( 'post_status' => 'publish' ) );
     1586                $p2 = self::factory()->post->create( array( 'post_status' => 'draft' ) );
    15871587
    1588                 $c1 = self::$factory->comment->create_post_comments( $p1, 1 );
    1589                 $c2 = self::$factory->comment->create_post_comments( $p2, 1 );
     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();
    15921592                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    16011601         * @ticket 20006
    16021602         */
    16031603        public function test_post_status_singleton_array() {
    1604                 $p1 = self::$factory->post->create( array( 'post_status' => 'publish' ) );
    1605                 $p2 = self::$factory->post->create( array( 'post_status' => 'draft' ) );
     1604                $p1 = self::factory()->post->create( array( 'post_status' => 'publish' ) );
     1605                $p2 = self::factory()->post->create( array( 'post_status' => 'draft' ) );
    16061606
    1607                 $c1 = self::$factory->comment->create_post_comments( $p1, 1 );
    1608                 $c2 = self::$factory->comment->create_post_comments( $p2, 1 );
     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();
    16111611                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    16201620         * @ticket 20006
    16211621         */
    16221622        public function test_post_status_array() {
    1623                 $p1 = self::$factory->post->create( array( 'post_status' => 'publish' ) );
    1624                 $p2 = self::$factory->post->create( array( 'post_status' => 'draft' ) );
    1625                 $p3 = self::$factory->post->create( array( 'post_status' => 'future' ) );
     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' ) );
    16261626
    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 );
     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();
    16321632                $found = $q->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    16411641         * @ticket 24826
    16421642         */
    16431643        public function test_comment_query_object() {
    1644                 $comment_id = self::$factory->comment->create();
     1644                $comment_id = self::factory()->comment->create();
    16451645
    16461646                $query1 = new WP_Comment_Query();
    16471647                $this->assertNull( $query1->query_vars );
    class Tests_Comment_Query extends WP_UnitTestCase { 
    16631663        public function test_comment_cache_key_should_ignore_custom_params() {
    16641664                global $wpdb;
    16651665
    1666                 $p = self::$factory->post->create();
    1667                 $c = self::$factory->comment->create( array( 'comment_post_ID' => $p ) );
     1666                $p = self::factory()->post->create();
     1667                $c = self::factory()->comment->create( array( 'comment_post_ID' => $p ) );
    16681668
    16691669                $q1 = new WP_Comment_Query();
    16701670                $q1->query( array(
    class Tests_Comment_Query extends WP_UnitTestCase { 
    16881688         * @ticket 32762
    16891689         */
    16901690        public function test_it_should_be_possible_to_modify_meta_query_using_pre_get_comments_action() {
    1691                 $comments = self::$factory->comment->create_many( 2, array(
     1691                $comments = self::factory()->comment->create_many( 2, array(
    16921692                        'comment_post_ID' => $this->post_id,
    16931693                ) );
    16941694
    class Tests_Comment_Query extends WP_UnitTestCase { 
    17191719         * @ticket 32762
    17201720         */
    17211721        public function test_it_should_be_possible_to_modify_meta_params_using_pre_get_comments_action() {
    1722                 $comments = self::$factory->comment->create_many( 2, array(
     1722                $comments = self::factory()->comment->create_many( 2, array(
    17231723                        'comment_post_ID' => $this->post_id,
    17241724                ) );
    17251725
    class Tests_Comment_Query extends WP_UnitTestCase { 
    17461746         * @ticket 33882
    17471747         */
    17481748        public function test_parent__in() {
    1749                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    1750                 $c2 = self::$factory->comment->create( array(
     1749                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     1750                $c2 = self::factory()->comment->create( array(
    17511751                        'comment_post_ID' => $this->post_id,
    17521752                        'comment_approved' => '1',
    17531753                        'comment_parent' => $c1,
    class Tests_Comment_Query extends WP_UnitTestCase { 
    17661766         * @ticket 33882
    17671767         */
    17681768        public function test_parent__in_commas() {
    1769                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    1770                 $c2 = self::$factory->comment->create( array(
     1769                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     1770                $c2 = self::factory()->comment->create( array(
    17711771                        'comment_post_ID' => $this->post_id,
    17721772                        'comment_approved' => '1'
    17731773                ) );
    1774                 $c3 = self::$factory->comment->create( array(
     1774                $c3 = self::factory()->comment->create( array(
    17751775                        'comment_post_ID' => $this->post_id,
    17761776                        'comment_approved' => '1',
    17771777                        'comment_parent' => $c1,
    17781778                ) );
    1779                 $c4 = self::$factory->comment->create( array(
     1779                $c4 = self::factory()->comment->create( array(
    17801780                        'comment_post_ID' => $this->post_id,
    17811781                        'comment_approved' => '1',
    17821782                        'comment_parent' => $c2,
    class Tests_Comment_Query extends WP_UnitTestCase { 
    17951795         * @ticket 33882
    17961796         */
    17971797        public function test_parent__not_in() {
    1798                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     1798                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    17991799
    1800                 self::$factory->comment->create( array(
     1800                self::factory()->comment->create( array(
    18011801                        'comment_post_ID' => $this->post_id,
    18021802                        'comment_approved' => '1',
    18031803                        'comment_parent' => $c1,
    class Tests_Comment_Query extends WP_UnitTestCase { 
    18161816         * @ticket 33882
    18171817         */
    18181818        public function test_parent__not_in_commas() {
    1819                 $c1 = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
    1820                 $c2 = self::$factory->comment->create( array(
     1819                $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );
     1820                $c2 = self::factory()->comment->create( array(
    18211821                        'comment_post_ID' => $this->post_id,
    18221822                        'comment_approved' => '1'
    18231823                ) );
    18241824
    1825                 self::$factory->comment->create( array(
     1825                self::factory()->comment->create( array(
    18261826                        'comment_post_ID' => $this->post_id,
    18271827                        'comment_approved' => '1',
    18281828                        'comment_parent' => $c1,
    18291829                ) );
    1830                 self::$factory->comment->create( array(
     1830                self::factory()->comment->create( array(
    18311831                        'comment_post_ID' => $this->post_id,
    18321832                        'comment_approved' => '1',
    18331833                        'comment_parent' => $c2,
    class Tests_Comment_Query extends WP_UnitTestCase { 
    18461846         * @ticket 33883
    18471847         */
    18481848        public function test_orderby_comment__in() {
    1849                 self::$factory->comment->create( array(
     1849                self::factory()->comment->create( array(
    18501850                        'comment_post_ID' => $this->post_id,
    18511851                        'comment_approved' => '1'
    18521852                ) );
    18531853
    1854                 $c2 = self::$factory->comment->create( array(
     1854                $c2 = self::factory()->comment->create( array(
    18551855                        'comment_post_ID' => $this->post_id,
    18561856                        'comment_approved' => '1'
    18571857                ) );
    1858                 $c3 = self::$factory->comment->create( array(
     1858                $c3 = self::factory()->comment->create( array(
    18591859                        'comment_post_ID' => $this->post_id,
    18601860                        'comment_approved' => '1'
    18611861                ) );
    18621862
    1863                 self::$factory->comment->create( array(
     1863                self::factory()->comment->create( array(
    18641864                        'comment_post_ID' => $this->post_id,
    18651865                        'comment_approved' => '1'
    18661866                ) );
    class Tests_Comment_Query extends WP_UnitTestCase { 
    18801880         * @ticket 8071
    18811881         */
    18821882        public function test_no_found_rows_should_default_to_true() {
    1883                 $comments = self::$factory->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) );
     1883                $comments = self::factory()->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) );
    18841884
    18851885                $q = new WP_Comment_Query( array(
    18861886                        'post_id' => $this->post_id,
    class Tests_Comment_Query extends WP_UnitTestCase { 
    18951895         * @ticket 8071
    18961896         */
    18971897        public function test_should_respect_no_found_rows_true() {
    1898                 $comments = self::$factory->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) );
     1898                $comments = self::factory()->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) );
    18991899
    19001900                $q = new WP_Comment_Query( array(
    19011901                        'post_id' => $this->post_id,
    class Tests_Comment_Query extends WP_UnitTestCase { 
    19111911         * @ticket 8071
    19121912         */
    19131913        public function test_should_respect_no_found_rows_false() {
    1914                 $comments = self::$factory->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) );
     1914                $comments = self::factory()->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) );
    19151915
    19161916                $q = new WP_Comment_Query( array(
    19171917                        'post_id' => $this->post_id,
    class Tests_Comment_Query extends WP_UnitTestCase { 
    19271927         * @ticket 8071
    19281928         */
    19291929        public function test_hierarchical_should_skip_child_comments_in_offset() {
    1930                 $top_level_0 = self::$factory->comment->create( array(
     1930                $top_level_0 = self::factory()->comment->create( array(
    19311931                        'comment_post_ID' => $this->post_id,
    19321932                        'comment_approved' => '1',
    19331933                ) );
    19341934
    1935                 $child_of_0 = self::$factory->comment->create( array(
     1935                $child_of_0 = self::factory()->comment->create( array(
    19361936                        'comment_post_ID' => $this->post_id,
    19371937                        'comment_approved' => '1',
    19381938                        'comment_parent' => $top_level_0,
    19391939                ) );
    19401940
    1941                 $top_level_comments = self::$factory->comment->create_many( 3, array(
     1941                $top_level_comments = self::factory()->comment->create_many( 3, array(
    19421942                        'comment_post_ID' => $this->post_id,
    19431943                        'comment_approved' => '1',
    19441944                ) );
    class Tests_Comment_Query extends WP_UnitTestCase { 
    19601960         * @ticket 8071
    19611961         */
    19621962        public function test_hierarchical_should_not_include_child_comments_in_number() {
    1963                 $top_level_0 = self::$factory->comment->create( array(
     1963                $top_level_0 = self::factory()->comment->create( array(
    19641964                        'comment_post_ID' => $this->post_id,
    19651965                        'comment_approved' => '1',
    19661966                ) );
    19671967
    1968                 $child_of_0 = self::$factory->comment->create( array(
     1968                $child_of_0 = self::factory()->comment->create( array(
    19691969                        'comment_post_ID' => $this->post_id,
    19701970                        'comment_approved' => '1',
    19711971                        'comment_parent' => $top_level_0,
    19721972                ) );
    19731973
    1974                 $top_level_comments = self::$factory->comment->create_many( 3, array(
     1974                $top_level_comments = self::factory()->comment->create_many( 3, array(
    19751975                        'comment_post_ID' => $this->post_id,
    19761976                        'comment_approved' => '1',
    19771977                ) );
    class Tests_Comment_Query extends WP_UnitTestCase { 
    19911991         * @ticket 8071
    19921992         */
    19931993        public function test_hierarchical_threaded() {
    1994                 $c1 = self::$factory->comment->create( array(
     1994                $c1 = self::factory()->comment->create( array(
    19951995                        'comment_post_ID' => $this->post_id,
    19961996                        'comment_approved' => '1',
    19971997                ) );
    19981998
    1999                 $c2 = self::$factory->comment->create( array(
     1999                $c2 = self::factory()->comment->create( array(
    20002000                        'comment_post_ID' => $this->post_id,
    20012001                        'comment_approved' => '1',
    20022002                        'comment_parent' => $c1,
    20032003                ) );
    20042004
    2005                 $c3 = self::$factory->comment->create( array(
     2005                $c3 = self::factory()->comment->create( array(
    20062006                        'comment_post_ID' => $this->post_id,
    20072007                        'comment_approved' => '1',
    20082008                        'comment_parent' => $c2,
    20092009                ) );
    20102010
    2011                 $c4 = self::$factory->comment->create( array(
     2011                $c4 = self::factory()->comment->create( array(
    20122012                        'comment_post_ID' => $this->post_id,
    20132013                        'comment_approved' => '1',
    20142014                        'comment_parent' => $c1,
    20152015                ) );
    20162016
    2017                 $c5 = self::$factory->comment->create( array(
     2017                $c5 = self::factory()->comment->create( array(
    20182018                        'comment_post_ID' => $this->post_id,
    20192019                        'comment_approved' => '1',
    20202020                ) );
    20212021
    2022                 $c6 = self::$factory->comment->create( array(
     2022                $c6 = self::factory()->comment->create( array(
    20232023                        'comment_post_ID' => $this->post_id,
    20242024                        'comment_approved' => '1',
    20252025                        'comment_parent' => $c5,
    class Tests_Comment_Query extends WP_UnitTestCase { 
    20542054         * @ticket 8071
    20552055         */
    20562056        public function test_hierarchical_threaded_approved() {
    2057                 $c1 = self::$factory->comment->create( array(
     2057                $c1 = self::factory()->comment->create( array(
    20582058                        'comment_post_ID' => $this->post_id,
    20592059                        'comment_approved' => '1',
    20602060                ) );
    20612061
    2062                 $c2 = self::$factory->comment->create( array(
     2062                $c2 = self::factory()->comment->create( array(
    20632063                        'comment_post_ID' => $this->post_id,
    20642064                        'comment_approved' => '1',
    20652065                        'comment_parent' => $c1,
    20662066                ) );
    20672067
    2068                 $c3 = self::$factory->comment->create( array(
     2068                $c3 = self::factory()->comment->create( array(
    20692069                        'comment_post_ID' => $this->post_id,
    20702070                        'comment_approved' => '0',
    20712071                        'comment_parent' => $c2,
    20722072                ) );
    20732073
    2074                 $c4 = self::$factory->comment->create( array(
     2074                $c4 = self::factory()->comment->create( array(
    20752075                        'comment_post_ID' => $this->post_id,
    20762076                        'comment_approved' => '1',
    20772077                        'comment_parent' => $c1,
    20782078                ) );
    20792079
    2080                 $c5 = self::$factory->comment->create( array(
     2080                $c5 = self::factory()->comment->create( array(
    20812081                        'comment_post_ID' => $this->post_id,
    20822082                        'comment_approved' => '1',
    20832083                ) );
    20842084
    2085                 self::$factory->comment->create( array(
     2085                self::factory()->comment->create( array(
    20862086                        'comment_post_ID' => $this->post_id,
    20872087                        'comment_approved' => '1',
    20882088                        'comment_parent' => $c5,
    class Tests_Comment_Query extends WP_UnitTestCase { 
    21172117        public function test_update_comment_post_cache_should_be_disabled_by_default() {
    21182118                global $wpdb;
    21192119
    2120                 $p = self::$factory->post->create();
    2121                 $c = self::$factory->comment->create( array( 'comment_post_ID' => $p ) );
     2120                $p = self::factory()->post->create();
     2121                $c = self::factory()->comment->create( array( 'comment_post_ID' => $p ) );
    21222122
    21232123                $q = new WP_Comment_Query( array(
    21242124                        'post_ID' => $p,
    class Tests_Comment_Query extends WP_UnitTestCase { 
    21352135        public function test_should_respect_update_comment_post_cache_true() {
    21362136                global $wpdb;
    21372137
    2138                 $p = self::$factory->post->create();
    2139                 $c = self::$factory->comment->create( array( 'comment_post_ID' => $p ) );
     2138                $p = self::factory()->post->create();
     2139                $c = self::factory()->comment->create( array( 'comment_post_ID' => $p ) );
    21402140
    21412141                $q = new WP_Comment_Query( array(
    21422142                        'post_ID' => $p,
  • tests/phpunit/tests/comment/slashes.php

    diff --git tests/phpunit/tests/comment/slashes.php tests/phpunit/tests/comment/slashes.php
    index 01b4e99..6a87ab5 100644
    class Tests_Comment_Slashes extends WP_UnitTestCase { 
    99        function setUp() {
    1010                parent::setUp();
    1111                // we need an admin user to bypass comment flood protection
    12                 $this->author_id = self::$factory->user->create( array( 'role' => 'administrator' ) );
     12                $this->author_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
    1313                $this->old_current_user = get_current_user_id();
    1414                wp_set_current_user( $this->author_id );
    1515
    class Tests_Comment_Slashes extends WP_UnitTestCase { 
    3434         *
    3535         */
    3636        function test_wp_new_comment() {
    37                 $post_id = self::$factory->post->create();
     37                $post_id = self::factory()->post->create();
    3838
    3939                // not testing comment_author_email or comment_author_url
    4040                // as slashes are not permitted in that data
    class Tests_Comment_Slashes extends WP_UnitTestCase { 
    7474         *
    7575         */