Make WordPress Core

Changeset 35225


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

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

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

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

#YOLOFriday

Location:
trunk/tests/phpunit
Files:
169 edited

Legend:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    r33526 r35225  
    2323                parent::setUp();
    2424                require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
    25                 wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     25                wp_set_current_user( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    2626
    2727                global $wp_customize;
  • trunk/tests/phpunit/tests/customize/nav-menus.php

    r35162 r35225  
    2323                parent::setUp();
    2424                require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
    25                 wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     25                wp_set_current_user( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    2626                global $wp_customize;
    2727                $this->wp_customize = new WP_Customize_Manager();
     
    125125
    126126                // Create pages.
    127                 $this->factory->post->create_many( 12, array( 'post_type' => 'page' ) );
     127                self::$factory->post->create_many( 12, array( 'post_type' => 'page' ) );
    128128
    129129                // Home is included in menu items when page is zero.
     
    146146
    147147                // Create page.
    148                 $post_id = $this->factory->post->create( array( 'post_title' => 'Post Title' ) );
     148                $post_id = self::$factory->post->create( array( 'post_title' => 'Post Title' ) );
    149149
    150150                // Create pages.
    151                 $this->factory->post->create_many( 10 );
     151                self::$factory->post->create_many( 10 );
    152152
    153153                // Expected menu item array.
     
    176176
    177177                // Create page.
    178                 $page_id = $this->factory->post->create( array( 'post_title' => 'Page Title', 'post_type' => 'page' ) );
     178                $page_id = self::$factory->post->create( array( 'post_title' => 'Page Title', 'post_type' => 'page' ) );
    179179
    180180                // Expected menu item array.
     
    202202
    203203                // Create post.
    204                 $post_id = $this->factory->post->create( array( 'post_title' => 'Post Title' ) );
     204                $post_id = self::$factory->post->create( array( 'post_title' => 'Post Title' ) );
    205205
    206206                // Expected menu item array.
     
    228228
    229229                // Create term.
    230                 $term_id = $this->factory->category->create( array( 'name' => 'Term Title' ) );
     230                $term_id = self::$factory->category->create( array( 'name' => 'Term Title' ) );
    231231
    232232                // Expected menu item array.
     
    280280                // Create posts
    281281                $post_ids = array();
    282                 $post_ids[] = $this->factory->post->create( array( 'post_title' => 'Search & Test' ) );
    283                 $post_ids[] = $this->factory->post->create( array( 'post_title' => 'Some Other Title' ) );
     282                $post_ids[] = self::$factory->post->create( array( 'post_title' => 'Search & Test' ) );
     283                $post_ids[] = self::$factory->post->create( array( 'post_title' => 'Some Other Title' ) );
    284284
    285285                // Create terms
    286286                $term_ids = array();
    287                 $term_ids[] = $this->factory->category->create( array( 'name' => 'Dogs Are Cool' ) );
    288                 $term_ids[] = $this->factory->category->create( array( 'name' => 'Cats Drool' ) );
     287                $term_ids[] = self::$factory->category->create( array( 'name' => 'Dogs Are Cool' ) );
     288                $term_ids[] = self::$factory->category->create( array( 'name' => 'Cats Drool' ) );
    289289
    290290                // Test empty results
     
    387387                do_action( 'customize_register', $this->wp_customize );
    388388                $menu_id = wp_create_nav_menu( 'Primary' );
    389                 $post_id = $this->factory->post->create( array( 'post_title' => 'Hello World' ) );
     389                $post_id = self::$factory->post->create( array( 'post_title' => 'Hello World' ) );
    390390                $item_id = wp_update_nav_menu_item( $menu_id, 0, array(
    391391                        'menu-item-type'      => 'post_type',
  • trunk/tests/phpunit/tests/customize/panel.php

    r32658 r35225  
    129129         */
    130130        function test_check_capabilities() {
    131                 $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
     131                $user_id = self::$factory->user->create( array( 'role' => 'administrator' ) );
    132132                wp_set_current_user( $user_id );
    133133
     
    155155         */
    156156        function test_maybe_render() {
    157                 wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     157                wp_set_current_user( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    158158                $panel = new WP_Customize_Panel( $this->manager, 'bar' );
    159159                $customize_render_panel_count = did_action( 'customize_render_panel' );
     
    180180         */
    181181        function test_print_templates_standard() {
    182                 wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     182                wp_set_current_user( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    183183
    184184                $panel = new WP_Customize_Panel( $this->manager, 'baz' );
     
    198198         */
    199199        function test_print_templates_custom() {
    200                 wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     200                wp_set_current_user( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    201201
    202202                $panel = new Custom_Panel_Test( $this->manager, 'baz' );
  • trunk/tests/phpunit/tests/customize/section.php

    r32658 r35225  
    136136         */
    137137        function test_check_capabilities() {
    138                 $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
     138                $user_id = self::$factory->user->create( array( 'role' => 'administrator' ) );
    139139                wp_set_current_user( $user_id );
    140140
     
    162162         */
    163163        function test_maybe_render() {
    164                 wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     164                wp_set_current_user( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    165165                $section = new WP_Customize_Section( $this->manager, 'bar' );
    166166                $customize_render_section_count = did_action( 'customize_render_section' );
     
    187187         */
    188188        function test_print_templates_standard() {
    189                 wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     189                wp_set_current_user( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    190190
    191191                $section = new WP_Customize_Section( $this->manager, 'baz' );
     
    202202         */
    203203        function test_print_templates_custom() {
    204                 wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     204                wp_set_current_user( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    205205
    206206                $section = new Custom_Section_Test( $this->manager, 'baz' );
  • trunk/tests/phpunit/tests/customize/setting.php

    r35007 r35225  
    395395
    396396                // Satisfy all requirements for save to happen.
    397                 wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     397                wp_set_current_user( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    398398                $this->assertTrue( false !== $setting->save() );
    399399                $this->assertTrue( 1 === did_action( 'customize_update_custom' ) );
     
    466466                $this->assertTrue( $setting->is_current_blog_previewed() );
    467467
    468                 $blog_id = $this->factory->blog->create();
     468                $blog_id = self::$factory->blog->create();
    469469                switch_to_blog( $blog_id );
    470470                $this->assertFalse( $setting->is_current_blog_previewed() );
  • trunk/tests/phpunit/tests/customize/widgets.php

    r34563 r35225  
    3131                remove_action( 'after_setup_theme', 'twentyfifteen_setup' ); // @todo We should not be including a theme anyway
    3232
    33                 $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
     33                $user_id = self::$factory->user->create( array( 'role' => 'administrator' ) );
    3434                wp_set_current_user( $user_id );
    3535        }
  • trunk/tests/phpunit/tests/date/query.php

    r35091 r35225  
    976976         */
    977977        public function test_validate_date_values_should_process_array_value_for_year() {
    978                 $p1 = $this->factory->post->create( array( 'post_date' => '2015-01-12 00:00:00' ) );
    979                 $p2 = $this->factory->post->create( array( 'post_date' => '2013-01-12 00:00:00' ) );
     978                $p1 = self::$factory->post->create( array( 'post_date' => '2015-01-12 00:00:00' ) );
     979                $p2 = self::$factory->post->create( array( 'post_date' => '2013-01-12 00:00:00' ) );
    980980
    981981                $q = new WP_Query( array(
     
    996996         */
    997997        public function test_validate_date_values_should_process_array_value_for_day() {
    998                 $p1 = $this->factory->post->create( array( 'post_date' => '2015-01-12 00:00:00' ) );
    999                 $p2 = $this->factory->post->create( array( 'post_date' => '2015-01-10 00:00:00' ) );
     998                $p1 = self::$factory->post->create( array( 'post_date' => '2015-01-12 00:00:00' ) );
     999                $p2 = self::$factory->post->create( array( 'post_date' => '2015-01-10 00:00:00' ) );
    10001000
    10011001                $q = new WP_Query( array(
     
    10171017         */
    10181018        public function test_validate_date_values_should_process_array_value_for_day_when_values_are_invalid() {
    1019                 $p1 = $this->factory->post->create( array( 'post_date' => '2015-01-12 00:00:00' ) );
    1020                 $p2 = $this->factory->post->create( array( 'post_date' => '2015-01-10 00:00:00' ) );
     1019                $p1 = self::$factory->post->create( array( 'post_date' => '2015-01-12 00:00:00' ) );
     1020                $p2 = self::$factory->post->create( array( 'post_date' => '2015-01-10 00:00:00' ) );
    10211021
    10221022                $q = new WP_Query( array(
  • trunk/tests/phpunit/tests/db.php

    r34737 r35225  
    510510                }
    511511
    512                 $post_id = $this->factory->post->create();
     512                $post_id = self::$factory->post->create();
    513513
    514514                $this->assertNotEmpty( $wpdb->get_results( 'CALL `test_mysqli_flush_sync_procedure`' ) );
  • trunk/tests/phpunit/tests/formatting/SanitizePost.php

    r25002 r35225  
    1010         */
    1111        function test_int_fields() {
    12                 $post = $this->factory->post->create_and_get();
     12                $post = self::$factory->post->create_and_get();
    1313                $int_fields = array(
    1414                        'ID'            => 'integer',
  • trunk/tests/phpunit/tests/formatting/WpTrimExcerpt.php

    r30976 r35225  
    1010         */
    1111        public function test_secondary_loop_respect_more() {
    12                 $post1 = $this->factory->post->create( array(
     12                $post1 = self::$factory->post->create( array(
    1313                        'post_content' => 'Post 1 Page 1<!--more-->Post 1 Page 2',
    1414                ) );
    15                 $post2 = $this->factory->post->create( array(
     15                $post2 = self::$factory->post->create( array(
    1616                        'post_content' => 'Post 2 Page 1<!--more-->Post 2 Page 2',
    1717                ) );
     
    3535         */
    3636        public function test_secondary_loop_respect_nextpage() {
    37                 $post1 = $this->factory->post->create( array(
     37                $post1 = self::$factory->post->create( array(
    3838                        'post_content' => 'Post 1 Page 1<!--nextpage-->Post 1 Page 2',
    3939                ) );
    40                 $post2 = $this->factory->post->create( array(
     40                $post2 = self::$factory->post->create( array(
    4141                        'post_content' => 'Post 2 Page 1<!--nextpage-->Post 2 Page 2',
    4242                ) );
  • trunk/tests/phpunit/tests/functions.php

    r35124 r35225  
    690690                $this->assertEquals( '', $actual );
    691691
    692                 $GLOBALS['post']        = $this->factory->post->create_and_get( array(
     692                $GLOBALS['post']        = self::$factory->post->create_and_get( array(
    693693                        'post_date' => '2015-09-16 08:00:00'
    694694                ) );
  • trunk/tests/phpunit/tests/functions/getArchives.php

    r35186 r35225  
    8888
    8989        function test_wp_get_archives_order() {
    90                 $this->factory->post->create( array( 'post_type' => 'post', 'post_author' => '1', 'post_date' => '2012-10-23 19:34:42' ) );
     90                self::$factory->post->create( array( 'post_type' => 'post', 'post_author' => '1', 'post_date' => '2012-10-23 19:34:42' ) );
    9191
    9292                $date_full = date( 'F Y' );
     
    111111                register_post_type( 'taco', array( 'public' => true ) );
    112112
    113                 $this->factory->post->create( array(
     113                self::$factory->post->create( array(
    114114                        'post_type' => 'taco',
    115115                        'post_author' => '1',
  • trunk/tests/phpunit/tests/general/archives.php

    r35162 r35225  
    1717                global $wpdb;
    1818
    19                 $this->factory->post->create_many( 3, array( 'post_type' => 'post' ) );
     19                self::$factory->post->create_many( 3, array( 'post_type' => 'post' ) );
    2020                wp_cache_delete( 'last_changed', 'posts' );
    2121                $this->assertFalse( wp_cache_get( 'last_changed', 'posts' ) );
  • trunk/tests/phpunit/tests/includes/factory.php

    r32659 r35225  
    3535        public function test_term_factory_create_and_get_should_return_term_object() {
    3636                register_taxonomy( 'wptests_tax', 'post' );
    37                 $term = $this->factory->term->create_and_get( array( 'taxonomy' => 'wptests_tax' ) );
     37                $term = self::$factory->term->create_and_get( array( 'taxonomy' => 'wptests_tax' ) );
    3838                $this->assertInternalType( 'object', $term );
    3939                $this->assertNotEmpty( $term->term_id );
  • trunk/tests/phpunit/tests/link.php

    r34810 r35225  
    3434
    3535        function test_wp_get_shortlink() {
    36                 $post_id = $this->factory->post->create();
    37                 $post_id2 = $this->factory->post->create();
     36                $post_id = self::$factory->post->create();
     37                $post_id2 = self::$factory->post->create();
    3838
    3939                // Basic case
     
    7878
    7979        function test_wp_get_shortlink_with_page() {
    80                 $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
     80                $post_id = self::$factory->post->create( array( 'post_type' => 'page' ) );
    8181
    8282                // Basic case
     
    9393         */
    9494        function test_wp_get_shortlink_with_home_page() {
    95                 $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
     95                $post_id = self::$factory->post->create( array( 'post_type' => 'page' ) );
    9696                update_option( 'show_on_front', 'page' );
    9797                update_option( 'page_on_front', $post_id );
     
    109109        function test_get_adjacent_post() {
    110110                // Need some sample posts to test adjacency
    111                 $post_one = $this->factory->post->create_and_get( array(
     111                $post_one = self::$factory->post->create_and_get( array(
    112112                        'post_title' => 'First',
    113113                        'post_date' => '2012-01-01 12:00:00'
    114114                ) );
    115115
    116                 $post_two = $this->factory->post->create_and_get( array(
     116                $post_two = self::$factory->post->create_and_get( array(
    117117                        'post_title' => 'Second',
    118118                        'post_date' => '2012-02-01 12:00:00'
    119119                ) );
    120120
    121                 $post_three = $this->factory->post->create_and_get( array(
     121                $post_three = self::$factory->post->create_and_get( array(
    122122                        'post_title' => 'Third',
    123123                        'post_date' => '2012-03-01 12:00:00'
    124124                ) );
    125125
    126                 $post_four = $this->factory->post->create_and_get( array(
     126                $post_four = self::$factory->post->create_and_get( array(
    127127                        'post_title' => 'Fourth',
    128128                        'post_date' => '2012-04-01 12:00:00'
     
    184184                $wpdb->insert( $wpdb->term_taxonomy, array( 'taxonomy' => 'foo', 'term_id' => 12345, 'description' => '' ) );
    185185
    186                 $include = $this->factory->term->create( array(
     186                $include = self::$factory->term->create( array(
    187187                        'taxonomy' => 'category',
    188188                        'name' => 'Include',
    189189                ) );
    190                 $exclude = $this->factory->category->create();
    191 
    192                 $one = $this->factory->post->create_and_get( array(
     190                $exclude = self::$factory->category->create();
     191
     192                $one = self::$factory->post->create_and_get( array(
    193193                        'post_date' => '2012-01-01 12:00:00',
    194194                        'post_category' => array( $include, $exclude ),
    195195                ) );
    196196
    197                 $two = $this->factory->post->create_and_get( array(
     197                $two = self::$factory->post->create_and_get( array(
    198198                        'post_date' => '2012-01-02 12:00:00',
    199199                        'post_category' => array(),
    200200                ) );
    201201
    202                 $three = $this->factory->post->create_and_get( array(
     202                $three = self::$factory->post->create_and_get( array(
    203203                        'post_date' => '2012-01-03 12:00:00',
    204204                        'post_category' => array( $include, $exclude ),
    205205                ) );
    206206
    207                 $four = $this->factory->post->create_and_get( array(
     207                $four = self::$factory->post->create_and_get( array(
    208208                        'post_date' => '2012-01-04 12:00:00',
    209209                        'post_category' => array( $include ),
    210210                ) );
    211211
    212                 $five = $this->factory->post->create_and_get( array(
     212                $five = self::$factory->post->create_and_get( array(
    213213                        'post_date' => '2012-01-05 12:00:00',
    214214                        'post_category' => array( $include, $exclude ),
     
    250250                register_taxonomy( 'wptests_tax', 'post' );
    251251
    252                 $t = $this->factory->term->create( array(
     252                $t = self::$factory->term->create( array(
    253253                        'taxonomy' => 'wptests_tax',
    254254                ) );
    255255
    256                 $p1 = $this->factory->post->create( array( 'post_date' => '2015-08-27 12:00:00' ) );
    257                 $p2 = $this->factory->post->create( array( 'post_date' => '2015-08-26 12:00:00' ) );
    258                 $p3 = $this->factory->post->create( array( 'post_date' => '2015-08-25 12:00:00' ) );
     256                $p1 = self::$factory->post->create( array( 'post_date' => '2015-08-27 12:00:00' ) );
     257                $p2 = self::$factory->post->create( array( 'post_date' => '2015-08-26 12:00:00' ) );
     258                $p3 = self::$factory->post->create( array( 'post_date' => '2015-08-25 12:00:00' ) );
    259259
    260260                wp_set_post_terms( $p2, array( $t ), 'wptests_tax' );
     
    282282                register_taxonomy( 'wptests_tax', 'post' );
    283283
    284                 $t = $this->factory->term->create( array(
     284                $t = self::$factory->term->create( array(
    285285                        'taxonomy' => 'wptests_tax',
    286286                ) );
    287287
    288                 $p1 = $this->factory->post->create( array( 'post_date' => '2015-08-27 12:00:00' ) );
    289                 $p2 = $this->factory->post->create( array( 'post_date' => '2015-08-26 12:00:00' ) );
    290                 $p3 = $this->factory->post->create( array( 'post_date' => '2015-08-25 12:00:00' ) );
     288                $p1 = self::$factory->post->create( array( 'post_date' => '2015-08-27 12:00:00' ) );
     289                $p2 = self::$factory->post->create( array( 'post_date' => '2015-08-26 12:00:00' ) );
     290                $p3 = self::$factory->post->create( array( 'post_date' => '2015-08-25 12:00:00' ) );
    291291
    292292                wp_set_post_terms( $p2, array( $t ), 'wptests_tax' );
     
    349349                flush_rewrite_rules();
    350350
    351                 $p = $this->factory->post->create( array(
     351                $p = self::$factory->post->create( array(
    352352                        'post_status' => 'publish',
    353353                        'post_date'   => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' ) )
     
    369369                flush_rewrite_rules();
    370370
    371                 $p = $this->factory->post->create( array(
     371                $p = self::$factory->post->create( array(
    372372                        'post_status' => 'future',
    373373                        'post_type'   => 'wptests_pt',
     
    389389                $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    390390
    391                 $attachment_id = $this->factory->attachment->create_object( 'image.jpg', 0, array(
     391                $attachment_id = self::$factory->attachment->create_object( 'image.jpg', 0, array(
    392392                        'post_mime_type' => 'image/jpeg',
    393393                        'post_type' => 'attachment',
     
    413413                flush_rewrite_rules();
    414414
    415                 $post_id = $this->factory->post->create( array( 'post_type' => 'not_a_post_type' ) );
    416 
    417                 $attachment_id = $this->factory->attachment->create_object( 'image.jpg', $post_id, array(
     415                $post_id = self::$factory->post->create( array( 'post_type' => 'not_a_post_type' ) );
     416
     417                $attachment_id = self::$factory->attachment->create_object( 'image.jpg', $post_id, array(
    418418                        'post_mime_type' => 'image/jpeg',
    419419                        'post_type' => 'attachment',
  • trunk/tests/phpunit/tests/link/getAdjacentPostLink.php

    r31097 r35225  
    1111        public function setUp(){
    1212                parent::setUp();
    13                 $this->cat_id = $this->factory->category->create( array( 'name' => 'other' ) );
     13                $this->cat_id = self::$factory->category->create( array( 'name' => 'other' ) );
    1414                $this->post_ids = array();
    15                 $this->post_ids[] = $this->factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 05:32:29', 'category_id' => 1 ) );
    16                 $this->post_ids[] = $this->factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 04:32:29', 'category_id' => $this->cat_id ) );
    17                 $this->post_ids[] = $this->factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 03:32:29', 'category_id' => 1 ) );
    18                 $this->post_ids[] = $this->factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 02:32:29', 'category_id' => $this->cat_id ) );
    19                 $this->post_ids[] = $this->factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 01:32:29', 'category_id' => 1 ) );
     15                $this->post_ids[] = self::$factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 05:32:29', 'category_id' => 1 ) );
     16                $this->post_ids[] = self::$factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 04:32:29', 'category_id' => $this->cat_id ) );
     17                $this->post_ids[] = self::$factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 03:32:29', 'category_id' => 1 ) );
     18                $this->post_ids[] = self::$factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 02:32:29', 'category_id' => $this->cat_id ) );
     19                $this->post_ids[] = self::$factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 01:32:29', 'category_id' => 1 ) );
    2020
    2121                //set current post (has 2 on each end)
     
    2626        public function test_get_next_post_link_default() {
    2727                $actual = get_next_post_link();
    28                 $expected = '<a href="' . home_url( '?p=' . $this->post_ids[1] ) . '" rel="next">Post title 2</a> &raquo;';
     28                $title = get_post( $this->post_ids[1] )->post_title;
     29                $expected = '<a href="' . home_url( '?p=' . $this->post_ids[1] ) . '" rel="next">' . $title . '</a> &raquo;';
    2930                $this->assertSame( $expected, $actual );
    3031        }
     
    3233        public function test_get_previous_post_link_default() {
    3334                $actual = get_previous_post_link();
    34                 $expected = '&laquo; <a href="' . home_url( '?p=' . $this->post_ids[3] ) . '" rel="prev">Post title 4</a>';
     35                $title = get_post( $this->post_ids[3] )->post_title;
     36                $expected = '&laquo; <a href="' . home_url( '?p=' . $this->post_ids[3] ) . '" rel="prev">' . $title . '</a>';
    3537                $this->assertSame( $expected, $actual );
    3638        }
     
    3840        public function test_get_next_post_link_same_category() {
    3941                $actual = get_next_post_link( '%link &raquo;', '%title', true );
    40                 $expected = '<a href="' . home_url( '?p=' . $this->post_ids[1] ) . '" rel="next">Post title 2</a> &raquo;';
     42                $title = get_post( $this->post_ids[1] )->post_title;
     43                $expected = '<a href="' . home_url( '?p=' . $this->post_ids[1] ) . '" rel="next">' . $title . '</a> &raquo;';
    4144                $this->assertSame( $expected, $actual );
    4245        }
     
    4447        public function test_get_previous_post_link_same_category() {
    4548                $actual = get_previous_post_link( '&laquo; %link', '%title', true );
    46                 $expected = '&laquo; <a href="' . home_url( '?p=' . $this->post_ids[3] ) . '" rel="prev">Post title 4</a>';
     49                $title = get_post( $this->post_ids[3] )->post_title;
     50                $expected = '&laquo; <a href="' . home_url( '?p=' . $this->post_ids[3] ) . '" rel="prev">' . $title . '</a>';
    4751                $this->assertSame( $expected, $actual );
    4852        }
     
    5054        public function test_get_next_post_link_exclude_category() {
    5155                $actual = get_next_post_link( '%link &raquo;', '%title', false, $this->cat_id );
    52                 $expected = '<a href="' . home_url( '?p=' . $this->post_ids[1] ) . '" rel="next">Post title 2</a> &raquo;';
     56                $title = get_post( $this->post_ids[1] )->post_title;
     57                $expected = '<a href="' . home_url( '?p=' . $this->post_ids[1] ) . '" rel="next">' . $title . '</a> &raquo;';
    5358                $this->assertSame( $expected, $actual );
    5459        }
     
    5661        public function test_get_previous_post_link_exclude_category() {
    5762                $actual = get_previous_post_link( '&laquo; %link', '%title', false, $this->cat_id );
    58                 $expected = '&laquo; <a href="' . home_url( '?p=' . $this->post_ids[3] ) . '" rel="prev">Post title 4</a>';
     63                $title = get_post( $this->post_ids[3] )->post_title;
     64                $expected = '&laquo; <a href="' . home_url( '?p=' . $this->post_ids[3] ) . '" rel="prev">' . $title . '</a>';
    5965                $this->assertSame( $expected, $actual );
    6066        }
  • trunk/tests/phpunit/tests/link/getNextCommentsLink.php

    r34802 r35225  
    99
    1010        public function test_page_should_respect_value_of_cpage_query_var() {
    11                 $p = $this->factory->post->create();
     11                $p = self::$factory->post->create();
    1212                $this->go_to( get_permalink( $p ) );
    1313
     
    2626         */
    2727        public function test_page_should_default_to_1_when_no_cpage_query_var_is_found() {
    28                 $p = $this->factory->post->create();
     28                $p = self::$factory->post->create();
    2929                $this->go_to( get_permalink( $p ) );
    3030
  • trunk/tests/phpunit/tests/link/getPostCommentsFeedLink.php

    r34810 r35225  
    66
    77        public function test_post_link() {
    8                 $post_id = $this->factory->post->create();
     8                $post_id = self::$factory->post->create();
    99
    1010                $link = get_post_comments_feed_link( $post_id );
     
    2020                $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    2121
    22                 $post_id = $this->factory->post->create();
     22                $post_id = self::$factory->post->create();
    2323
    2424                $link = get_post_comments_feed_link( $post_id );
     
    2929
    3030        public function test_attachment_link() {
    31                 $post_id = $this->factory->post->create();
    32                 $attachment_id = $this->factory->attachment->create_object( 'image.jpg', $post_id, array(
     31                $post_id = self::$factory->post->create();
     32                $attachment_id = self::$factory->attachment->create_object( 'image.jpg', $post_id, array(
    3333                        'post_mime_type' => 'image/jpeg',
    3434                        'post_type' => 'attachment'
     
    4747                $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    4848
    49                 $post_id = $this->factory->post->create( array(
     49                $post_id = self::$factory->post->create( array(
    5050                        'post_status' => 'publish'
    5151                ) );
    52                 $attachment_id = $this->factory->attachment->create_object( 'image.jpg', $post_id, array(
     52                $attachment_id = self::$factory->attachment->create_object( 'image.jpg', $post_id, array(
    5353                        'post_mime_type' => 'image/jpeg',
    5454                        'post_type' => 'attachment',
     
    6767                $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    6868
    69                 $post_id = $this->factory->post->create();
    70                 $attachment_id = $this->factory->attachment->create_object( 'image.jpg', $post_id, array(
     69                $post_id = self::$factory->post->create();
     70                $attachment_id = self::$factory->attachment->create_object( 'image.jpg', $post_id, array(
    7171                        'post_mime_type' => 'image/jpeg',
    7272                        'post_type' => 'attachment'
     
    8080
    8181        public function test_unattached_link() {
    82                 $attachment_id = $this->factory->attachment->create_object( 'image.jpg', 0, array(
     82                $attachment_id = self::$factory->attachment->create_object( 'image.jpg', 0, array(
    8383                        'post_mime_type' => 'image/jpeg',
    8484                        'post_type' => 'attachment'
     
    9797                $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    9898
    99                 $attachment_id = $this->factory->attachment->create_object( 'image.jpg', 0, array(
     99                $attachment_id = self::$factory->attachment->create_object( 'image.jpg', 0, array(
    100100                        'post_mime_type' => 'image/jpeg',
    101101                        'post_type' => 'attachment'
  • trunk/tests/phpunit/tests/link/getPreviousCommentsLink.php

    r34802 r35225  
    99
    1010        public function test_page_should_respect_value_of_cpage_query_var() {
    11                 $p = $this->factory->post->create();
     11                $p = self::$factory->post->create();
    1212                $this->go_to( get_permalink( $p ) );
    1313
     
    2323
    2424        public function test_page_should_default_to_1_when_no_cpage_query_var_is_found() {
    25                 $p = $this->factory->post->create();
     25                $p = self::$factory->post->create();
    2626                $this->go_to( get_permalink( $p ) );
    2727
  • trunk/tests/phpunit/tests/media.php

    r35186 r35225  
    237237         */
    238238        function test_get_attached_images() {
    239                 $post_id = $this->factory->post->create();
    240                 $attachment_id = $this->factory->attachment->create_object( $this->img_name, $post_id, array(
     239                $post_id = self::$factory->post->create();
     240                $attachment_id = self::$factory->attachment->create_object( $this->img_name, $post_id, array(
    241241                        'post_mime_type' => 'image/jpeg',
    242242                        'post_type' => 'attachment'
     
    254254                $ids1_srcs = array();
    255255                foreach ( range( 1, 3 ) as $i ) {
    256                         $attachment_id = $this->factory->attachment->create_object( "image$i.jpg", 0, array(
     256                        $attachment_id = self::$factory->attachment->create_object( "image$i.jpg", 0, array(
    257257                                'post_mime_type' => 'image/jpeg',
    258258                                'post_type' => 'attachment'
     
    267267                $ids2_srcs = array();
    268268                foreach ( range( 4, 6 ) as $i ) {
    269                         $attachment_id = $this->factory->attachment->create_object( "image$i.jpg", 0, array(
     269                        $attachment_id = self::$factory->attachment->create_object( "image$i.jpg", 0, array(
    270270                                'post_mime_type' => 'image/jpeg',
    271271                                'post_type' => 'attachment'
     
    285285[gallery ids="$ids2_joined"]
    286286BLOB;
    287                 $post_id = $this->factory->post->create( array( 'post_content' => $blob ) );
     287                $post_id = self::$factory->post->create( array( 'post_content' => $blob ) );
    288288                $srcs = get_post_galleries_images( $post_id );
    289289                $this->assertEquals( $srcs, array( $ids1_srcs, $ids2_srcs ) );
     
    297297                $ids1_srcs = array();
    298298                foreach ( range( 1, 3 ) as $i ) {
    299                         $attachment_id = $this->factory->attachment->create_object( "image$i.jpg", 0, array(
     299                        $attachment_id = self::$factory->attachment->create_object( "image$i.jpg", 0, array(
    300300                                'post_mime_type' => 'image/jpeg',
    301301                                'post_type' => 'attachment'
     
    310310                $ids2_srcs = array();
    311311                foreach ( range( 4, 6 ) as $i ) {
    312                         $attachment_id = $this->factory->attachment->create_object( "image$i.jpg", 0, array(
     312                        $attachment_id = self::$factory->attachment->create_object( "image$i.jpg", 0, array(
    313313                                'post_mime_type' => 'image/jpeg',
    314314                                'post_type' => 'attachment'
     
    328328[gallery ids="$ids2_joined"]
    329329BLOB;
    330                 $post_id = $this->factory->post->create( array( 'post_content' => $blob ) );
     330                $post_id = self::$factory->post->create( array( 'post_content' => $blob ) );
    331331                $srcs = get_post_gallery_images( $post_id );
    332332                $this->assertEquals( $srcs, $ids1_srcs );
     
    506506        function test_attachment_url_to_postid() {
    507507                $image_path = '2014/11/' . $this->img_name;
    508                 $attachment_id = $this->factory->attachment->create_object( $image_path, 0, array(
     508                $attachment_id = self::$factory->attachment->create_object( $image_path, 0, array(
    509509                        'post_mime_type' => 'image/jpeg',
    510510                        'post_type'      => 'attachment',
     
    517517        function test_attachment_url_to_postid_schemes() {
    518518                $image_path = '2014/11/' . $this->img_name;
    519                 $attachment_id = $this->factory->attachment->create_object( $image_path, 0, array(
     519                $attachment_id = self::$factory->attachment->create_object( $image_path, 0, array(
    520520                        'post_mime_type' => 'image/jpeg',
    521521                        'post_type'      => 'attachment',
     
    531531        function test_attachment_url_to_postid_filtered() {
    532532                $image_path = '2014/11/' . $this->img_name;
    533                 $attachment_id = $this->factory->attachment->create_object( $image_path, 0, array(
     533                $attachment_id = self::$factory->attachment->create_object( $image_path, 0, array(
    534534                        'post_mime_type' => 'image/jpeg',
    535535                        'post_type'      => 'attachment',
     
    705705                $this->assertFalse( wp_get_attachment_image_url( 0 ) );
    706706
    707                 $post_id = $this->factory->post->create();
    708                 $attachment_id = $this->factory->attachment->create_object( $this->img_name, $post_id, array(
     707                $post_id = self::$factory->post->create();
     708                $attachment_id = self::$factory->attachment->create_object( $this->img_name, $post_id, array(
    709709                        'post_mime_type' => 'image/jpeg',
    710710                        'post_type' => 'attachment',
     
    761761                // Make an image.
    762762                $filename = DIR_TESTDATA . '/images/test-image-large.png';
    763                 $id = $this->factory->attachment->create_upload_object( $filename );
     763                $id = self::$factory->attachment->create_upload_object( $filename );
    764764
    765765                $image = wp_get_attachment_metadata( $id );
  • trunk/tests/phpunit/tests/meta.php

    r30702 r35225  
    99        function setUp() {
    1010                parent::setUp();
    11                 $this->author = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
     11                $this->author = new WP_User( self::$factory->user->create( array( 'role' => 'author' ) ) );
    1212                $this->meta_id = add_metadata( 'user', $this->author->ID, 'meta_key', 'meta_value' );
    1313                $this->delete_meta_id = add_metadata( 'user', $this->author->ID, 'delete_meta_key', 'delete_meta_value' );
     
    195195         */
    196196        function test_meta_type_cast() {
    197                 $post_id1 = $this->factory->post->create();
     197                $post_id1 = self::$factory->post->create();
    198198                add_post_meta( $post_id1, 'num_as_longtext', 123 );
    199199                add_post_meta( $post_id1, 'num_as_longtext_desc', 10 );
    200                 $post_id2 = $this->factory->post->create();
     200                $post_id2 = self::$factory->post->create();
    201201                add_post_meta( $post_id2, 'num_as_longtext', 99 );
    202202                add_post_meta( $post_id2, 'num_as_longtext_desc', 100 );
     
    259259
    260260        function test_meta_cache_order_asc() {
    261                 $post_id = $this->factory->post->create();
     261                $post_id = self::$factory->post->create();
    262262                $colors = array( 'red', 'blue', 'yellow', 'green' );
    263263                foreach ( $colors as $color )
  • trunk/tests/phpunit/tests/meta/slashes.php

    r25383 r35225  
    99        function setUp() {
    1010                parent::setUp();
    11                 $this->author_id = $this->factory->user->create( array( 'role' => 'editor' ) );
    12                 $this->post_id = $this->factory->post->create();
     11                $this->author_id = self::$factory->user->create( array( 'role' => 'editor' ) );
     12                $this->post_id = self::$factory->post->create();
    1313                $this->old_current_user = get_current_user_id();
    1414                wp_set_current_user( $this->author_id );
     
    3333         */
    3434        function test_edit_post() {
    35                 $id = $this->factory->post->create();
     35                $id = self::$factory->post->create();
    3636                if ( function_exists( 'wp_add_post_meta' ) ) {
    3737                        $meta_1 = wp_add_post_meta( $id, 'slash_test_1', 'foo' );
     
    109109         */
    110110        function test_add_post_meta() {
    111                 $id = $this->factory->post->create();
     111                $id = self::$factory->post->create();
    112112                add_post_meta( $id, 'slash_test_1', addslashes( $this->slash_1 ) );
    113113                add_post_meta( $id, 'slash_test_2', addslashes( $this->slash_3 ) );
     
    124124         */
    125125        function test_update_post_meta() {
    126                 $id = $this->factory->post->create();
     126                $id = self::$factory->post->create();
    127127                update_post_meta( $id, 'slash_test_1', addslashes( $this->slash_1 ) );
    128128                update_post_meta( $id, 'slash_test_2', addslashes( $this->slash_3 ) );
     
    142142                        return;
    143143                }
    144                 $id = $this->factory->post->create();
     144                $id = self::$factory->post->create();
    145145                wp_add_post_meta( $id, 'slash_test_1', $this->slash_1 );
    146146                wp_add_post_meta( $id, 'slash_test_2', $this->slash_3 );
     
    160160                        return;
    161161                }
    162                 $id = $this->factory->post->create();
     162                $id = self::$factory->post->create();
    163163                wp_update_post_meta( $id, 'slash_test_1', $this->slash_1 );
    164164                wp_update_post_meta( $id, 'slash_test_2', $this->slash_3 );
     
    175175         */
    176176        function test_add_comment_meta() {
    177                 $id = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
     177                $id = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
    178178
    179179                add_comment_meta( $id, 'slash_test_1', $this->slash_1 );
     
    199199         */
    200200        function test_update_comment_meta() {
    201                 $id = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
     201                $id = self::$factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );
    202202
    203203                add_comment_meta( $id, 'slash_test_1', 'foo' );
     
    227227         */
    228228        function test_add_user_meta() {
    229                 $id = $this->factory->user->create();
     229                $id = self::$factory->user->create();
    230230
    231231                add_user_meta( $id, 'slash_test_1', $this->slash_1 );
     
    251251         */
    252252        function test_update_user_meta() {
    253                 $id = $this->factory->user->create();
     253                $id = self::$factory->user->create();
    254254
    255255                add_user_meta( $id, 'slash_test_1', 'foo' );
  • trunk/tests/phpunit/tests/multisite/bootstrap.php

    r34172 r35225  
    4141
    4242                foreach ( $ids as &$id ) {
    43                         $id = $this->factory->network->create( $id );
     43                        $id = self::$factory->network->create( $id );
    4444                }
    4545                unset( $id );
     
    8989
    9090                foreach ( $ids as &$id ) {
    91                         $id = $this->factory->blog->create( $id );
     91                        $id = self::$factory->blog->create( $id );
    9292                }
    9393                unset( $id );
     
    170170
    171171                foreach ( $network_ids as &$id ) {
    172                         $id = $this->factory->network->create( $id );
     172                        $id = self::$factory->network->create( $id );
    173173                }
    174174                unset( $id );
     
    183183
    184184                foreach ( $ids as &$id ) {
    185                         $id = $this->factory->blog->create( $id );
     185                        $id = self::$factory->blog->create( $id );
    186186                }
    187187                unset( $id );
  • trunk/tests/phpunit/tests/multisite/getSpaceUsed.php

    r34518 r35225  
    2323
    2424        function test_get_space_used_switched_site() {
    25                 $blog_id = $this->factory->blog->create();
     25                $blog_id = self::$factory->blog->create();
    2626                switch_to_blog( $blog_id );
    2727
     
    3131                while ( 0 != get_space_used() ) {
    3232                        restore_current_blog();
    33                         $blog_id = $this->factory->blog->create();
     33                        $blog_id = self::$factory->blog->create();
    3434                        switch_to_blog( $blog_id );
    3535                }
     
    5959                $space_used = get_space_used();
    6060
    61                 $blog_id = $this->factory->blog->create();
     61                $blog_id = self::$factory->blog->create();
    6262                switch_to_blog( $blog_id );
    6363
     
    6767                while ( 0 != get_space_used() ) {
    6868                        restore_current_blog();
    69                         $blog_id = $this->factory->blog->create();
     69                        $blog_id = self::$factory->blog->create();
    7070                        switch_to_blog( $blog_id );
    7171                }
  • trunk/tests/phpunit/tests/multisite/ms-files-rewriting.php

    r34172 r35225  
    3838                $site = get_current_site();
    3939
    40                 $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
    41                 $blog_id2 = $this->factory->blog->create( array( 'user_id' => $user_id ) );
     40                $user_id = self::$factory->user->create( array( 'role' => 'administrator' ) );
     41                $blog_id2 = self::$factory->blog->create( array( 'user_id' => $user_id ) );
    4242                $info = wp_upload_dir();
    4343                $this->assertEquals( 'http://' . $site->domain . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] );
     
    6868                $file1 = wp_upload_bits( $filename, null, $contents );
    6969
    70                 $blog_id = $this->factory->blog->create();
     70                $blog_id = self::$factory->blog->create();
    7171
    7272                switch_to_blog( $blog_id );
  • trunk/tests/phpunit/tests/multisite/network.php

    r34172 r35225  
    3838         */
    3939        function test_get_main_network_id_two_networks() {
    40                 $this->factory->network->create();
     40                self::$factory->network->create();
    4141
    4242                $this->assertEquals( 1, get_main_network_id() );
     
    5050                global $current_site;
    5151
    52                 $id = $this->factory->network->create();
     52                $id = self::$factory->network->create();
    5353
    5454                $current_site->id = (int) $id;
     
    6666        function test_get_main_network_id_after_network_delete() {
    6767                global $wpdb, $current_site;
    68                 $id = $this->factory->network->create();
     68                $id = self::$factory->network->create();
    6969
    7070                $current_site->id = (int) $id;
     
    9191                // false for large networks by default
    9292                add_filter( 'enable_live_network_counts', '__return_false' );
    93                 $this->factory->blog->create_many( 4 );
     93                self::$factory->blog->create_many( 4 );
    9494
    9595                // count only updated when cron runs, so unchanged
     
    9797
    9898                add_filter( 'enable_live_network_counts', '__return_true' );
    99                 $site_ids = $this->factory->blog->create_many( 4 );
     99                $site_ids = self::$factory->blog->create_many( 4 );
    100100
    101101                $this->assertEquals( $site_count_start + 9, (int) get_blog_count() );
     
    212212                // Only false for large networks as of 3.7
    213213                add_filter( 'enable_live_network_counts', '__return_false' );
    214                 $this->factory->user->create( array( 'role' => 'administrator' ) );
     214                self::$factory->user->create( array( 'role' => 'administrator' ) );
    215215
    216216                $count = get_user_count(); // No change, cache not refreshed
     
    241241                $this->assertEquals( 1, $dashboard_blog->blog_id );
    242242
    243                 $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
    244                 $blog_id = $this->factory->blog->create( array( 'user_id' => $user_id ) );
     243                $user_id = self::$factory->user->create( array( 'role' => 'administrator' ) );
     244                $blog_id = self::$factory->blog->create( array( 'user_id' => $user_id ) );
    245245                $this->assertInternalType( 'int', $blog_id );
    246246
  • trunk/tests/phpunit/tests/multisite/site.php

    r34916 r35225  
    3535                $this->assertEquals( $current_blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
    3636
    37                 $blog_id = $this->factory->blog->create();
     37                $blog_id = self::$factory->blog->create();
    3838
    3939                $cap_key = wp_get_current_user()->cap_key;
     
    7575                global $wpdb;
    7676
    77                 $blog_id = $this->factory->blog->create();
     77                $blog_id = self::$factory->blog->create();
    7878
    7979                $this->assertInternalType( 'int', $blog_id );
     
    131131         */
    132132        function test_data_in_cache_after_wpmu_delete_blog_drop_false() {
    133                 $blog_id = $this->factory->blog->create();
     133                $blog_id = self::$factory->blog->create();
    134134
    135135                $details = get_blog_details( $blog_id, false );
     
    152152                global $wpdb;
    153153
    154                 $blog_id = $this->factory->blog->create();
     154                $blog_id = self::$factory->blog->create();
    155155
    156156                // Delete the site without forcing a table drop.
     
    170170         */
    171171        function test_data_in_cache_after_wpmu_delete_blog_drop_true() {
    172                 $blog_id = $this->factory->blog->create();
     172                $blog_id = self::$factory->blog->create();
    173173
    174174                $details = get_blog_details( $blog_id, false );
     
    191191                global $wpdb;
    192192
    193                 $blog_id = $this->factory->blog->create();
     193                $blog_id = self::$factory->blog->create();
    194194
    195195                // Delete the site and force a table drop.
     
    248248         */
    249249        function test_network_count_after_wpmu_delete_blog_drop_false() {
    250                 $blog_id = $this->factory->blog->create();
     250                $blog_id = self::$factory->blog->create();
    251251
    252252                // Delete the site without forcing a table drop.
     
    262262         */
    263263        function test_blog_count_after_wpmu_delete_blog_drop_true() {
    264                 $blog_id = $this->factory->blog->create();
     264                $blog_id = self::$factory->blog->create();
    265265
    266266                // Delete the site and force a table drop.
     
    284284                $file1 = wp_upload_bits( $filename, null, $contents );
    285285
    286                 $blog_id = $this->factory->blog->create();
     286                $blog_id = self::$factory->blog->create();
    287287
    288288                switch_to_blog( $blog_id );
     
    330330        function test_get_blog_details_when_site_does_not_exist() {
    331331                // Create an unused site so that we can then assume an invalid site ID.
    332                 $blog_id = $this->factory->blog->create();
     332                $blog_id = self::$factory->blog->create();
    333333                $blog_id++;
    334334
     
    340340
    341341                // Create a site in the invalid site's place.
    342                 $this->factory->blog->create();
     342                self::$factory->blog->create();
    343343
    344344                // When a new site is created, its cache is cleared through refresh_blog_details.
     
    371371                $test_action_counter = 0;
    372372
    373                 $blog_id = $this->factory->blog->create();
     373                $blog_id = self::$factory->blog->create();
    374374                update_blog_details( $blog_id, array( 'spam' => 1 ) );
    375375
     
    395395                $test_action_counter = 0;
    396396
    397                 $blog_id = $this->factory->blog->create();
     397                $blog_id = self::$factory->blog->create();
    398398
    399399                add_action( 'make_spam_blog', array( $this, '_action_counter_cb' ), 10 );
     
    418418                $test_action_counter = 0;
    419419
    420                 $blog_id = $this->factory->blog->create();
     420                $blog_id = self::$factory->blog->create();
    421421
    422422                add_action( 'archive_blog', array( $this, '_action_counter_cb' ), 10 );
     
    441441                $test_action_counter = 0;
    442442
    443                 $blog_id = $this->factory->blog->create();
     443                $blog_id = self::$factory->blog->create();
    444444                update_blog_details( $blog_id, array( 'archived' => 1 ) );
    445445
     
    464464                $test_action_counter = 0;
    465465
    466                 $blog_id = $this->factory->blog->create();
     466                $blog_id = self::$factory->blog->create();
    467467
    468468                add_action( 'make_delete_blog', array( $this, '_action_counter_cb' ), 10 );
     
    487487                $test_action_counter = 0;
    488488
    489                 $blog_id = $this->factory->blog->create();
     489                $blog_id = self::$factory->blog->create();
    490490                update_blog_details( $blog_id, array( 'deleted' => 1 ) );
    491491
     
    511511                $test_action_counter = 0;
    512512
    513                 $blog_id = $this->factory->blog->create();
     513                $blog_id = self::$factory->blog->create();
    514514
    515515                add_action( 'mature_blog', array( $this, '_action_counter_cb' ), 10 );
     
    534534                $test_action_counter = 0;
    535535
    536                 $blog_id = $this->factory->blog->create();
     536                $blog_id = self::$factory->blog->create();
    537537                update_blog_details( $blog_id, array( 'mature' => 1 ) );
    538538
     
    558558                $test_action_counter = 0;
    559559
    560                 $blog_id = $this->factory->blog->create();
     560                $blog_id = self::$factory->blog->create();
    561561
    562562                add_action( 'update_blog_public', array( $this, '_action_counter_cb' ), 10 );
     
    584584         */
    585585        function test_wp_get_sites_with_default_arguments() {
    586                 $this->factory->blog->create( array( 'site_id' => 2 ) );
     586                self::$factory->blog->create( array( 'site_id' => 2 ) );
    587587
    588588                $this->assertCount( 1, wp_get_sites() );
     
    600600         */
    601601        function test_wp_get_sites_with_network_id_null() {
    602                 $this->factory->blog->create( array( 'site_id' => 2 ) );
     602                self::$factory->blog->create( array( 'site_id' => 2 ) );
    603603
    604604                $this->assertCount( 2, wp_get_sites( array( 'network_id' => null ) ) );
     
    609609         */
    610610        function test_wp_get_sites_with_specific_network_id() {
    611                 $this->factory->blog->create( array( 'site_id' => 2 ) );
     611                self::$factory->blog->create( array( 'site_id' => 2 ) );
    612612
    613613                $this->assertCount( 1, wp_get_sites( array( 'network_id' => 2 ) ) );
     
    618618         */
    619619        function test_wp_get_sites_with_multiple_network_ids() {
    620                 $this->factory->blog->create( array( 'site_id' => 2 ) );
     620                self::$factory->blog->create( array( 'site_id' => 2 ) );
    621621
    622622                $this->assertCount( 2, wp_get_sites( array( 'network_id' => array( 1, 2 ) ) ) );
     
    627627         */
    628628        function test_wp_get_sites_with_public_meta_on_all_networks() {
    629                 $this->factory->blog->create( array( 'site_id' => 2, 'meta' => array( 'public' => 0 ) ) );
     629                self::$factory->blog->create( array( 'site_id' => 2, 'meta' => array( 'public' => 0 ) ) );
    630630
    631631                $this->assertCount( 1, wp_get_sites( array( 'public' => 1, 'network_id' => null ) ) );
     
    637637         */
    638638        function test_wp_get_sites_with_public_meta_restrict_to_one_network() {
    639                 $this->factory->blog->create( array( 'site_id' => 1, 'meta' => array( 'public' => 0 ) ) );
     639                self::$factory->blog->create( array( 'site_id' => 1, 'meta' => array( 'public' => 0 ) ) );
    640640
    641641                $this->assertCount( 1, wp_get_sites( array( 'public' => 1, 'network_id' => 1 ) ) );
     
    648648        function test_wp_get_sites_limit_offset() {
    649649                // Create 2 more sites (in addition to the default one)
    650                 $this->factory->blog->create_many( 2 );
     650                self::$factory->blog->create_many( 2 );
    651651
    652652                // Expect first 2 sites when using limit
     
    671671         */
    672672        function test_posts_count() {
    673                 $this->factory->post->create();
    674                 $post2 = $this->factory->post->create();
     673                self::$factory->post->create();
     674                $post2 = self::$factory->post->create();
    675675                $this->assertEquals( 2, get_blog_details()->post_count );
    676676
     
    702702
    703703                foreach ( $network_ids as &$id ) {
    704                         $id = $this->factory->network->create( $id );
     704                        $id = self::$factory->network->create( $id );
    705705                }
    706706                unset( $id );
     
    715715
    716716                foreach ( $ids as &$id ) {
    717                         $id = $this->factory->blog->create( $id );
     717                        $id = self::$factory->blog->create( $id );
    718718                }
    719719                unset( $id );
     
    773773         */
    774774        function test_get_blog_id_from_url() {
    775                 $blog_id = $this->factory->blog->create();
     775                $blog_id = self::$factory->blog->create();
    776776                $details = get_blog_details( $blog_id, false );
    777777                $key = md5( $details->domain . $details->path );
     
    786786         */
    787787        function test_get_blog_id_from_url_is_case_insensitive() {
    788                 $blog_id = $this->factory->blog->create( array( 'domain' => 'example.com', 'path' => '/xyz' ) );
     788                $blog_id = self::$factory->blog->create( array( 'domain' => 'example.com', 'path' => '/xyz' ) );
    789789                $details = get_blog_details( $blog_id, false );
    790790
     
    796796         */
    797797        function test_get_blog_id_from_url_that_does_not_exist() {
    798                 $blog_id = $this->factory->blog->create( array( 'path' => '/xyz' ) );
     798                $blog_id = self::$factory->blog->create( array( 'path' => '/xyz' ) );
    799799                $details = get_blog_details( $blog_id, false );
    800800
     
    808808         */
    809809        function test_get_blog_id_from_url_with_deleted_flag() {
    810                 $blog_id = $this->factory->blog->create();
     810                $blog_id = self::$factory->blog->create();
    811811                $details = get_blog_details( $blog_id, false );
    812812                $key = md5( $details->domain . $details->path );
     
    822822         */
    823823        function test_get_blog_id_from_url_after_dropped() {
    824                 $blog_id = $this->factory->blog->create();
     824                $blog_id = self::$factory->blog->create();
    825825                $details = get_blog_details( $blog_id, false );
    826826                $key = md5( $details->domain . $details->path );
     
    851851         */
    852852        function test_is_main_site_is_false_with_other_blog_id() {
    853                 $blog_id = $this->factory->blog->create();
     853                $blog_id = self::$factory->blog->create();
    854854
    855855                $this->assertFalse( is_main_site( $blog_id ) );
     
    860860         */
    861861        function test_is_main_site_is_false_after_switch_to_blog() {
    862                 $blog_id = $this->factory->blog->create();
     862                $blog_id = self::$factory->blog->create();
    863863                switch_to_blog( $blog_id );
    864864
     
    879879                $this->assertEquals( '', $info['error'] );
    880880
    881                 $blog_id = $this->factory->blog->create();
     881                $blog_id = self::$factory->blog->create();
    882882
    883883                switch_to_blog( $blog_id );
     
    901901         */
    902902        function test_get_blog_post_from_another_site_on_network() {
    903                 $blog_id = $this->factory->blog->create();
    904                 $post_id = $this->factory->post->create(); // Create a post on the primary site, ID 1.
     903                $blog_id = self::$factory->blog->create();
     904                $post_id = self::$factory->post->create(); // Create a post on the primary site, ID 1.
    905905                $post = get_post( $post_id );
    906906                switch_to_blog( $blog_id );
     
    916916         */
    917917        function test_get_blog_post_from_same_site() {
    918                 $post_id = $this->factory->post->create();
     918                $post_id = self::$factory->post->create();
    919919
    920920                $this->assertEquals( get_blog_post( 1, $post_id ), get_post( $post_id ) );
  • trunk/tests/phpunit/tests/multisite/updateBlogDetails.php

    r33255 r35225  
    2626
    2727        function test_update_blog_details() {
    28                 $blog_id = $this->factory->blog->create();
     28                $blog_id = self::$factory->blog->create();
    2929
    3030                $result = update_blog_details( $blog_id, array( 'domain' => 'example.com', 'path' => 'my_path/' ) );
     
    5454                $test_action_counter = 0;
    5555
    56                 $blog_id = $this->factory->blog->create();
     56                $blog_id = self::$factory->blog->create();
    5757
    5858                // Set an initial value of '1' for the flag when '0' is the flag value being tested.
  • trunk/tests/phpunit/tests/multisite/wpmuValidateUserSignup.php

    r33083 r35225  
    6464
    6565        public function test_should_fail_for_existing_user_name() {
    66                 $u = $this->factory->user->create( array( 'user_login' => 'foo123' ) );
     66                $u = self::$factory->user->create( array( 'user_login' => 'foo123' ) );
    6767                $v = wpmu_validate_user_signup( 'foo123', 'foo@example.com' );
    6868                $this->assertContains( 'user_name', $v['errors']->get_error_codes() );
     
    7070
    7171        public function test_should_fail_for_existing_user_email() {
    72                 $u = $this->factory->user->create( array( 'user_email' => 'foo@example.com' ) );
     72                $u = self::$factory->user->create( array( 'user_email' => 'foo@example.com' ) );
    7373                $v = wpmu_validate_user_signup( 'foo123', 'foo@example.com' );
    7474                $this->assertContains( 'user_email', $v['errors']->get_error_codes() );
  • trunk/tests/phpunit/tests/oembed/controller.php

    r34915 r35225  
    1818
    1919        function test_request_json() {
    20                 $user = $this->factory->user->create_and_get( array(
    21                         'display_name' => 'John Doe',
    22                 ) );
    23                 $post = $this->factory->post->create_and_get( array(
     20                $user = self::$factory->user->create_and_get( array(
     21                        'display_name' => 'John Doe',
     22                ) );
     23                $post = self::$factory->post->create_and_get( array(
    2424                        'post_author' => $user->ID,
    2525                        'post_title'  => 'Hello World',
     
    6161
    6262        function test_request_jsonp() {
    63                 $user = $this->factory->user->create_and_get( array(
    64                         'display_name' => 'John Doe',
    65                 ) );
    66                 $post = $this->factory->post->create_and_get( array(
     63                $user = self::$factory->user->create_and_get( array(
     64                        'display_name' => 'John Doe',
     65                ) );
     66                $post = self::$factory->post->create_and_get( array(
    6767                        'post_author' => $user->ID,
    6868                        'post_title'  => 'Hello World',
     
    8484
    8585        function test_request_jsonp_invalid_callback() {
    86                 $user = $this->factory->user->create_and_get( array(
    87                         'display_name' => 'John Doe',
    88                 ) );
    89                 $post = $this->factory->post->create_and_get( array(
     86                $user = self::$factory->user->create_and_get( array(
     87                        'display_name' => 'John Doe',
     88                ) );
     89                $post = self::$factory->post->create_and_get( array(
    9090                        'post_author' => $user->ID,
    9191                        'post_title'  => 'Hello World',
     
    119119
    120120        function test_request_xml() {
    121                 $user = $this->factory->user->create_and_get( array(
    122                         'display_name' => 'John Doe',
    123                 ) );
    124                 $post = $this->factory->post->create_and_get( array(
     121                $user = self::$factory->user->create_and_get( array(
     122                        'display_name' => 'John Doe',
     123                ) );
     124                $post = self::$factory->post->create_and_get( array(
    125125                        'post_author' => $user->ID,
    126126                        'post_title'  => 'Hello World',
     
    178178                }
    179179
    180                 $child = $this->factory->blog->create();
     180                $child = self::$factory->blog->create();
    181181
    182182                switch_to_blog( $child );
    183183
    184                 $post = $this->factory->post->create_and_get( array(
     184                $post = self::$factory->post->create_and_get( array(
    185185                        'post_title' => 'Hello Child Blog',
    186186                ) );
     
    208208                $this->assertEquals( home_url() . '/?oembed=true', get_oembed_endpoint_url( '', 'xml' ) );
    209209
    210                 $post_id     = $this->factory->post->create();
     210                $post_id     = self::$factory->post->create();
    211211                $url         = get_permalink( $post_id );
    212212                $url_encoded = urlencode( $url );
  • trunk/tests/phpunit/tests/oembed/discovery.php

    r34903 r35225  
    1313
    1414        function test_add_oembed_discovery_links_to_post() {
    15                 $post_id = $this->factory->post->create();
     15                $post_id = self::$factory->post->create();
    1616                $this->go_to( get_permalink( $post_id ) );
    1717
     
    2929
    3030        function test_add_oembed_discovery_links_to_page() {
    31                 $post_id = $this->factory->post->create( array(
     31                $post_id = self::$factory->post->create( array(
    3232                        'post_type' => 'page'
    3333                ));
     
    4747
    4848        function test_add_oembed_discovery_links_to_attachment() {
    49                 $post_id       = $this->factory->post->create();
     49                $post_id       = self::$factory->post->create();
    5050                $file          = DIR_TESTDATA . '/images/canola.jpg';
    51                 $attachment_id = $this->factory->attachment->create_object( $file, $post_id, array(
     51                $attachment_id = self::$factory->attachment->create_object( $file, $post_id, array(
    5252                        'post_mime_type' => 'image/jpeg',
    5353                ) );
  • trunk/tests/phpunit/tests/oembed/getResponseData.php

    r34903 r35225  
    1010
    1111        function test_get_oembed_response_data() {
    12                 $post = $this->factory->post->create_and_get( array(
     12                $post = self::$factory->post->create_and_get( array(
    1313                        'post_title' => 'Some Post',
    1414                ) );
     
    3434         */
    3535        function test_get_oembed_response_data_author() {
    36                 $user_id = $this->factory->user->create( array(
     36                $user_id = self::$factory->user->create( array(
    3737                        'display_name' => 'John Doe',
    3838                ) );
    3939
    40                 $post = $this->factory->post->create_and_get( array(
     40                $post = self::$factory->post->create_and_get( array(
    4141                        'post_title'  => 'Some Post',
    4242                        'post_author' => $user_id,
     
    6262                remove_filter( 'oembed_response_data', 'get_oembed_response_data_rich' );
    6363
    64                 $post = $this->factory->post->create_and_get( array(
     64                $post = self::$factory->post->create_and_get( array(
    6565                        'post_title' => 'Some Post',
    6666                ) );
     
    8282
    8383        function test_get_oembed_response_data_with_draft_post() {
    84                 $post = $this->factory->post->create_and_get( array(
     84                $post = self::$factory->post->create_and_get( array(
    8585                        'post_status' => 'draft',
    8686                ) );
     
    9090
    9191        function test_get_oembed_response_data_with_scheduled_post() {
    92                 $post = $this->factory->post->create_and_get( array(
     92                $post = self::$factory->post->create_and_get( array(
    9393                        'post_status' => 'future',
    9494                        'post_date'   => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' ) ),
     
    9999
    100100        function test_get_oembed_response_data_with_private_post() {
    101                 $post = $this->factory->post->create_and_get( array(
     101                $post = self::$factory->post->create_and_get( array(
    102102                        'post_status' => 'private',
    103103                ) );
     
    107107
    108108        function test_get_oembed_response_data_maxwidth_too_high() {
    109                 $post = $this->factory->post->create_and_get();
     109                $post = self::$factory->post->create_and_get();
    110110
    111111                $data = get_oembed_response_data( $post, 1000 );
     
    116116
    117117        function test_get_oembed_response_data_maxwidth_too_low() {
    118                 $post = $this->factory->post->create_and_get();
     118                $post = self::$factory->post->create_and_get();
    119119
    120120                $data = get_oembed_response_data( $post, 100 );
     
    125125
    126126        function test_get_oembed_response_data_maxwidth_invalid() {
    127                 $post = $this->factory->post->create_and_get();
     127                $post = self::$factory->post->create_and_get();
    128128
    129129                $data = get_oembed_response_data( $post, '400;" DROP TABLES' );
     
    139139
    140140        function test_get_oembed_response_data_with_thumbnail() {
    141                 $post          = $this->factory->post->create_and_get();
     141                $post          = self::$factory->post->create_and_get();
    142142                $file          = DIR_TESTDATA . '/images/canola.jpg';
    143                 $attachment_id = $this->factory->attachment->create_object( $file, $post->ID, array(
     143                $attachment_id = self::$factory->attachment->create_object( $file, $post->ID, array(
    144144                        'post_mime_type' => 'image/jpeg',
    145145                ) );
     
    155155
    156156        function test_get_oembed_response_data_for_attachment() {
    157                 $parent = $this->factory->post->create();
     157                $parent = self::$factory->post->create();
    158158                $file   = DIR_TESTDATA . '/images/canola.jpg';
    159                 $post   = $this->factory->attachment->create_object( $file, $parent, array(
     159                $post   = self::$factory->attachment->create_object( $file, $parent, array(
    160160                        'post_mime_type' => 'image/jpeg',
    161161                ) );
  • trunk/tests/phpunit/tests/oembed/headers.php

    r34903 r35225  
    1313                }
    1414
    15                 $post = $this->factory->post->create_and_get( array(
     15                $post = self::$factory->post->create_and_get( array(
    1616                        'post_title'  => 'Hello World',
    1717                ) );
     
    4747                }
    4848
    49                 $post = $this->factory->post->create_and_get( array(
     49                $post = self::$factory->post->create_and_get( array(
    5050                        'post_title'  => 'Hello World',
    5151                ) );
  • trunk/tests/phpunit/tests/oembed/postEmbedUrl.php

    r34903 r35225  
    1313                update_option( 'permalink_structure', '/%postname%' );
    1414
    15                 $post_id   = $this->factory->post->create();
     15                $post_id   = self::$factory->post->create();
    1616                $permalink = get_permalink( $post_id );
    1717                $embed_url = get_post_embed_url( $post_id );
     
    2323
    2424        function test_get_post_embed_url_with_ugly_permalinks() {
    25                 $post_id   = $this->factory->post->create();
     25                $post_id   = self::$factory->post->create();
    2626                $permalink = get_permalink( $post_id );
    2727                $embed_url = get_post_embed_url( $post_id );
  • trunk/tests/phpunit/tests/oembed/template.php

    r34903 r35225  
    66class Tests_Embed_Template extends WP_UnitTestCase {
    77        function test_oembed_output_post() {
    8                 $user = $this->factory->user->create_and_get( array(
     8                $user = self::$factory->user->create_and_get( array(
    99                        'display_name' => 'John Doe',
    1010                ) );
    1111
    12                 $post_id = $this->factory->post->create( array(
     12                $post_id = self::$factory->post->create( array(
    1313                        'post_author'  => $user->ID,
    1414                        'post_title'   => 'Hello World',
     
    3131
    3232        function test_oembed_output_post_with_thumbnail() {
    33                 $post_id       = $this->factory->post->create( array(
     33                $post_id       = self::$factory->post->create( array(
    3434                        'post_title'   => 'Hello World',
    3535                        'post_content' => 'Foo Bar',
     
    3737                ) );
    3838                $file          = DIR_TESTDATA . '/images/canola.jpg';
    39                 $attachment_id = $this->factory->attachment->create_object( $file, $post_id, array(
     39                $attachment_id = self::$factory->attachment->create_object( $file, $post_id, array(
    4040                        'post_mime_type' => 'image/jpeg',
    4141                ) );
     
    7373
    7474        function test_oembed_output_attachment() {
    75                 $post          = $this->factory->post->create_and_get();
     75                $post          = self::$factory->post->create_and_get();
    7676                $file          = DIR_TESTDATA . '/images/canola.jpg';
    77                 $attachment_id = $this->factory->attachment->create_object( $file, $post->ID, array(
     77                $attachment_id = self::$factory->attachment->create_object( $file, $post->ID, array(
    7878                        'post_mime_type' => 'image/jpeg',
    7979                        'post_title'     => 'Hello World',
     
    9898
    9999        function test_oembed_output_draft_post() {
    100                 $post_id = $this->factory->post->create( array(
     100                $post_id = self::$factory->post->create( array(
    101101                        'post_title'   => 'Hello World',
    102102                        'post_content' => 'Foo Bar',
     
    119119
    120120        function test_oembed_output_scheduled_post() {
    121                 $post_id = $this->factory->post->create( array(
     121                $post_id = self::$factory->post->create( array(
    122122                        'post_title'   => 'Hello World',
    123123                        'post_content' => 'Foo Bar',
     
    141141
    142142        function test_oembed_output_private_post() {
    143                 $post_id = $this->factory->post->create( array(
     143                $post_id = self::$factory->post->create( array(
    144144                        'post_title'   => 'Hello World',
    145145                        'post_content' => 'Foo Bar',
     
    162162
    163163        function test_oembed_output_private_post_with_permissions() {
    164                 $user_id = $this->factory->user->create( array( 'role' => 'editor' ) );
     164                $user_id = self::$factory->user->create( array( 'role' => 'editor' ) );
    165165                wp_set_current_user( $user_id );
    166166
    167                 $post_id = $this->factory->post->create( array(
     167                $post_id = self::$factory->post->create( array(
    168168                        'post_title'   => 'Hello World',
    169169                        'post_content' => 'Foo Bar',
     
    194194
    195195        function test_wp_oembed_excerpt_more() {
    196                 $post_id = $this->factory->post->create( array(
     196                $post_id = self::$factory->post->create( array(
    197197                        'post_content' => 'Foo Bar',
    198198                ) );
     
    215215                $this->assertFalse( is_embed() );
    216216
    217                 $post_id = $this->factory->post->create();
     217                $post_id = self::$factory->post->create();
    218218                $this->go_to( get_post_embed_url( $post_id ) );
    219219                $this->assertTrue( is_embed() );
     
    221221
    222222        function test_is_embed_attachment() {
    223                 $post_id       = $this->factory->post->create();
     223                $post_id       = self::$factory->post->create();
    224224                $file          = DIR_TESTDATA . '/images/canola.jpg';
    225                 $attachment_id = $this->factory->attachment->create_object( $file, $post_id, array(
     225                $attachment_id = self::$factory->attachment->create_object( $file, $post_id, array(
    226226                        'post_mime_type' => 'image/jpeg',
    227227                ) );
     
    241241
    242242        function test_get_post_embed_html() {
    243                 $post_id = $this->factory->post->create();
     243                $post_id = self::$factory->post->create();
    244244
    245245                $expected = '<iframe sandbox="allow-scripts" security="restricted" src="' . esc_url( get_post_embed_url( $post_id ) ) . '" width="200" height="200" title="Embedded WordPress Post" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" class="wp-embedded-content"></iframe>';
  • trunk/tests/phpunit/tests/option/multisite.php

    r34172 r35225  
    9999
    100100        function test_with_another_site() {
    101                 $user_id = $this->factory->user->create();
     101                $user_id = self::$factory->user->create();
    102102                $this->assertInternalType( 'integer', $user_id );
    103103
    104                 $blog_id = $this->factory->blog->create( array(
     104                $blog_id = self::$factory->blog->create( array(
    105105                        'user_id' => $user_id,
    106106                        'meta'    => array(
  • trunk/tests/phpunit/tests/option/networkOption.php

    r35025 r35225  
    1212class Tests_Option_NetworkOption extends WP_UnitTestCase {
    1313        function test_add_network_option_not_available_on_other_network() {
    14                 $id = $this->factory->network->create();
     14                $id = self::$factory->network->create();
    1515                $option = rand_str();
    1616                $value = rand_str();
     
    2121
    2222        function test_add_network_option_available_on_same_network() {
    23                 $id = $this->factory->network->create();
     23                $id = self::$factory->network->create();
    2424                $option = rand_str();
    2525                $value = rand_str();
     
    3030
    3131        function test_delete_network_option_on_only_one_network() {
    32                 $id = $this->factory->network->create();
     32                $id = self::$factory->network->create();
    3333                $option = rand_str();
    3434                $value = rand_str();
  • trunk/tests/phpunit/tests/option/userSettings.php

    r33947 r35225  
    66                parent::setUp();
    77
    8                 $this->user_id = $this->factory->user->create( array(
     8                $this->user_id = self::$factory->user->create( array(
    99                        'role' => 'administrator'
    1010                ) );
  • trunk/tests/phpunit/tests/post.php

    r35224 r35225  
    546546                global $wpdb;
    547547
    548                 $attachment = $this->factory->post->create_and_get( array( 'post_title' => 'some-page', 'post_type' => 'attachment' ) );
    549                 $page       = $this->factory->post->create_and_get( array( 'post_title' => 'some-page', 'post_type' => 'page' ) );
    550                 $other_att  = $this->factory->post->create_and_get( array( 'post_title' => 'some-other-page', 'post_type' => 'attachment' ) );
     548                $attachment = self::$factory->post->create_and_get( array( 'post_title' => 'some-page', 'post_type' => 'attachment' ) );
     549                $page       = self::$factory->post->create_and_get( array( 'post_title' => 'some-page', 'post_type' => 'page' ) );
     550                $other_att  = self::$factory->post->create_and_get( array( 'post_title' => 'some-other-page', 'post_type' => 'attachment' ) );
    551551
    552552                $wpdb->update( $wpdb->posts, array( 'post_name' => 'some-page' ), array( 'ID' => $page->ID ) );
     
    566566
    567567        function test_wp_publish_post() {
    568                 $draft_id = $this->factory->post->create( array( 'post_status' => 'draft' ) );
     568                $draft_id = self::$factory->post->create( array( 'post_status' => 'draft' ) );
    569569
    570570                $post = get_post( $draft_id );
     
    582582        function test_wp_insert_post_and_wp_publish_post_with_future_date() {
    583583                $future_date = gmdate( 'Y-m-d H:i:s', time() + 10000000 );
    584                 $post_id = $this->factory->post->create( array(
     584                $post_id = self::$factory->post->create( array(
    585585                        'post_status' => 'publish',
    586586                        'post_date' => $future_date,
     
    642642         */
    643643        function test_get_page_uri_with_stdclass_post_object() {
    644                 $post_id    = $this->factory->post->create( array( 'post_name' => 'get-page-uri-post-name' ) );
     644                $post_id    = self::$factory->post->create( array( 'post_name' => 'get-page-uri-post-name' ) );
    645645
    646646                // Mimick an old stdClass post object, missing the ancestors field.
     
    665665         */
    666666        function test_get_post_uri_check_orphan() {
    667                 $parent_id = $this->factory->post->create( array( 'post_name' => 'parent' ) );
    668                 $child_id = $this->factory->post->create( array( 'post_name' => 'child', 'post_parent' => $parent_id ) );
     667                $parent_id = self::$factory->post->create( array( 'post_name' => 'parent' ) );
     668                $child_id = self::$factory->post->create( array( 'post_name' => 'child', 'post_parent' => $parent_id ) );
    669669
    670670                // check the parent for good measure
     
    684684        function test_get_post_ancestors_within_loop() {
    685685                global $post;
    686                 $parent_id = $this->factory->post->create();
    687                 $post = $this->factory->post->create_and_get( array( 'post_parent' => $parent_id ) );
     686                $parent_id = self::$factory->post->create();
     687                $post = self::$factory->post->create_and_get( array( 'post_parent' => $parent_id ) );
    688688                $this->assertEquals( array( $parent_id ), get_post_ancestors( 0 ) );
    689689        }
     
    693693         */
    694694        function test_update_invalid_post_id() {
    695                 $post_id = $this->factory->post->create( array( 'post_name' => 'get-page-uri-post-name' ) );
     695                $post_id = self::$factory->post->create( array( 'post_name' => 'get-page-uri-post-name' ) );
    696696                $post = get_post( $post_id, ARRAY_A );
    697697
     
    708708        function test_parse_post_content_single_page() {
    709709                global $multipage, $pages, $numpages;
    710                 $post_id = $this->factory->post->create( array( 'post_content' => 'Page 0' ) );
     710                $post_id = self::$factory->post->create( array( 'post_content' => 'Page 0' ) );
    711711                $post = get_post( $post_id );
    712712                setup_postdata( $post );
     
    719719        function test_parse_post_content_multi_page() {
    720720                global $multipage, $pages, $numpages;
    721                 $post_id = $this->factory->post->create( array( 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) );
     721                $post_id = self::$factory->post->create( array( 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) );
    722722                $post = get_post( $post_id );
    723723                setup_postdata( $post );
     
    730730        function test_parse_post_content_remaining_single_page() {
    731731                global $multipage, $pages, $numpages;
    732                 $post_id = $this->factory->post->create( array( 'post_content' => 'Page 0' ) );
     732                $post_id = self::$factory->post->create( array( 'post_content' => 'Page 0' ) );
    733733                $post = get_post( $post_id );
    734734                setup_postdata( $post );
     
    741741        function test_parse_post_content_remaining_multi_page() {
    742742                global $multipage, $pages, $numpages;
    743                 $post_id = $this->factory->post->create( array( 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) );
     743                $post_id = self::$factory->post->create( array( 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) );
    744744                $post = get_post( $post_id );
    745745                setup_postdata( $post );
     
    755755        function test_parse_post_content_starting_with_nextpage() {
    756756                global $multipage, $pages, $numpages;
    757                 $post_id = $this->factory->post->create( array( 'post_content' => '<!--nextpage-->Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) );
     757                $post_id = self::$factory->post->create( array( 'post_content' => '<!--nextpage-->Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) );
    758758                $post = get_post( $post_id );
    759759                setup_postdata( $post );
     
    769769        function test_parse_post_content_starting_with_nextpage_multi() {
    770770                global $multipage, $pages, $numpages;
    771                 $post_id = $this->factory->post->create( array( 'post_content' => '<!--nextpage-->Page 0' ) );
     771                $post_id = self::$factory->post->create( array( 'post_content' => '<!--nextpage-->Page 0' ) );
    772772                $post = get_post( $post_id );
    773773                setup_postdata( $post );
     
    810810                $post_type = rand_str(20);
    811811                register_post_type( $post_type );
    812                 $this->factory->post->create( array(
     812                self::$factory->post->create( array(
    813813                        'post_type' => $post_type,
    814814                        'post_author' => self::$editor_id
     
    823823                $post_type = rand_str(20);
    824824                register_post_type( $post_type );
    825                 $this->factory->post->create_many( 3, array(
     825                self::$factory->post->create_many( 3, array(
    826826                        'post_type' => $post_type,
    827827                        'post_author' => self::$editor_id
     
    843843
    844844        function test_wp_count_posts_insert_invalidation() {
    845                 $post_ids = $this->factory->post->create_many( 3 );
     845                $post_ids = self::$factory->post->create_many( 3 );
    846846                $initial_counts = wp_count_posts();
    847847
     
    861861
    862862        function test_wp_count_posts_trash_invalidation() {
    863                 $post_ids = $this->factory->post->create_many( 3 );
     863                $post_ids = self::$factory->post->create_many( 3 );
    864864                $initial_counts = wp_count_posts();
    865865
     
    882882         */
    883883        function test_get_the_date_with_id_returns_correct_time() {
    884                 $post_id = $this->factory->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );
     884                $post_id = self::$factory->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );
    885885                $this->assertEquals( 'March 1, 2014', get_the_date( 'F j, Y', $post_id ) );
    886886        }
     
    900900         */
    901901        function test_get_the_time_with_id_returns_correct_time() {
    902                 $post_id = $this->factory->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );
     902                $post_id = self::$factory->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );
    903903                $this->assertEquals( '16:35:00', get_the_time( 'H:i:s', $post_id ) );
    904904        }
     
    918918         */
    919919        function test_get_post_time_with_id_returns_correct_time() {
    920                 $post_id = $this->factory->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );
     920                $post_id = self::$factory->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );
    921921                $this->assertEquals( '16:35:00', get_post_time( 'H:i:s', false, $post_id ) );
    922922        }
     
    936936         */
    937937        function test_get_post_modified_time_with_id_returns_correct_time() {
    938                 $post_id = $this->factory->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );
     938                $post_id = self::$factory->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );
    939939                $this->assertEquals( '16:35:00', get_post_modified_time( 'H:i:s', false, $post_id ) );
    940940        }
     
    974974                register_taxonomy( $tax, $post_type );
    975975
    976                 $post = $this->factory->post->create( array( 'post_type' => $post_type ) );
     976                $post = self::$factory->post->create( array( 'post_type' => $post_type ) );
    977977                wp_set_object_terms( $post, rand_str(), $tax );
    978978
     
    10161016                require_once( ABSPATH . '/wp-admin/includes/post.php' );
    10171017
    1018                 $post_id = $this->factory->post->create();
     1018                $post_id = self::$factory->post->create();
    10191019
    10201020                $data = array(
     
    10441044         */
    10451045        function test_wp_insert_post_default_comment_ping_status_open() {
    1046                 $post_id = $this->factory->post->create( array(
     1046                $post_id = self::$factory->post->create( array(
    10471047                        'post_author' => self::$editor_id,
    10481048                        'post_status' => 'public',
     
    10601060         */
    10611061        function test_wp_insert_post_page_default_comment_ping_status_closed() {
    1062                 $post_id = $this->factory->post->create( array(
     1062                $post_id = self::$factory->post->create( array(
    10631063                        'post_author' => self::$editor_id,
    10641064                        'post_status' => 'public',
     
    10791079                $post_type = rand_str(20);
    10801080                register_post_type( $post_type, array( 'supports' => array( 'comments', 'trackbacks' ) ) );
    1081                 $post_id = $this->factory->post->create( array(
     1081                $post_id = self::$factory->post->create( array(
    10821082                        'post_author' => self::$editor_id,
    10831083                        'post_status' => 'public',
     
    10991099                $post_type = rand_str(20);
    11001100                register_post_type( $post_type );
    1101                 $post_id = $this->factory->post->create( array(
     1101                $post_id = self::$factory->post->create( array(
    11021102                        'post_author' => self::$editor_id,
    11031103                        'post_status' => 'public',
     
    11281128
    11291129                // Create a sticky post.
    1130                 $post = $this->factory->post->create_and_get( array(
     1130                $post = self::$factory->post->create_and_get( array(
    11311131                        'post_title'   => 'Will be changed',
    11321132                        'post_content' => 'Will be changed',
     
    11571157        function test_user_without_publish_cannot_affect_sticky_with_edit_post() {
    11581158                // Create a sticky post.
    1159                 $post = $this->factory->post->create_and_get( array(
     1159                $post = self::$factory->post->create_and_get( array(
    11601160                        'post_title'   => 'Will be changed',
    11611161                        'post_content' => 'Will be changed',
     
    11921192         */
    11931193        public function test_wp_insert_post_author_zero() {
    1194                 $post_id = $this->factory->post->create( array( 'post_author' => 0 ) );
     1194                $post_id = self::$factory->post->create( array( 'post_author' => 0 ) );
    11951195
    11961196                $this->assertEquals( 0, get_post( $post_id )->post_author );
     
    12011201         */
    12021202        public function test_wp_insert_post_author_null() {
    1203                 $post_id = $this->factory->post->create( array( 'post_author' => null ) );
     1203                $post_id = self::$factory->post->create( array( 'post_author' => null ) );
    12041204
    12051205                $this->assertEquals( self::$editor_id, get_post( $post_id )->post_author );
  • trunk/tests/phpunit/tests/post/filtering.php

    r30291 r35225  
    3232EOF;
    3333
    34                 $id = $this->factory->post->create( array( 'post_content' => $content ) );
     34                $id = self::$factory->post->create( array( 'post_content' => $content ) );
    3535                $post = get_post($id);
    3636
     
    4949EOF;
    5050
    51                 $id = $this->factory->post->create( array( 'post_content' => $content ) );
     51                $id = self::$factory->post->create( array( 'post_content' => $content ) );
    5252                $post = get_post($id);
    5353
     
    6666EOF;
    6767
    68                 $id = $this->factory->post->create( array( 'post_content' => $content ) );
     68                $id = self::$factory->post->create( array( 'post_content' => $content ) );
    6969                $post = get_post($id);
    7070
     
    8585EOF;
    8686
    87                 $id = $this->factory->post->create( array( 'post_content' => $content ) );
     87                $id = self::$factory->post->create( array( 'post_content' => $content ) );
    8888                $post = get_post($id);
    8989
     
    105105EOF;
    106106
    107                 $id = $this->factory->post->create( array( 'post_content' => $content ) );
     107                $id = self::$factory->post->create( array( 'post_content' => $content ) );
    108108                $post = get_post($id);
    109109
  • trunk/tests/phpunit/tests/post/formats.php

    r25002 r35225  
    1010
    1111        function test_set_get_post_format_for_post() {
    12                 $post_id = $this->factory->post->create();
     12                $post_id = self::$factory->post->create();
    1313
    1414                $format = get_post_format( $post_id );
     
    3838         */
    3939        function test_set_get_post_format_for_page() {
    40                 $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
     40                $post_id = self::$factory->post->create( array( 'post_type' => 'page' ) );
    4141
    4242                $format = get_post_format( $post_id );
     
    7070
    7171        function test_has_format() {
    72                 $post_id = $this->factory->post->create();
     72                $post_id = self::$factory->post->create();
    7373
    7474                $this->assertFalse( has_post_format( 'standard', $post_id ) );
     
    112112$commentary
    113113DATA;
    114                 $link_post_id = $this->factory->post->create( array( 'post_content' => $link ) );
     114                $link_post_id = self::$factory->post->create( array( 'post_content' => $link ) );
    115115                $content_link = get_url_in_content( get_post_field( 'post_content', $link_post_id ) );
    116116                $this->assertEquals( false, $content_link );
    117117
    118                 $link_with_post_id = $this->factory->post->create( array( 'post_content' => $link_with_commentary ) );
     118                $link_with_post_id = self::$factory->post->create( array( 'post_content' => $link_with_commentary ) );
    119119                $content_link = get_url_in_content( get_post_field( 'post_content', $link_with_post_id ) );
    120120                $this->assertEquals( false, $content_link );
     
    126126                $this->assertEquals( false, $content_link );
    127127
    128                 $empty_post_id = $this->factory->post->create( array( 'post_content' => '' ) );
     128                $empty_post_id = self::$factory->post->create( array( 'post_content' => '' ) );
    129129                $content_link = get_url_in_content( get_post_field( 'post_content', $empty_post_id ) );
    130130                $this->assertEquals( false, $content_link );
    131131
    132                 $comm_post_id = $this->factory->post->create( array( 'post_content' => $commentary ) );
     132                $comm_post_id = self::$factory->post->create( array( 'post_content' => $commentary ) );
    133133                $content_link = get_url_in_content( get_post_field( 'post_content', $comm_post_id ) );
    134134                $this->assertEquals( false, $content_link );
    135135
    136136                // Now with an href
    137                 $href_post_id = $this->factory->post->create( array( 'post_content' => $href ) );
     137                $href_post_id = self::$factory->post->create( array( 'post_content' => $href ) );
    138138                $content_link = get_url_in_content( get_post_field( 'post_content', $href_post_id ) );
    139139                $this->assertEquals( $link, $content_link );
    140140
    141                 $href_with_post_id = $this->factory->post->create( array( 'post_content' => $href_with_commentary ) );
     141                $href_with_post_id = self::$factory->post->create( array( 'post_content' => $href_with_commentary ) );
    142142                $content_link = get_url_in_content( get_post_field( 'post_content', $href_with_post_id ) );
    143143                $this->assertEquals( $link, $content_link );
     
    149149                $this->assertEquals( $link, $content_link );
    150150
    151                 $empty_post_id = $this->factory->post->create( array( 'post_content' => '' ) );
     151                $empty_post_id = self::$factory->post->create( array( 'post_content' => '' ) );
    152152                $content_link = get_url_in_content( get_post_field( 'post_content', $empty_post_id ) );
    153153                $this->assertEquals( false, $content_link );
    154154
    155                 $comm_post_id = $this->factory->post->create( array( 'post_content' => $commentary ) );
     155                $comm_post_id = self::$factory->post->create( array( 'post_content' => $commentary ) );
    156156                $content_link = get_url_in_content( get_post_field( 'post_content', $comm_post_id ) );
    157157                $this->assertEquals( false, $content_link );
  • trunk/tests/phpunit/tests/post/getBodyClass.php

    r31979 r35225  
    1010        public function setUp() {
    1111                parent::setUp();
    12                 $this->post_id = $this->factory->post->create();
     12                $this->post_id = self::$factory->post->create();
    1313        }
    1414
     
    1717         */
    1818        public function test_with_utf8_category_slugs() {
    19                 $cat_id1 = $this->factory->category->create( array( 'name' => 'Первая рубрика' ) );
    20                 $cat_id2 = $this->factory->category->create( array( 'name' => 'Вторая рубрика' ) );
    21                 $cat_id3 = $this->factory->category->create( array( 'name' => '25кадр' ) );
     19                $cat_id1 = self::$factory->category->create( array( 'name' => 'Первая рубрика' ) );
     20                $cat_id2 = self::$factory->category->create( array( 'name' => 'Вторая рубрика' ) );
     21                $cat_id3 = self::$factory->category->create( array( 'name' => '25кадр' ) );
    2222                wp_set_post_terms( $this->post_id, array( $cat_id1, $cat_id2, $cat_id3 ), 'category' );
    2323
     
    3636         */
    3737        public function test_with_utf8_tag_slugs() {
    38                 $tag_id1 = $this->factory->tag->create( array( 'name' => 'Первая метка' ) );
    39                 $tag_id2 = $this->factory->tag->create( array( 'name' => 'Вторая метка' ) );
    40                 $tag_id3 = $this->factory->tag->create( array( 'name' => '25кадр' ) );
     38                $tag_id1 = self::$factory->tag->create( array( 'name' => 'Первая метка' ) );
     39                $tag_id2 = self::$factory->tag->create( array( 'name' => 'Вторая метка' ) );
     40                $tag_id3 = self::$factory->tag->create( array( 'name' => '25кадр' ) );
    4141                wp_set_post_terms( $this->post_id, array( $tag_id1, $tag_id2, $tag_id3 ), 'post_tag' );
    4242
     
    6060        public function test_with_utf8_term_slugs() {
    6161                register_taxonomy( 'wptests_tax', 'post' );
    62                 $term_id1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Первая метка' ) );
    63                 $term_id2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Вторая метка' ) );
    64                 $term_id3 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => '25кадр' ) );
     62                $term_id1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Первая метка' ) );
     63                $term_id2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Вторая метка' ) );
     64                $term_id3 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => '25кадр' ) );
    6565                wp_set_post_terms( $this->post_id, array( $term_id1, $term_id2, $term_id3 ), 'wptests_tax' );
    6666
  • trunk/tests/phpunit/tests/post/getPages.php

    r35162 r35225  
    1616                global $wpdb;
    1717
    18                 $this->factory->post->create_many( 3, array( 'post_type' => 'page' ) );
     18                self::$factory->post->create_many( 3, array( 'post_type' => 'page' ) );
    1919                wp_cache_delete( 'last_changed', 'posts' );
    2020                $this->assertFalse( wp_cache_get( 'last_changed', 'posts' ) );
     
    100100         */
    101101        function test_get_pages_meta() {
    102                 $posts = $this->factory->post->create_many( 3, array( 'post_type' => 'page' ) );
     102                $posts = self::$factory->post->create_many( 3, array( 'post_type' => 'page' ) );
    103103                add_post_meta( $posts[0], 'some-meta-key', '0' );
    104104                add_post_meta( $posts[1], 'some-meta-key', '' );
     
    117117
    118118                foreach ( range( 1, 20 ) as $i )
    119                         $page_ids[] = $this->factory->post->create( array( 'post_type' => 'page' ) );
     119                        $page_ids[] = self::$factory->post->create( array( 'post_type' => 'page' ) );
    120120
    121121                $inc = array_slice( $page_ids, 0, 10 );
     
    139139         */
    140140        function test_get_pages_parent() {
    141                 $page_id1 = $this->factory->post->create( array( 'post_type' => 'page' ) );
    142                 $page_id2 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id1 ) );
    143                 $page_id3 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id2 ) );
    144                 $page_id4 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id1 ) );
     141                $page_id1 = self::$factory->post->create( array( 'post_type' => 'page' ) );
     142                $page_id2 = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id1 ) );
     143                $page_id3 = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id2 ) );
     144                $page_id4 = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id1 ) );
    145145
    146146                $pages = get_pages( array( 'parent' => 0, 'hierarchical' => false ) );
     
    167167         */
    168168        function test_wp_dropdown_pages() {
    169                 $this->factory->post->create_many( 5, array( 'post_type' => 'page' ) );
     169                self::$factory->post->create_many( 5, array( 'post_type' => 'page' ) );
    170170
    171171                preg_match_all( '#<option#', wp_dropdown_pages( 'echo=0' ), $matches );
     
    178178         */
    179179        function test_get_chidren_fields_ids() {
    180                 $post_id = $this->factory->post->create();
    181                 $child_ids = $this->factory->post->create_many( 5, array( 'post_parent' => $post_id ) );
     180                $post_id = self::$factory->post->create();
     181                $child_ids = self::$factory->post->create_many( 5, array( 'post_parent' => $post_id ) );
    182182
    183183                $post_ids = get_children( array( 'fields' => 'ids', 'post_parent' => $post_id ) );
     
    190190        function test_get_pages_hierarchical_and_no_parent() {
    191191                global $wpdb;
    192                 $page_1 = $this->factory->post->create( array( 'post_type' => 'page' ) );
    193                 $page_2 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
    194                 $page_3 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
    195                 $page_4 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_2 ) );
     192                $page_1 = self::$factory->post->create( array( 'post_type' => 'page' ) );
     193                $page_2 = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
     194                $page_3 = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
     195                $page_4 = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_2 ) );
    196196
    197197                $pages = get_pages(); // Defaults: hierarchical = true, parent = -1
     
    219219         */
    220220        public function test_get_pages_hierarchical_empty_child_of() {
    221                 $page_1 = $this->factory->post->create( array( 'post_type' => 'page' ) );
    222                 $page_2 = $this->factory->post->create( array( 'post_type' => 'page' ) );
    223                 $page_3 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
    224                 $page_4 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
     221                $page_1 = self::$factory->post->create( array( 'post_type' => 'page' ) );
     222                $page_2 = self::$factory->post->create( array( 'post_type' => 'page' ) );
     223                $page_3 = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
     224                $page_4 = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
    225225
    226226                $pages = get_pages(); // Defaults: hierarchical = true, child_of = '', parent = -1
     
    253253         */
    254254        public function test_get_pages_non_hierarchical_empty_child_of() {
    255                 $page_1 = $this->factory->post->create( array( 'post_type' => 'page' ) );
    256                 $page_2 = $this->factory->post->create( array( 'post_type' => 'page' ) );
    257                 $page_3 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
    258                 $page_4 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
     255                $page_1 = self::$factory->post->create( array( 'post_type' => 'page' ) );
     256                $page_2 = self::$factory->post->create( array( 'post_type' => 'page' ) );
     257                $page_3 = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
     258                $page_4 = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
    259259
    260260                $pages = get_pages( array( 'hierarchical' => false ) ); // child_of = '', parent = -1
     
    279279         */
    280280        public function test_get_pages_hierarchical_non_empty_child_of() {
    281                 $page_1 = $this->factory->post->create( array( 'post_type' => 'page' ) );
    282                 $page_2 = $this->factory->post->create( array( 'post_type' => 'page' ) );
    283                 $page_3 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
    284                 $page_4 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_3 ) );
    285                 $page_5 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
     281                $page_1 = self::$factory->post->create( array( 'post_type' => 'page' ) );
     282                $page_2 = self::$factory->post->create( array( 'post_type' => 'page' ) );
     283                $page_3 = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
     284                $page_4 = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_3 ) );
     285                $page_5 = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
    286286
    287287                $pages = get_pages( array( 'child_of' => $page_1 ) ); // Defaults: hierarchical = true, parent = -1.
     
    307307         */
    308308        public function test_get_pages_non_hierarchical_non_empty_child_of() {
    309                 $page_1 = $this->factory->post->create( array( 'post_type' => 'page' ) );
    310                 $page_2 = $this->factory->post->create( array( 'post_type' => 'page' ) );
    311                 $page_3 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
    312                 $page_4 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_3 ) );
    313                 $page_5 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
     309                $page_1 = self::$factory->post->create( array( 'post_type' => 'page' ) );
     310                $page_2 = self::$factory->post->create( array( 'post_type' => 'page' ) );
     311                $page_3 = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
     312                $page_4 = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_3 ) );
     313                $page_5 = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );
    314314
    315315                $pages = get_pages( array( 'hierarchical' => false, 'child_of' => $page_1 ) );
     
    339339                register_post_type( $type, array( 'hierarchical' => true, 'public' => true ) );
    340340
    341                 $posts = $this->factory->post->create_many( 2, array( 'post_type' => $type ) );
     341                $posts = self::$factory->post->create_many( 2, array( 'post_type' => $type ) );
    342342                $post_id = reset( $posts );
    343343
     
    361361
    362362        function test_exclude_tree() {
    363                 $post_id1 = $this->factory->post->create( array( 'post_type' => 'page' ) );
    364                 $post_id2 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $post_id1 ) );
    365                 $post_id3 = $this->factory->post->create( array( 'post_type' => 'page' ) );
    366                 $post_id4 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $post_id3 ) );
     363                $post_id1 = self::$factory->post->create( array( 'post_type' => 'page' ) );
     364                $post_id2 = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $post_id1 ) );
     365                $post_id3 = self::$factory->post->create( array( 'post_type' => 'page' ) );
     366                $post_id4 = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $post_id3 ) );
    367367
    368368                $all = get_pages();
     
    385385                $this->assertCount( 0, $exclude5 );
    386386
    387                 $post_id5 = $this->factory->post->create( array( 'post_type' => 'page' ) );
    388                 $post_id6 = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $post_id5 ) );
     387                $post_id5 = self::$factory->post->create( array( 'post_type' => 'page' ) );
     388                $post_id6 = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $post_id5 ) );
    389389
    390390                $exclude6 = get_pages( array( 'exclude_tree' => array( $post_id1, $post_id3 ) ) );
  • trunk/tests/phpunit/tests/post/getPostClass.php

    r34828 r35225  
    1010        public function setUp() {
    1111                parent::setUp();
    12                 $this->post_id = $this->factory->post->create();
     12                $this->post_id = self::$factory->post->create();
    1313        }
    1414
     
    2323
    2424        public function test_with_categories() {
    25                 $cats = $this->factory->category->create_many( 2 );
     25                $cats = self::$factory->category->create_many( 2 );
    2626                wp_set_post_terms( $this->post_id, $cats, 'category' );
    2727
     
    5858         */
    5959        public function test_with_utf8_category_slugs() {
    60                 $cat_id1 = $this->factory->category->create( array( 'name' => 'Первая рубрика' ) );
    61                 $cat_id2 = $this->factory->category->create( array( 'name' => 'Вторая рубрика' ) );
    62                 $cat_id3 = $this->factory->category->create( array( 'name' => '25кадр' ) );
     60                $cat_id1 = self::$factory->category->create( array( 'name' => 'Первая рубрика' ) );
     61                $cat_id2 = self::$factory->category->create( array( 'name' => 'Вторая рубрика' ) );
     62                $cat_id3 = self::$factory->category->create( array( 'name' => '25кадр' ) );
    6363                wp_set_post_terms( $this->post_id, array( $cat_id1, $cat_id2, $cat_id3 ), 'category' );
    6464
     
    7474         */
    7575        public function test_with_utf8_tag_slugs() {
    76                 $tag_id1 = $this->factory->tag->create( array( 'name' => 'Первая метка' ) );
    77                 $tag_id2 = $this->factory->tag->create( array( 'name' => 'Вторая метка' ) );
    78                 $tag_id3 = $this->factory->tag->create( array( 'name' => '25кадр' ) );
     76                $tag_id1 = self::$factory->tag->create( array( 'name' => 'Первая метка' ) );
     77                $tag_id2 = self::$factory->tag->create( array( 'name' => 'Вторая метка' ) );
     78                $tag_id3 = self::$factory->tag->create( array( 'name' => '25кадр' ) );
    7979                wp_set_post_terms( $this->post_id, array( $tag_id1, $tag_id2, $tag_id3 ), 'post_tag' );
    8080
     
    9191        public function test_with_utf8_term_slugs() {
    9292                register_taxonomy( 'wptests_tax', 'post' );
    93                 $term_id1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Первая метка' ) );
    94                 $term_id2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Вторая метка' ) );
    95                 $term_id3 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => '25кадр' ) );
     93                $term_id1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Первая метка' ) );
     94                $term_id2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Вторая метка' ) );
     95                $term_id3 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => '25кадр' ) );
    9696                wp_set_post_terms( $this->post_id, array( $term_id1, $term_id2, $term_id3 ), 'wptests_tax' );
    9797
  • trunk/tests/phpunit/tests/post/getPostsByAuthorSql.php

    r32524 r35225  
    6060        public function test_public_only_true_should_not_allow_any_private_posts_for_loggedin_user(){
    6161                $current_user = get_current_user_id();
    62                 $u = $this->factory->user->create();
     62                $u = self::$factory->user->create();
    6363                wp_set_current_user( $u );
    6464
     
    7171        public function test_public_only_should_default_to_false(){
    7272                $current_user = get_current_user_id();
    73                 $u = $this->factory->user->create();
     73                $u = self::$factory->user->create();
    7474                wp_set_current_user( $u );
    7575
     
    8181        public function test_public_only_false_should_allow_current_user_access_to_own_private_posts_when_current_user_matches_post_author(){
    8282                $current_user = get_current_user_id();
    83                 $u = $this->factory->user->create();
     83                $u = self::$factory->user->create();
    8484                wp_set_current_user( $u );
    8585
     
    9292        public function test_public_only_false_should_not_allow_access_to_private_posts_if_current_user_is_not_post_author(){
    9393                $current_user = get_current_user_id();
    94                 $u1 = $this->factory->user->create();
    95                 $u2 = $this->factory->user->create();
     94                $u1 = self::$factory->user->create();
     95                $u2 = self::$factory->user->create();
    9696                wp_set_current_user( $u1 );
    9797
     
    104104        public function test_public_only_false_should_allow_current_user_access_to_own_private_posts_when_post_author_is_not_provided(){
    105105                $current_user = get_current_user_id();
    106                 $u = $this->factory->user->create();
     106                $u = self::$factory->user->create();
    107107                wp_set_current_user( $u );
    108108
     
    116116        public function test_administrator_should_have_access_to_private_posts_when_public_only_is_false(){
    117117                $current_user = get_current_user_id();
    118                 $u = $this->factory->user->create( array( 'role' => 'administrator' ) );
     118                $u = self::$factory->user->create( array( 'role' => 'administrator' ) );
    119119                wp_set_current_user( $u );
    120120
     
    131131                register_post_type( 'baz', array( 'capabilities' => array( 'read_private_posts' => 'read_private_baz' ) ) );
    132132                $current_user = get_current_user_id();
    133                 $u = $this->factory->user->create( array( 'role' => 'editor' ) );
     133                $u = self::$factory->user->create( array( 'role' => 'editor' ) );
    134134                $editor_role = get_role('editor');
    135135                $editor_role->add_cap( 'read_private_baz' );
  • trunk/tests/phpunit/tests/post/listPages.php

    r30523 r35225  
    2828                $wpdb->query( 'TRUNCATE ' . $wpdb->prefix . 'posts' );
    2929                $pages = array();
    30                 $this->factory->user->create();
    31                 $pages[] = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 1' ) );
    32                 $pages[] = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 2' ) );
    33                 $pages[] = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 3', 'post_author' => '2' ) );
     30                self::$factory->user->create();
     31                $pages[] = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 1' ) );
     32                $pages[] = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 2' ) );
     33                $pages[] = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 3', 'post_author' => '2' ) );
    3434
    3535                foreach ( $pages as $page ) {
    36                         $this->pages[$page] = $this->factory->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 1' ) );
    37                         $this->pages[$page] = $this->factory->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 2' ) );
    38                         $this->pages[$page] = $this->factory->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 3' ) );
     36                        $this->pages[$page] = self::$factory->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 1' ) );
     37                        $this->pages[$page] = self::$factory->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 2' ) );
     38                        $this->pages[$page] = self::$factory->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 3' ) );
    3939                }
    4040        }
  • trunk/tests/phpunit/tests/post/meta.php

    r31622 r35225  
    99                parent::setUp();
    1010
    11                 $this->author = new WP_User( $this->factory->user->create( array( 'role' => 'editor' ) ) );
     11                $this->author = new WP_User( self::$factory->user->create( array( 'role' => 'editor' ) ) );
    1212
    1313                $post = array(
  • trunk/tests/phpunit/tests/post/nav-menu.php

    r32294 r35225  
    1717
    1818        function test_wp_get_associated_nav_menu_items() {
    19                 $tag_id = $this->factory->tag->create();
    20                 $cat_id = $this->factory->category->create();
    21                 $post_id = $this->factory->post->create();
    22                 $post_2_id = $this->factory->post->create();
    23                 $page_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
     19                $tag_id = self::$factory->tag->create();
     20                $cat_id = self::$factory->category->create();
     21                $post_id = self::$factory->post->create();
     22                $post_2_id = self::$factory->post->create();
     23                $page_id = self::$factory->post->create( array( 'post_type' => 'page' ) );
    2424
    2525                $tag_insert = wp_update_nav_menu_item( $this->menu_id, 0, array(
     
    108108
    109109                // Update the orphan with an associated nav menu
    110                 wp_update_nav_menu_item( $this->menu_id, $custom_item_id, array( 
     110                wp_update_nav_menu_item( $this->menu_id, $custom_item_id, array(
    111111                        'menu-item-title'     => 'WordPress.org',
    112112                        ) );
     
    120120        public function test_wp_get_nav_menu_items_with_taxonomy_term() {
    121121                register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) );
    122                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    123                 $child_terms = $this->factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax', 'parent' => $t ) );
     122                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     123                $child_terms = self::$factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax', 'parent' => $t ) );
    124124
    125125                $term_menu_item = wp_update_nav_menu_item( $this->menu_id, 0, array(
     
    141141         */
    142142        function test_orderby_name_by_default() {
    143                 // We are going to create a random number of menus (min 2, max 10) 
     143                // We are going to create a random number of menus (min 2, max 10)
    144144                $menus_no = rand( 2, 10 );
    145145
     
    149149
    150150                // This is the expected array of menu names
    151                 $expected_nav_menus_names = wp_list_pluck( 
     151                $expected_nav_menus_names = wp_list_pluck(
    152152                        get_terms( 'nav_menu',  array( 'hide_empty' => false, 'orderby' => 'name' ) ),
    153153                        'name'
     
    156156                // And this is what we got when calling wp_get_nav_menus()
    157157                $nav_menus_names = wp_list_pluck( wp_get_nav_menus(), 'name' );
    158                
     158
    159159                $this->assertEquals( $nav_menus_names, $expected_nav_menus_names );
    160160        }
  • trunk/tests/phpunit/tests/post/objects.php

    r25002 r35225  
    77
    88        function test_get_post() {
    9                 $id = $this->factory->post->create();
     9                $id = self::$factory->post->create();
    1010
    1111                $post = get_post( $id );
     
    6868
    6969        function test_get_post_ancestors() {
    70                 $parent_id = $this->factory->post->create();
    71                 $child_id = $this->factory->post->create();
    72                 $grandchild_id = $this->factory->post->create();
     70                $parent_id = self::$factory->post->create();
     71                $child_id = self::$factory->post->create();
     72                $grandchild_id = self::$factory->post->create();
    7373                $updated = wp_update_post( array( 'ID' => $child_id, 'post_parent' => $parent_id ) );
    7474                $this->assertEquals( $updated, $child_id );
     
    100100
    101101        function test_get_post_category_property() {
    102                 $post_id = $this->factory->post->create();
     102                $post_id = self::$factory->post->create();
    103103                $post = get_post( $post_id );
    104104
     
    119119
    120120        function test_get_tags_input_property() {
    121                 $post_id = $this->factory->post->create();
     121                $post_id = self::$factory->post->create();
    122122                $post = get_post( $post_id );
    123123
     
    136136
    137137        function test_get_page_template_property() {
    138                 $post_id = $this->factory->post->create();
     138                $post_id = self::$factory->post->create();
    139139                $post = get_post( $post_id );
    140140
     
    156156
    157157        function test_get_post_filter() {
    158                 $post = get_post( $this->factory->post->create( array(
     158                $post = get_post( self::$factory->post->create( array(
    159159                        'post_title' => "Mary's home"
    160160                ) ) );
     
    179179
    180180        function test_get_post_identity() {
    181                 $post = get_post( $this->factory->post->create() );
     181                $post = get_post( self::$factory->post->create() );
    182182
    183183                $post->foo = 'bar';
     
    188188
    189189        function test_get_post_array() {
    190                 $id = $this->factory->post->create();
     190                $id = self::$factory->post->create();
    191191
    192192                $post = get_post( $id, ARRAY_A );
     
    203203                global $wpdb;
    204204
    205                 $id = $this->factory->post->create();
     205                $id = self::$factory->post->create();
    206206                wp_cache_delete( $id, 'posts' );
    207207
  • trunk/tests/phpunit/tests/post/output.php

    r25002 r35225  
    4242EOF;
    4343
    44                 $post_id = $this->factory->post->create( compact( 'post_content' ) );
     44                $post_id = self::$factory->post->create( compact( 'post_content' ) );
    4545
    4646                $expected = <<<EOF
     
    7777EOF;
    7878
    79                 $post_id = $this->factory->post->create( compact( 'post_content' ) );
     79                $post_id = self::$factory->post->create( compact( 'post_content' ) );
    8080                $this->go_to( get_permalink( $post_id ) );
    8181                $this->assertTrue( is_single() );
     
    115115EOF;
    116116
    117                 $post_id = $this->factory->post->create( compact( 'post_content' ) );
     117                $post_id = self::$factory->post->create( compact( 'post_content' ) );
    118118                $this->go_to( get_permalink( $post_id ) );
    119119                $this->assertTrue( is_single() );
     
    137137EOF;
    138138
    139                 $post_id = $this->factory->post->create( compact( 'post_content' ) );
     139                $post_id = self::$factory->post->create( compact( 'post_content' ) );
    140140                $this->go_to( get_permalink( $post_id ) );
    141141                $this->assertTrue( is_single() );
     
    161161EOF;
    162162
    163                 $post_id = $this->factory->post->create( compact( 'post_content' ) );
     163                $post_id = self::$factory->post->create( compact( 'post_content' ) );
    164164                $this->go_to( get_permalink( $post_id ) );
    165165                $this->assertTrue( is_single() );
  • trunk/tests/phpunit/tests/post/query.php

    r35162 r35225  
    1212                $q = new WP_Query();
    1313
    14                 $term_id = $this->factory->category->create( array( 'slug' => 'woo', 'name' => 'WOO!' ) );
    15                 $term_id2 = $this->factory->category->create( array( 'slug' => 'hoo', 'name' => 'HOO!' ) );
    16                 $post_id = $this->factory->post->create();
     14                $term_id = self::$factory->category->create( array( 'slug' => 'woo', 'name' => 'WOO!' ) );
     15                $term_id2 = self::$factory->category->create( array( 'slug' => 'hoo', 'name' => 'HOO!' ) );
     16                $post_id = self::$factory->post->create();
    1717
    1818                wp_set_post_categories( $post_id, $term_id );
     
    4242         */
    4343        function test_empty_category__in() {
    44                 $cat_id = $this->factory->category->create();
    45                 $post_id = $this->factory->post->create();
     44                $cat_id = self::$factory->category->create();
     45                $post_id = self::$factory->post->create();
    4646                wp_set_post_categories( $post_id, $cat_id );
    4747
     
    7272        function test_the_posts_filter() {
    7373                // Create posts and clear their caches.
    74                 $post_ids = $this->factory->post->create_many( 4 );
     74                $post_ids = self::$factory->post->create_many( 4 );
    7575                foreach ( $post_ids as $post_id )
    7676                        clean_post_cache( $post_id );
     
    116116
    117117        function test_post__in_ordering() {
    118                 $post_id1 = $this->factory->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) );
    119                 $post_id2 = $this->factory->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) );
    120                 $post_id3 = $this->factory->post->create( array(
     118                $post_id1 = self::$factory->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) );
     119                $post_id2 = self::$factory->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) );
     120                $post_id3 = self::$factory->post->create( array(
    121121                        'post_type' => 'page',
    122122                        'post_parent' => $post_id2,
    123123                        'menu_order' => rand( 1, 100 )
    124124                ) );
    125                 $post_id4 = $this->factory->post->create( array(
     125                $post_id4 = self::$factory->post->create( array(
    126126                        'post_type' => 'page',
    127127                        'post_parent' => $post_id2,
    128128                        'menu_order' => rand( 1, 100 )
    129129                ) );
    130                 $post_id5 = $this->factory->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) );
     130                $post_id5 = self::$factory->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) );
    131131
    132132                $ordered = array( $post_id2, $post_id4, $post_id3, $post_id1, $post_id5 );
     
    141141
    142142        function test_post__in_attachment_ordering() {
    143                 $post_id = $this->factory->post->create();
     143                $post_id = self::$factory->post->create();
    144144                $att_ids = array();
    145145                $file = DIR_TESTDATA . '/images/canola.jpg';
    146                 $att_ids[1] = $this->factory->attachment->create_object( $file, $post_id, array(
    147                         'post_mime_type' => 'image/jpeg',
    148                         'menu_order' => rand( 1, 100 )
    149                 ) );
    150                 $att_ids[2] = $this->factory->attachment->create_object( $file, $post_id, array(
    151                         'post_mime_type' => 'image/jpeg',
    152                         'menu_order' => rand( 1, 100 )
    153                 ) );
    154                 $att_ids[3] = $this->factory->attachment->create_object( $file, $post_id, array(
    155                         'post_mime_type' => 'image/jpeg',
    156                         'menu_order' => rand( 1, 100 )
    157                 ) );
    158                 $att_ids[4] = $this->factory->attachment->create_object( $file, $post_id, array(
    159                         'post_mime_type' => 'image/jpeg',
    160                         'menu_order' => rand( 1, 100 )
    161                 ) );
    162                 $att_ids[5] = $this->factory->attachment->create_object( $file, $post_id, array(
     146                $att_ids[1] = self::$factory->attachment->create_object( $file, $post_id, array(
     147                        'post_mime_type' => 'image/jpeg',
     148                        'menu_order' => rand( 1, 100 )
     149                ) );
     150                $att_ids[2] = self::$factory->attachment->create_object( $file, $post_id, array(
     151                        'post_mime_type' => 'image/jpeg',
     152                        'menu_order' => rand( 1, 100 )
     153                ) );
     154                $att_ids[3] = self::$factory->attachment->create_object( $file, $post_id, array(
     155                        'post_mime_type' => 'image/jpeg',
     156                        'menu_order' => rand( 1, 100 )
     157                ) );
     158                $att_ids[4] = self::$factory->attachment->create_object( $file, $post_id, array(
     159                        'post_mime_type' => 'image/jpeg',
     160                        'menu_order' => rand( 1, 100 )
     161                ) );
     162                $att_ids[5] = self::$factory->attachment->create_object( $file, $post_id, array(
    163163                        'post_mime_type' => 'image/jpeg',
    164164                        'menu_order' => rand( 1, 100 )
     
    312312                $q = new WP_Query();
    313313
    314                 $post_ids[0] = $this->factory->post->create( array( 'post_title' => 'woo', 'post_date' => '2015-07-23 00:00:00' ) );
    315                 $post_ids[1] = $this->factory->post->create( array( 'post_title' => 'hoo', 'post_date' => '2015-07-23 00:00:00' ) );
    316                 $post_ids[2] = $this->factory->post->create( array( 'post_title' => 'test', 'post_date' => '2015-07-23 00:00:00' ) );
    317                 $post_ids[3] = $this->factory->post->create( array( 'post_title' => 'me', 'post_date' => '2015-07-23 00:00:00' ) );
     314                $post_ids[0] = self::$factory->post->create( array( 'post_title' => 'woo', 'post_date' => '2015-07-23 00:00:00' ) );
     315                $post_ids[1] = self::$factory->post->create( array( 'post_title' => 'hoo', 'post_date' => '2015-07-23 00:00:00' ) );
     316                $post_ids[2] = self::$factory->post->create( array( 'post_title' => 'test', 'post_date' => '2015-07-23 00:00:00' ) );
     317                $post_ids[3] = self::$factory->post->create( array( 'post_title' => 'me', 'post_date' => '2015-07-23 00:00:00' ) );
    318318
    319319                $requested = array( $post_ids[0], $post_ids[3] );
  • trunk/tests/phpunit/tests/post/revisions.php

    r35224 r35225  
    145145         */
    146146        function test_revision_view_caps_post() {
    147                 $post_id = $this->factory->post->create( array( 'post_type' => 'post', 'post_author' => self::$editor_user_id ) );
     147                $post_id = self::$factory->post->create( array( 'post_type' => 'post', 'post_author' => self::$editor_user_id ) );
    148148                wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) );
    149149
     
    167167         */
    168168        function test_revision_restore_caps_post() {
    169                 $post_id = $this->factory->post->create( array( 'post_type' => 'post', 'post_author' => self::$editor_user_id ) );
     169                $post_id = self::$factory->post->create( array( 'post_type' => 'post', 'post_author' => self::$editor_user_id ) );
    170170                wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) );
    171171
     
    187187         */
    188188        function test_revision_diff_caps_post() {
    189                 $post_id = $this->factory->post->create( array( 'post_type' => 'post', 'post_author' => self::$editor_user_id ) );
     189                $post_id = self::$factory->post->create( array( 'post_type' => 'post', 'post_author' => self::$editor_user_id ) );
    190190                wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) );
    191191                wp_update_post( array( 'post_content' => 'This content is even better', 'ID' => $post_id ) );
     
    215215                ) );
    216216
    217                 $post_id = $this->factory->post->create( array( 'post_type' => $this->post_type, 'post_author' => self::$editor_user_id ) );
     217                $post_id = self::$factory->post->create( array( 'post_type' => $this->post_type, 'post_author' => self::$editor_user_id ) );
    218218                wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) );
    219219
     
    248248
    249249                //create a post as Editor
    250                 $post_id = $this->factory->post->create( array( 'post_type' => $this->post_type, 'post_author' => self::$editor_user_id ) );
     250                $post_id = self::$factory->post->create( array( 'post_type' => $this->post_type, 'post_author' => self::$editor_user_id ) );
    251251                wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) );
    252252
     
    283283                wp_set_current_user( self::$editor_user_id );
    284284
    285                 $post_id = $this->factory->post->create( array( 'post_type' => $this->post_type, 'post_status' => 'draft' ) );
     285                $post_id = self::$factory->post->create( array( 'post_type' => $this->post_type, 'post_status' => 'draft' ) );
    286286                wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) );
    287287
     
    315315                ) );
    316316
    317                 $post_id = $this->factory->post->create( array( 'post_type' => $this->post_type, 'post_author' => self::$editor_user_id ) );
     317                $post_id = self::$factory->post->create( array( 'post_type' => $this->post_type, 'post_author' => self::$editor_user_id ) );
    318318                wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) );
    319319                wp_update_post( array( 'post_content' => 'This content is even better', 'ID' => $post_id ) );
     
    338338                global $wpdb;
    339339
    340                 $post = $this->factory->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post', 'post_content' => 'some_content' ) );
     340                $post = self::$factory->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post', 'post_content' => 'some_content' ) );
    341341
    342342                $post = (array) $post;
     
    366366         */
    367367        function test_wp_get_post_revisions_should_order_by_ID_when_post_date_matches() {
    368                 $post = $this->factory->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post', 'post_content' => 'some_content' ) );
     368                $post = self::$factory->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post', 'post_content' => 'some_content' ) );
    369369
    370370                $post = (array) $post;
  • trunk/tests/phpunit/tests/post/slashes.php

    r34668 r35225  
    99        function setUp() {
    1010                parent::setUp();
    11                 $this->author_id = $this->factory->user->create( array( 'role' => 'editor' ) );
     11                $this->author_id = self::$factory->user->create( array( 'role' => 'editor' ) );
    1212                $this->old_current_user = get_current_user_id();
    1313                wp_set_current_user( $this->author_id );
     
    3434         */
    3535        function test_edit_post() {
    36                 $id = $this->factory->post->create();
     36                $id = self::$factory->post->create();
    3737
    3838                $_POST = array();
     
    103103         */
    104104        function test_wp_update_post() {
    105                 $id = $this->factory->post->create();
     105                $id = self::$factory->post->create();
    106106
    107107                wp_update_post(array(
  • trunk/tests/phpunit/tests/post/template.php

    r34950 r35225  
    99                $contents = array( 'One', 'Two', 'Three' );
    1010                $content = join( '<!--nextpage-->', $contents );
    11                 $post_id = $this->factory->post->create( array( 'post_content' => $content ) );
     11                $post_id = self::$factory->post->create( array( 'post_content' => $content ) );
    1212
    1313                $this->go_to( '?p=' . $post_id );
     
    8282
    8383                $bump = '&nbsp;&nbsp;&nbsp;';
    84                 $page_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
    85                 $child_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id ) );
    86                 $grandchild_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_parent' => $child_id ) );
     84                $page_id = self::$factory->post->create( array( 'post_type' => 'page' ) );
     85                $child_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id ) );
     86                $grandchild_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_parent' => $child_id ) );
     87
     88                $title1 = get_post( $page_id )->post_title;
     89                $title2 = get_post( $child_id )->post_title;
     90                $title3 = get_post( $grandchild_id )->post_title;
    8791
    8892                $lineage =<<<LINEAGE
    8993<select name='page_id' id='page_id'>
    90         <option class="level-0" value="$page_id">Post title 1</option>
    91         <option class="level-1" value="$child_id">{$bump}Post title 2</option>
    92         <option class="level-2" value="$grandchild_id">{$bump}{$bump}Post title 3</option>
     94        <option class="level-0" value="$page_id">$title1</option>
     95        <option class="level-1" value="$child_id">{$bump}$title2</option>
     96        <option class="level-2" value="$grandchild_id">{$bump}{$bump}$title3</option>
    9397</select>
    9498
     
    100104                $depth =<<<DEPTH
    101105<select name='page_id' id='page_id'>
    102         <option class="level-0" value="$page_id">Post title 1</option>
     106        <option class="level-0" value="$page_id">$title1</option>
    103107</select>
    104108
     
    111115<select name='page_id' id='page_id'>
    112116        <option value="Woo">Hoo</option>
    113         <option class="level-0" value="$page_id">Post title 1</option>
     117        <option class="level-0" value="$page_id">$title1</option>
    114118</select>
    115119
     
    125129        <option value="-1">Burrito</option>
    126130        <option value="Woo">Hoo</option>
    127         <option class="level-0" value="$page_id">Post title 1</option>
     131        <option class="level-0" value="$page_id">$title1</option>
    128132</select>
    129133
     
    140144         */
    141145        public function test_wp_dropdown_pages_value_field_should_default_to_ID() {
    142                 $p = $this->factory->post->create( array(
     146                $p = self::$factory->post->create( array(
    143147                        'post_type' => 'page',
    144148                ) );
     
    156160         */
    157161        public function test_wp_dropdown_pages_value_field_ID() {
    158                 $p = $this->factory->post->create( array(
     162                $p = self::$factory->post->create( array(
    159163                        'post_type' => 'page',
    160164                ) );
     
    172176         */
    173177        public function test_wp_dropdown_pages_value_field_post_name() {
    174                 $p = $this->factory->post->create( array(
     178                $p = self::$factory->post->create( array(
    175179                        'post_type' => 'page',
    176180                        'post_name' => 'foo',
     
    189193         */
    190194        public function test_wp_dropdown_pages_value_field_should_fall_back_on_ID_when_an_invalid_value_is_provided() {
    191                 $p = $this->factory->post->create( array(
     195                $p = self::$factory->post->create( array(
    192196                        'post_type' => 'page',
    193197                        'post_name' => 'foo',
     
    206210         */
    207211        public function test_wp_dropdown_pages_should_not_contain_class_attribute_when_no_class_is_passed() {
    208                 $p = $this->factory->post->create( array(
     212                $p = self::$factory->post->create( array(
    209213                        'post_type' => 'page',
    210214                        'post_name' => 'foo',
     
    222226         */
    223227        public function test_wp_dropdown_pages_should_obey_class_parameter() {
    224                 $p = $this->factory->post->create( array(
     228                $p = self::$factory->post->create( array(
    225229                        'post_type' => 'page',
    226230                        'post_name' => 'foo',
     
    239243         */
    240244        public function test_get_page_template_slug_by_id() {
    241                 $page_id = $this->factory->post->create( array(
     245                $page_id = self::$factory->post->create( array(
    242246                        'post_type' => 'page',
    243247                ) );
     
    256260         */
    257261        public function test_get_page_template_slug_from_loop() {
    258                 $page_id = $this->factory->post->create( array(
     262                $page_id = self::$factory->post->create( array(
    259263                        'post_type' => 'page',
    260264                ) );
     
    270274         */
    271275        public function test_get_page_template_slug_non_page() {
    272                 $post_id = $this->factory->post->create( array(
     276                $post_id = self::$factory->post->create( array(
    273277                        'post_type' => 'post',
    274278                ) );
     
    285289         */
    286290        public function test_wp_page_menu_wp_nav_menu_fallback() {
    287                 $pages = $this->factory->post->create_many( 3, array( 'post_type' => 'page' ) );
     291                $pages = self::$factory->post->create_many( 3, array( 'post_type' => 'page' ) );
    288292
    289293                // No menus + wp_nav_menu() falls back to wp_page_menu().
  • trunk/tests/phpunit/tests/post/wpUniquePostSlug.php

    r34810 r35225  
    99         */
    1010        public function test_non_latin_slugs() {
    11                 $author_id = $this->factory->user->create( array( 'role' => 'editor' ) );
     11                $author_id = self::$factory->user->create( array( 'role' => 'editor' ) );
    1212
    1313                $inputs = array(
     
    5050                        'post_status' => 'publish',
    5151                );
    52                 $one = $this->factory->post->create( $args );
     52                $one = self::$factory->post->create( $args );
    5353                $args['post_type'] = 'post-type-2';
    54                 $two = $this->factory->post->create( $args );
     54                $two = self::$factory->post->create( $args );
    5555
    5656                $this->assertEquals( 'some-slug', get_post( $one )->post_name );
     
    7575                        'post_status' => 'publish',
    7676                );
    77                 $one = $this->factory->post->create( $args );
     77                $one = self::$factory->post->create( $args );
    7878                $args['post_name'] = 'some-slug-2';
    79                 $two = $this->factory->post->create( $args );
     79                $two = self::$factory->post->create( $args );
    8080
    8181                $this->assertEquals( 'some-slug', get_post( $one )->post_name );
     
    9898                        'post_status' => 'publish',
    9999                );
    100                 $one = $this->factory->post->create( $args );
     100                $one = self::$factory->post->create( $args );
    101101
    102102                $args = array(
     
    105105                        'post_name' => 'image'
    106106                );
    107                 $attachment = $this->factory->attachment->create_object( 'image.jpg', $one, $args );
     107                $attachment = self::$factory->attachment->create_object( 'image.jpg', $one, $args );
    108108
    109109                $args = array(
     
    113113                        'post_parent' => $one
    114114                );
    115                 $two = $this->factory->post->create( $args );
     115                $two = self::$factory->post->create( $args );
    116116
    117117                $this->assertEquals( 'some-slug', get_post( $one )->post_name );
     
    129129         */
    130130        public function test_whitelisted_post_statuses_should_not_be_forced_to_be_unique( $status ) {
    131                 $p1 = $this->factory->post->create( array(
    132                         'post_type' => 'post',
    133                         'post_name' => 'foo',
    134                 ) );
    135 
    136                 $p2 = $this->factory->post->create( array(
     131                $p1 = self::$factory->post->create( array(
     132                        'post_type' => 'post',
     133                        'post_name' => 'foo',
     134                ) );
     135
     136                $p2 = self::$factory->post->create( array(
    137137                        'post_type' => 'post',
    138138                ) );
     
    152152
    153153        public function test_revisions_should_not_be_forced_to_be_unique() {
    154                 $p1 = $this->factory->post->create( array(
    155                         'post_type' => 'post',
    156                         'post_name' => 'foo',
    157                 ) );
    158 
    159                 $p2 = $this->factory->post->create( array(
     154                $p1 = self::$factory->post->create( array(
     155                        'post_type' => 'post',
     156                        'post_name' => 'foo',
     157                ) );
     158
     159                $p2 = self::$factory->post->create( array(
    160160                        'post_type' => 'post',
    161161                ) );
     
    172172                $this->set_permalink_structure( '/%postname%/' );
    173173
    174                 $p = $this->factory->post->create( array(
     174                $p = self::$factory->post->create( array(
    175175                        'post_type' => 'post',
    176176                        'post_name' => 'foo',
     
    187187                $this->set_permalink_structure( '/%postname%/' );
    188188
    189                 $p = $this->factory->post->create( array(
     189                $p = self::$factory->post->create( array(
    190190                        'post_type' => 'post',
    191191                        'post_name' => 'foo',
     
    203203                $this->set_permalink_structure( '/%year%/%postname%/' );
    204204
    205                 $p = $this->factory->post->create( array(
     205                $p = self::$factory->post->create( array(
    206206                        'post_type' => 'post',
    207207                        'post_name' => 'foo',
     
    218218                $this->set_permalink_structure( '/%year%/%postname%/' );
    219219
    220                 $p = $this->factory->post->create( array(
     220                $p = self::$factory->post->create( array(
    221221                        'post_type' => 'post',
    222222                        'post_name' => 'foo',
     
    233233                $this->set_permalink_structure( '/%year%/foo/%postname%/' );
    234234
    235                 $p = $this->factory->post->create( array(
     235                $p = self::$factory->post->create( array(
    236236                        'post_type' => 'post',
    237237                        'post_name' => 'foo',
     
    248248                $this->set_permalink_structure( '/%year%/%postname%/' );
    249249
    250                 $p = $this->factory->post->create( array(
     250                $p = self::$factory->post->create( array(
    251251                        'post_type' => 'post',
    252252                        'post_name' => 'foo',
     
    263263                $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' );
    264264
    265                 $p = $this->factory->post->create( array(
     265                $p = self::$factory->post->create( array(
    266266                        'post_type' => 'post',
    267267                        'post_name' => 'foo',
     
    278278                $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
    279279
    280                 $p = $this->factory->post->create( array(
     280                $p = self::$factory->post->create( array(
    281281                        'post_type' => 'post',
    282282                        'post_name' => 'foo',
     
    293293                $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' );
    294294
    295                 $p = $this->factory->post->create( array(
     295                $p = self::$factory->post->create( array(
    296296                        'post_type' => 'post',
    297297                        'post_name' => 'foo',
  • trunk/tests/phpunit/tests/query.php

    r35030 r35225  
    1515         */
    1616        function test_nested_loop_reset_postdata() {
    17                 $post_id = $this->factory->post->create();
    18                 $nested_post_id = $this->factory->post->create();
     17                $post_id = self::$factory->post->create();
     18                $nested_post_id = self::$factory->post->create();
    1919
    2020                $first_query = new WP_Query( array( 'post__in' => array( $post_id ) ) );
     
    4444         */
    4545        function test_pre_posts_per_page() {
    46                 $this->factory->post->create_many( 10 );
     46                self::$factory->post->create_many( 10 );
    4747
    4848                add_action( 'pre_get_posts', array( $this, 'filter_posts_per_page' ) );
     
    6262        function test_tag_queried_object() {
    6363                $slug = 'tag-slug-26627';
    64                 $this->factory->tag->create( array( 'slug' => $slug ) );
     64                self::$factory->tag->create( array( 'slug' => $slug ) );
    6565                $tag = get_term_by( 'slug', $slug, 'post_tag' );
    6666
     
    9595                remove_action( 'pre_get_posts', array( $this, 'pre_get_posts_tax_category_tax_query' ) );
    9696                register_taxonomy( 'wptests_tax', 'post' );
    97                 $terms = $this->factory->term->create_many( 2, array(
     97                $terms = self::$factory->term->create_many( 2, array(
    9898                        'taxonomy' => 'wptests_tax',
    9999                ) );
    100100
    101                 $posts = $this->factory->post->create_many( 2 );
     101                $posts = self::$factory->post->create_many( 2 );
    102102
    103103                wp_set_object_terms( $posts[0], array( $terms[0] ), 'wptests_tax' );
     
    131131
    132132        public function test_cat_querystring_single_term() {
    133                 $c1 = $this->factory->category->create( array(
     133                $c1 = self::$factory->category->create( array(
    134134                        'name' => 'Test Category 1',
    135135                        'slug' => 'test1',
    136136                ) );
    137                 $c2 = $this->factory->category->create( array(
     137                $c2 = self::$factory->category->create( array(
    138138                        'name' => 'Test Category 2',
    139139                        'slug' => 'test2',
    140140                ) );
    141141
    142                 $p1 = $this->factory->post->create();
    143                 $p2 = $this->factory->post->create();
    144                 $p3 = $this->factory->post->create();
     142                $p1 = self::$factory->post->create();
     143                $p2 = self::$factory->post->create();
     144                $p3 = self::$factory->post->create();
    145145
    146146                wp_set_object_terms( $p1, $c1, 'category' );
     
    160160
    161161        public function test_category_querystring_multiple_terms_comma_separated() {
    162                 $c1 = $this->factory->category->create( array(
     162                $c1 = self::$factory->category->create( array(
    163163                        'name' => 'Test Category 1',
    164164                        'slug' => 'test1',
    165165                ) );
    166                 $c2 = $this->factory->category->create( array(
     166                $c2 = self::$factory->category->create( array(
    167167                        'name' => 'Test Category 2',
    168168                        'slug' => 'test2',
    169169                ) );
    170                 $c3 = $this->factory->category->create( array(
     170                $c3 = self::$factory->category->create( array(
    171171                        'name' => 'Test Category 3',
    172172                        'slug' => 'test3',
    173173                ) );
    174174
    175                 $p1 = $this->factory->post->create();
    176                 $p2 = $this->factory->post->create();
    177                 $p3 = $this->factory->post->create();
    178                 $p4 = $this->factory->post->create();
     175                $p1 = self::$factory->post->create();
     176                $p2 = self::$factory->post->create();
     177                $p3 = self::$factory->post->create();
     178                $p4 = self::$factory->post->create();
    179179
    180180                wp_set_object_terms( $p1, $c1, 'category' );
     
    198198         */
    199199        public function test_category_querystring_multiple_terms_formatted_as_array() {
    200                 $c1 = $this->factory->category->create( array(
     200                $c1 = self::$factory->category->create( array(
    201201                        'name' => 'Test Category 1',
    202202                        'slug' => 'test1',
    203203                ) );
    204                 $c2 = $this->factory->category->create( array(
     204                $c2 = self::$factory->category->create( array(
    205205                        'name' => 'Test Category 2',
    206206                        'slug' => 'test2',
    207207                ) );
    208                 $c3 = $this->factory->category->create( array(
     208                $c3 = self::$factory->category->create( array(
    209209                        'name' => 'Test Category 3',
    210210                        'slug' => 'test3',
    211211                ) );
    212212
    213                 $p1 = $this->factory->post->create();
    214                 $p2 = $this->factory->post->create();
    215                 $p3 = $this->factory->post->create();
    216                 $p4 = $this->factory->post->create();
     213                $p1 = self::$factory->post->create();
     214                $p2 = self::$factory->post->create();
     215                $p3 = self::$factory->post->create();
     216                $p4 = self::$factory->post->create();
    217217
    218218                wp_set_object_terms( $p1, $c1, 'category' );
     
    234234
    235235        public function test_tag_querystring_single_term() {
    236                 $t1 = $this->factory->tag->create_and_get( array(
     236                $t1 = self::$factory->tag->create_and_get( array(
    237237                        'name' => 'Test Tag 1',
    238238                        'slug' => 'test1',
    239239                ) );
    240                 $t2 = $this->factory->tag->create_and_get( array(
     240                $t2 = self::$factory->tag->create_and_get( array(
    241241                        'name' => 'Test Tag 2',
    242242                        'slug' => 'test2',
    243243                ) );
    244244
    245                 $p1 = $this->factory->post->create();
    246                 $p2 = $this->factory->post->create();
    247                 $p3 = $this->factory->post->create();
     245                $p1 = self::$factory->post->create();
     246                $p2 = self::$factory->post->create();
     247                $p3 = self::$factory->post->create();
    248248
    249249                wp_set_object_terms( $p1, $t1->slug, 'post_tag' );
     
    263263
    264264        public function test_tag_querystring_multiple_terms_comma_separated() {
    265                 $c1 = $this->factory->tag->create_and_get( array(
     265                $c1 = self::$factory->tag->create_and_get( array(
    266266                        'name' => 'Test Tag 1',
    267267                        'slug' => 'test1',
    268268                ) );
    269                 $c2 = $this->factory->tag->create_and_get( array(
     269                $c2 = self::$factory->tag->create_and_get( array(
    270270                        'name' => 'Test Tag 2',
    271271                        'slug' => 'test2',
    272272                ) );
    273                 $c3 = $this->factory->tag->create_and_get( array(
     273                $c3 = self::$factory->tag->create_and_get( array(
    274274                        'name' => 'Test Tag 3',
    275275                        'slug' => 'test3',
    276276                ) );
    277277
    278                 $p1 = $this->factory->post->create();
    279                 $p2 = $this->factory->post->create();
    280                 $p3 = $this->factory->post->create();
    281                 $p4 = $this->factory->post->create();
     278                $p1 = self::$factory->post->create();
     279                $p2 = self::$factory->post->create();
     280                $p3 = self::$factory->post->create();
     281                $p4 = self::$factory->post->create();
    282282
    283283                wp_set_object_terms( $p1, $c1->slug, 'post_tag' );
     
    301301         */
    302302        public function test_tag_querystring_multiple_terms_formatted_as_array() {
    303                 $c1 = $this->factory->tag->create_and_get( array(
     303                $c1 = self::$factory->tag->create_and_get( array(
    304304                        'name' => 'Test Tag 1',
    305305                        'slug' => 'test1',
    306306                ) );
    307                 $c2 = $this->factory->tag->create_and_get( array(
     307                $c2 = self::$factory->tag->create_and_get( array(
    308308                        'name' => 'Test Tag 2',
    309309                        'slug' => 'test2',
    310310                ) );
    311                 $c3 = $this->factory->tag->create_and_get( array(
     311                $c3 = self::$factory->tag->create_and_get( array(
    312312                        'name' => 'Test Tag 3',
    313313                        'slug' => 'test3',
    314314                ) );
    315315
    316                 $p1 = $this->factory->post->create();
    317                 $p2 = $this->factory->post->create();
    318                 $p3 = $this->factory->post->create();
    319                 $p4 = $this->factory->post->create();
     316                $p1 = self::$factory->post->create();
     317                $p2 = self::$factory->post->create();
     318                $p3 = self::$factory->post->create();
     319                $p4 = self::$factory->post->create();
    320320
    321321                wp_set_object_terms( $p1, $c1->slug, 'post_tag' );
     
    342342                wp_insert_term( 'test3', 'test_tax_cat' );
    343343
    344                 $p1 = $this->factory->post->create();
    345                 $p2 = $this->factory->post->create();
    346                 $p3 = $this->factory->post->create();
     344                $p1 = self::$factory->post->create();
     345                $p2 = self::$factory->post->create();
     346                $p3 = self::$factory->post->create();
    347347
    348348                wp_set_object_terms( $p1, 'test1', 'test_tax_cat' );
     
    366366                wp_insert_term( 'test3', 'test_tax_cat' );
    367367
    368                 $p1 = $this->factory->post->create();
    369                 $p2 = $this->factory->post->create();
    370                 $p3 = $this->factory->post->create();
    371                 $p4 = $this->factory->post->create();
     368                $p1 = self::$factory->post->create();
     369                $p2 = self::$factory->post->create();
     370                $p3 = self::$factory->post->create();
     371                $p4 = self::$factory->post->create();
    372372
    373373                wp_set_object_terms( $p1, 'test1', 'test_tax_cat' );
     
    395395                wp_insert_term( 'test3', 'test_tax_cat' );
    396396
    397                 $p1 = $this->factory->post->create();
    398                 $p2 = $this->factory->post->create();
    399                 $p3 = $this->factory->post->create();
    400                 $p4 = $this->factory->post->create();
     397                $p1 = self::$factory->post->create();
     398                $p2 = self::$factory->post->create();
     399                $p3 = self::$factory->post->create();
     400                $p4 = self::$factory->post->create();
    401401
    402402                wp_set_object_terms( $p1, 'test1', 'test_tax_cat' );
     
    418418         */
    419419        public function test_pages_dont_404_when_queried_post_id_is_modified() {
    420                 $post_id = $this->factory->post->create( array( 'post_title' => 'A Test Page', 'post_type' => 'page' ) );
     420                $post_id = self::$factory->post->create( array( 'post_title' => 'A Test Page', 'post_type' => 'page' ) );
    421421
    422422                add_action( 'parse_query', array( $this, 'filter_parse_query_to_modify_queried_post_id' ) );
     
    439439                register_post_type( 'guide', array( 'name' => 'Guide', 'public' => true, 'hierarchical' => true ) );
    440440                $wp_rewrite->flush_rules();
    441                 $post_id = $this->factory->post->create( array( 'post_title' => 'A Test Guide', 'post_type' => 'guide' ) );
     441                $post_id = self::$factory->post->create( array( 'post_title' => 'A Test Guide', 'post_type' => 'guide' ) );
    442442
    443443                add_action( 'parse_query', array( $this, 'filter_parse_query_to_modify_queried_post_id' ) );
  • trunk/tests/phpunit/tests/query/conditionals.php

    r35196 r35225  
    4646
    4747        function test_permalink() {
    48                 $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );
     48                $post_id = self::$factory->post->create( array( 'post_title' => 'hello-world' ) );
    4949                $this->go_to( get_permalink( $post_id ) );
    5050                $this->assertQueryTrue('is_single', 'is_singular');
     
    5252
    5353        function test_post_comments_feed() {
    54                 $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );
    55                 $this->factory->comment->create_post_comments( $post_id, 2 );
     54                $post_id = self::$factory->post->create( array( 'post_title' => 'hello-world' ) );
     55                self::$factory->comment->create_post_comments( $post_id, 2 );
    5656                $this->go_to( get_post_comments_feed_link( $post_id ) );
    5757                $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
     
    6060
    6161        function test_post_comments_feed_with_no_comments() {
    62                 $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );
     62                $post_id = self::$factory->post->create( array( 'post_title' => 'hello-world' ) );
    6363                $this->go_to( get_post_comments_feed_link( $post_id ) );
    6464                $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed');
     
    6666
    6767        function test_page() {
    68                 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about' ) );
     68                $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about' ) );
    6969                $this->go_to( get_permalink( $page_id ) );
    7070                $this->assertQueryTrue('is_page','is_singular');
     
    7272
    7373        function test_parent_page() {
    74                 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
     74                $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
    7575                $this->go_to( get_permalink( $page_id ) );
    7676
     
    7979
    8080        function test_child_page_1() {
    81                 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
    82                 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
     81                $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
     82                $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
    8383                $this->go_to( get_permalink( $page_id ) );
    8484
     
    8787
    8888        function test_child_page_2() {
    89                 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
    90                 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
    91                 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
     89                $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
     90                $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
     91                $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
    9292                $this->go_to( get_permalink( $page_id ) );
    9393
     
    9898        function test_page_trackback() {
    9999                $page_ids = array();
    100                 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
    101                 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
    102                 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
     100                $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
     101                $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
     102                $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
    103103                foreach ( $page_ids as $page_id ) {
    104104                        $url = get_permalink( $page_id );
     
    117117        function test_page_feed() {
    118118                $page_ids = array();
    119                 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
    120                 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
    121                 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
     119                $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
     120                $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
     121                $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
    122122                foreach ( $page_ids as $page_id ) {
    123                         $this->factory->comment->create_post_comments( $page_id, 2 );
     123                        self::$factory->comment->create_post_comments( $page_id, 2 );
    124124                        $url = get_permalink( $page_id );
    125125                        $this->go_to("{$url}feed/");
     
    136136        function test_page_feed_with_no_comments() {
    137137                $page_ids = array();
    138                 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
    139                 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
    140                 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
     138                $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
     139                $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
     140                $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
    141141                foreach ( $page_ids as $page_id ) {
    142142                        $url = get_permalink( $page_id );
     
    155155        function test_page_feed_atom() {
    156156                $page_ids = array();
    157                 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
    158                 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
    159                 $page_ids[] = $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
     157                $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );
     158                $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );
     159                $page_ids[] = $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );
    160160                foreach ( $page_ids as $page_id ) {
    161                         $this->factory->comment->create_post_comments( $page_id, 2 );
     161                        self::$factory->comment->create_post_comments( $page_id, 2 );
    162162
    163163                        $url = get_permalink( $page_id );
     
    175175        // '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]'
    176176        function test_page_page_2() {
    177                 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
     177                $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
    178178                $this->go_to("/about/page/2/");
    179179
     
    188188        // '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]'
    189189        function test_page_page_2_no_slash() {
    190                 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
     190                $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
    191191                $this->go_to("/about/page2/");
    192192
     
    202202        // '(about)(/[0-9]+)?/?$' => 'index.php?pagename=$matches[1]&page=$matches[2]'
    203203        function test_pagination_of_posts_page() {
    204                 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
     204                $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );
    205205                update_option( 'show_on_front', 'page' );
    206206                update_option( 'page_for_posts', $page_id );
     
    224224        // '(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]',
    225225        function test_main_feed_2() {
    226                 $this->factory->post->create(); // @test_404
     226                self::$factory->post->create(); // @test_404
    227227                $feeds = array('feed', 'rdf', 'rss', 'rss2', 'atom');
    228228
     
    242242
    243243        function test_main_feed() {
    244                 $this->factory->post->create(); // @test_404
     244                self::$factory->post->create(); // @test_404
    245245                $types = array('rss2', 'rss', 'atom');
    246246                foreach ($types as $type) {
     
    253253        function test_paged() {
    254254                update_option( 'posts_per_page', 2 );
    255                 $this->factory->post->create_many( 5 );
     255                self::$factory->post->create_many( 5 );
    256256                for ( $i = 2; $i <= 3; $i++ ) {
    257257                        $this->go_to("/page/{$i}/");
     
    263263        // 'comments/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]&withcomments=1',
    264264        function test_main_comments_feed() {
    265                 $post_id = $this->factory->post->create( array( 'post_title' => 'hello-world' ) );
    266                 $this->factory->comment->create_post_comments( $post_id, 2 );
     265                $post_id = self::$factory->post->create( array( 'post_title' => 'hello-world' ) );
     266                self::$factory->comment->create_post_comments( $post_id, 2 );
    267267
    268268                // check the url as generated by get_post_comments_feed_link()
     
    307307        function test_search_paged() {
    308308                update_option( 'posts_per_page', 2 );
    309                 $this->factory->post->create_many( 3, array( 'post_title' => 'test' ) );
     309                self::$factory->post->create_many( 3, array( 'post_title' => 'test' ) );
    310310                $this->go_to('/search/test/page/2/');
    311311                $this->assertQueryTrue('is_search', 'is_paged');
     
    329329        // 'category/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]',
    330330        function test_category_feed() {
    331                 $this->factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) );
     331                self::$factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) );
    332332                // check the long form
    333333                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
     
    348348        function test_category_paged() {
    349349                update_option( 'posts_per_page', 2 );
    350                 $this->factory->post->create_many( 3 );
     350                self::$factory->post->create_many( 3 );
    351351                $this->go_to('/category/uncategorized/page/2/');
    352352                $this->assertQueryTrue('is_archive', 'is_category', 'is_paged');
     
    355355        // 'category/(.+?)/?$' => 'index.php?category_name=$matches[1]',
    356356        function test_category() {
    357                 $this->factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) );
     357                self::$factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) );
    358358                $this->go_to('/category/cat-a/');
    359359                $this->assertQueryTrue('is_archive', 'is_category');
     
    363363        // 'tag/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]',
    364364        function test_tag_feed() {
    365                 $this->factory->term->create( array( 'name' => 'tag-a', 'taxonomy' => 'post_tag' ) );
     365                self::$factory->term->create( array( 'name' => 'tag-a', 'taxonomy' => 'post_tag' ) );
    366366                // check the long form
    367367                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
     
    382382        function test_tag_paged() {
    383383                update_option( 'posts_per_page', 2 );
    384                 $post_ids = $this->factory->post->create_many( 3 );
     384                $post_ids = self::$factory->post->create_many( 3 );
    385385                foreach ( $post_ids as $post_id )
    386                         $this->factory->term->add_post_terms( $post_id, 'tag-a', 'post_tag' );
     386                        self::$factory->term->add_post_terms( $post_id, 'tag-a', 'post_tag' );
    387387                $this->go_to('/tag/tag-a/page/2/');
    388388                $this->assertQueryTrue('is_archive', 'is_tag', 'is_paged');
     
    391391        // 'tag/(.+?)/?$' => 'index.php?tag=$matches[1]',
    392392        function test_tag() {
    393                 $term_id = $this->factory->term->create( array( 'name' => 'Tag Named A', 'slug' => 'tag-a', 'taxonomy' => 'post_tag' ) );
     393                $term_id = self::$factory->term->create( array( 'name' => 'Tag Named A', 'slug' => 'tag-a', 'taxonomy' => 'post_tag' ) );
    394394                $this->go_to('/tag/tag-a/');
    395395                $this->assertQueryTrue('is_archive', 'is_tag');
     
    410410        // 'author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]',
    411411        function test_author_feed() {
    412                 $this->factory->user->create( array( 'user_login' => 'user-a' ) );
     412                self::$factory->user->create( array( 'user_login' => 'user-a' ) );
    413413                // check the long form
    414414                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
     
    429429        function test_author_paged() {
    430430                update_option( 'posts_per_page', 2 );
    431                 $user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) );
    432                 $this->factory->post->create_many( 3, array( 'post_author' => $user_id ) );
     431                $user_id = self::$factory->user->create( array( 'user_login' => 'user-a' ) );
     432                self::$factory->post->create_many( 3, array( 'post_author' => $user_id ) );
    433433                $this->go_to('/author/user-a/page/2/');
    434434                $this->assertQueryTrue('is_archive', 'is_author', 'is_paged');
     
    437437        // 'author/([^/]+)/?$' => 'index.php?author_name=$matches[1]',
    438438        function test_author() {
    439                 $user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) );
    440                 $this->factory->post->create( array( 'post_author' => $user_id ) );
     439                $user_id = self::$factory->user->create( array( 'user_login' => 'user-a' ) );
     440                self::$factory->post->create( array( 'post_author' => $user_id ) );
    441441                $this->go_to('/author/user-a/');
    442442                $this->assertQueryTrue('is_archive', 'is_author');
     
    444444
    445445        function test_author_with_no_posts() {
    446                 $user_id = $this->factory->user->create( array( 'user_login' => 'user-a' ) );
     446                $user_id = self::$factory->user->create( array( 'user_login' => 'user-a' ) );
    447447                $this->go_to('/author/user-a/');
    448448                $this->assertQueryTrue('is_archive', 'is_author');
     
    452452        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]',
    453453        function test_ymd_feed() {
    454                 $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
     454                self::$factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    455455                // check the long form
    456456                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
     
    471471        function test_ymd_paged() {
    472472                update_option( 'posts_per_page', 2 );
    473                 $this->factory->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );
     473                self::$factory->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );
    474474                $this->go_to('/2007/09/04/page/2/');
    475475                $this->assertQueryTrue('is_archive', 'is_day', 'is_date', 'is_paged');
     
    478478        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]',
    479479        function test_ymd() {
    480                 $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
     480                self::$factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    481481                $this->go_to('/2007/09/04/');
    482482                $this->assertQueryTrue('is_archive', 'is_day', 'is_date');
     
    486486        // '([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]',
    487487        function test_ym_feed() {
    488                 $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
     488                self::$factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    489489                // check the long form
    490490                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
     
    505505        function test_ym_paged() {
    506506                update_option( 'posts_per_page', 2 );
    507                 $this->factory->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );
     507                self::$factory->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );
    508508                $this->go_to('/2007/09/page/2/');
    509509                $this->assertQueryTrue('is_archive', 'is_date', 'is_month', 'is_paged');
     
    512512        // '([0-9]{4})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]',
    513513        function test_ym() {
    514                 $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
     514                self::$factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    515515                $this->go_to('/2007/09/');
    516516                $this->assertQueryTrue('is_archive', 'is_date', 'is_month');
     
    520520        // '([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&feed=$matches[2]',
    521521        function test_y_feed() {
    522                 $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
     522                self::$factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    523523                // check the long form
    524524                $types = array('feed', 'rdf', 'rss', 'rss2', 'atom');
     
    539539        function test_y_paged() {
    540540                update_option( 'posts_per_page', 2 );
    541                 $this->factory->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );
     541                self::$factory->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );
    542542                $this->go_to('/2007/page/2/');
    543543                $this->assertQueryTrue('is_archive', 'is_date', 'is_year', 'is_paged');
     
    546546        // '([0-9]{4})/?$' => 'index.php?year=$matches[1]',
    547547        function test_y() {
    548                 $this->factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
     548                self::$factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );
    549549                $this->go_to('/2007/');
    550550                $this->assertQueryTrue('is_archive', 'is_date', 'is_year');
     
    553553        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&tb=1',
    554554        function test_post_trackback() {
    555                 $post_id = $this->factory->post->create();
     555                $post_id = self::$factory->post->create();
    556556                $permalink = get_permalink( $post_id );
    557557                $this->go_to("{$permalink}trackback/");
     
    562562        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]',
    563563        function test_post_comment_feed() {
    564                 $post_id = $this->factory->post->create();
     564                $post_id = self::$factory->post->create();
    565565                $permalink = get_permalink( $post_id );
    566566
     
    581581        // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&page=$matches[5]',
    582582        function test_post_paged_short() {
    583                 $post_id = $this->factory->post->create( array(
     583                $post_id = self::$factory->post->create( array(
    584584                        'post_date' => '2007-09-04 00:00:00',
    585585                        'post_title' => 'a-post-with-multiple-pages',
     
    594594        // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$' => 'index.php?attachment=$matches[1]',
    595595        function test_post_attachment() {
    596                 $post_id = $this->factory->post->create( array( 'post_type' => 'attachment' ) );
     596                $post_id = self::$factory->post->create( array( 'post_type' => 'attachment' ) );
    597597                $permalink = get_attachment_link( $post_id );
    598598                $this->go_to($permalink);
     
    630630                ) );
    631631
    632                 $tag_id = $this->factory->tag->create( array( 'slug' => 'tag-slug' ) );
    633                 $post_id = $this->factory->post->create( array( 'post_type' => $cpt_name ) );
     632                $tag_id = self::$factory->tag->create( array( 'slug' => 'tag-slug' ) );
     633                $post_id = self::$factory->post->create( array( 'post_type' => $cpt_name ) );
    634634                wp_set_object_terms( $post_id, $tag_id, 'post_tag' );
    635635
     
    664664                        'public' => true
    665665                ) );
    666                 $this->factory->post->create( array( 'post_type' => $cpt_name ) );
     666                self::$factory->post->create( array( 'post_type' => $cpt_name ) );
    667667
    668668                $this->go_to( "/$cpt_name/" );
     
    684684
    685685        function test_is_single() {
    686                 $post_id = $this->factory->post->create();
     686                $post_id = self::$factory->post->create();
    687687                $this->go_to( "/?p=$post_id" );
    688688
     
    715715
    716716                // Create parent and child posts
    717                 $parent_id = $this->factory->post->create( array(
     717                $parent_id = self::$factory->post->create( array(
    718718                        'post_type' => $post_type,
    719719                        'post_name' => 'foo'
    720720                ) );
    721721
    722                 $post_id = $this->factory->post->create( array(
     722                $post_id = self::$factory->post->create( array(
    723723                        'post_type'   => $post_type,
    724724                        'post_name'   => 'bar',
     
    751751         */
    752752        public function test_is_single_with_slug_that_begins_with_a_number_that_clashes_with_another_post_id() {
    753                 $p1 = $this->factory->post->create();
     753                $p1 = self::$factory->post->create();
    754754
    755755                $p2_name = $p1 . '-post';
    756                 $p2 = $this->factory->post->create( array(
     756                $p2 = self::$factory->post->create( array(
    757757                        'slug' => $p2_name,
    758758                ) );
     
    769769
    770770        function test_is_page() {
    771                 $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
     771                $post_id = self::$factory->post->create( array( 'post_type' => 'page' ) );
    772772                $this->go_to( "/?page_id=$post_id" );
    773773
     
    789789         */
    790790        function test_is_page_with_parent() {
    791                 $parent_id = $this->factory->post->create( array(
     791                $parent_id = self::$factory->post->create( array(
    792792                        'post_type' => 'page',
    793793                        'post_name' => 'foo',
    794794                ) );
    795                 $post_id = $this->factory->post->create( array(
     795                $post_id = self::$factory->post->create( array(
    796796                        'post_type'   => 'page',
    797797                        'post_name'   => 'bar',
     
    819819
    820820        function test_is_attachment() {
    821                 $post_id = $this->factory->post->create( array( 'post_type' => 'attachment' ) );
     821                $post_id = self::$factory->post->create( array( 'post_type' => 'attachment' ) );
    822822                $this->go_to( "/?attachment_id=$post_id" );
    823823
     
    840840         */
    841841        public function test_is_attachment_with_slug_that_begins_with_a_number_that_clashes_with_a_page_ID() {
    842                 $p1 = $this->factory->post->create( array( 'post_type' => 'attachment' ) );
     842                $p1 = self::$factory->post->create( array( 'post_type' => 'attachment' ) );
    843843
    844844                $p2_name = $p1 . '-attachment';
    845                 $p2 = $this->factory->post->create( array(
     845                $p2 = self::$factory->post->create( array(
    846846                        'post_type' => 'attachment',
    847847                        'post_name' => $p2_name,
     
    862862         */
    863863        public function test_is_author_with_nicename_that_begins_with_a_number_that_clashes_with_another_author_id() {
    864                 $u1 = $this->factory->user->create();
     864                $u1 = self::$factory->user->create();
    865865
    866866                $u2_name = $u1 . '_user';
    867                 $u2 = $this->factory->user->create( array(
     867                $u2 = self::$factory->user->create( array(
    868868                        'user_nicename' => $u2_name,
    869869                ) );
     
    883883         */
    884884        public function test_is_category_with_slug_that_begins_with_a_number_that_clashes_with_another_category_id() {
    885                 $c1 = $this->factory->category->create();
     885                $c1 = self::$factory->category->create();
    886886
    887887                $c2_name = $c1 . '-category';
    888                 $c2 = $this->factory->category->create( array(
     888                $c2 = self::$factory->category->create( array(
    889889                        'slug' => $c2_name,
    890890                ) );
     
    904904         */
    905905        public function test_is_tag_with_slug_that_begins_with_a_number_that_clashes_with_another_tag_id() {
    906                 $t1 = $this->factory->tag->create();
     906                $t1 = self::$factory->tag->create();
    907907
    908908                $t2_name = $t1 . '-tag';
    909                 $t2 = $this->factory->tag->create( array(
     909                $t2 = self::$factory->tag->create( array(
    910910                        'slug' => $t2_name,
    911911                ) );
     
    925925         */
    926926        public function test_is_page_with_page_id_zero_and_random_page_slug() {
    927                 $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
     927                $post_id = self::$factory->post->create( array( 'post_type' => 'page' ) );
    928928                $this->go_to( "/?page_id=$post_id" );
    929929
     
    947947         */
    948948        public function test_is_page_with_page_slug_that_begins_with_a_number_that_clashes_with_a_page_ID() {
    949                 $p1 = $this->factory->post->create( array( 'post_type' => 'page' ) );
     949                $p1 = self::$factory->post->create( array( 'post_type' => 'page' ) );
    950950
    951951                $p2_name = $p1 . '-page';
    952                 $p2 = $this->factory->post->create( array(
     952                $p2 = self::$factory->post->create( array(
    953953                        'post_type' => 'page',
    954954                        'post_name' => $p2_name,
     
    966966
    967967        function test_is_page_template() {
    968                 $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
     968                $post_id = self::$factory->post->create( array( 'post_type' => 'page' ) );
    969969                update_post_meta($post_id, '_wp_page_template', 'example.php');
    970970                $this->go_to( "/?page_id=$post_id" );
     
    976976         */
    977977        function test_is_page_template_default() {
    978                 $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
     978                $post_id = self::$factory->post->create( array( 'post_type' => 'page' ) );
    979979                $this->go_to( "/?page_id=$post_id" );
    980980                $this->assertTrue( is_page_template( 'default' ) );
     
    986986         */
    987987        function test_is_page_template_array() {
    988                 $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
     988                $post_id = self::$factory->post->create( array( 'post_type' => 'page' ) );
    989989                update_post_meta($post_id, '_wp_page_template', 'example.php');
    990990                $this->go_to( "/?page_id=$post_id" );
  • trunk/tests/phpunit/tests/query/dateQuery.php

    r34989 r35225  
    3434
    3535        public function test_date_query_before_array() {
    36                 $p1 = $this->factory->post->create( array( 'post_date' => '2007-09-24 07:17:23',) );
    37                 $p2 = $this->factory->post->create( array( 'post_date' => '2008-03-29 07:17:23',) );
    38                 $p3 = $this->factory->post->create( array( 'post_date' => '2008-07-15 07:17:23',) );
    39                 $p4 = $this->factory->post->create( array( 'post_date' => '2009-06-11 07:17:23',) );
     36                $p1 = self::$factory->post->create( array( 'post_date' => '2007-09-24 07:17:23',) );
     37                $p2 = self::$factory->post->create( array( 'post_date' => '2008-03-29 07:17:23',) );
     38                $p3 = self::$factory->post->create( array( 'post_date' => '2008-07-15 07:17:23',) );
     39                $p4 = self::$factory->post->create( array( 'post_date' => '2009-06-11 07:17:23',) );
    4040
    4141                $posts = $this->_get_query_result( array(
     
    5858         */
    5959        public function test_date_query_before_array_test_defaulting() {
    60                 $p1 = $this->factory->post->create( array( 'post_date' => '2007-09-24 07:17:23',) );
    61                 $p2 = $this->factory->post->create( array( 'post_date' => '2008-03-29 07:17:23',) );
     60                $p1 = self::$factory->post->create( array( 'post_date' => '2007-09-24 07:17:23',) );
     61                $p2 = self::$factory->post->create( array( 'post_date' => '2008-03-29 07:17:23',) );
    6262
    6363                $posts = $this->_get_query_result( array(
     
    7575
    7676        public function test_date_query_before_string() {
    77                 $p1 = $this->factory->post->create( array( 'post_date' => '2007-09-24 07:17:23',) );
    78                 $p2 = $this->factory->post->create( array( 'post_date' => '2008-03-29 07:17:23',) );
    79                 $p3 = $this->factory->post->create( array( 'post_date' => '2008-07-15 07:17:23',) );
    80                 $p4 = $this->factory->post->create( array( 'post_date' => '2009-06-11 07:17:23',) );
     77                $p1 = self::$factory->post->create( array( 'post_date' => '2007-09-24 07:17:23',) );
     78                $p2 = self::$factory->post->create( array( 'post_date' => '2008-03-29 07:17:23',) );
     79                $p3 = self::$factory->post->create( array( 'post_date' => '2008-07-15 07:17:23',) );
     80                $p4 = self::$factory->post->create( array( 'post_date' => '2009-06-11 07:17:23',) );
    8181
    8282                $posts = $this->_get_query_result( array(
     
    9292
    9393        public function test_date_query_after_array() {
    94                 $p1 = $this->factory->post->create( array( 'post_date' => '2009-10-18 10:42:29', ) );
    95                 $p2 = $this->factory->post->create( array( 'post_date' => '2009-12-18 10:42:29', ) );
    96                 $p3 = $this->factory->post->create( array( 'post_date' => '2010-06-11 07:17:23', ) );
     94                $p1 = self::$factory->post->create( array( 'post_date' => '2009-10-18 10:42:29', ) );
     95                $p2 = self::$factory->post->create( array( 'post_date' => '2009-12-18 10:42:29', ) );
     96                $p3 = self::$factory->post->create( array( 'post_date' => '2010-06-11 07:17:23', ) );
    9797
    9898                $posts = $this->_get_query_result( array(
     
    116116         */
    117117        public function test_date_query_after_array_test_defaulting() {
    118                 $p1 = $this->factory->post->create( array( 'post_date' => '2008-12-18 10:42:29', ) );
    119                 $p2 = $this->factory->post->create( array( 'post_date' => '2009-01-18 10:42:29', ) );
     118                $p1 = self::$factory->post->create( array( 'post_date' => '2008-12-18 10:42:29', ) );
     119                $p2 = self::$factory->post->create( array( 'post_date' => '2009-01-18 10:42:29', ) );
    120120
    121121                $posts = $this->_get_query_result( array(
     
    133133
    134134        public function test_date_query_after_string() {
    135                 $p1 = $this->factory->post->create( array( 'post_date' => '2009-12-18 09:42:29', ) );
    136                 $p2 = $this->factory->post->create( array( 'post_date' => '2009-12-18 10:42:29', ) );
    137                 $p3 = $this->factory->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) );
     135                $p1 = self::$factory->post->create( array( 'post_date' => '2009-12-18 09:42:29', ) );
     136                $p2 = self::$factory->post->create( array( 'post_date' => '2009-12-18 10:42:29', ) );
     137                $p3 = self::$factory->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) );
    138138
    139139                $posts = $this->_get_query_result( array(
     
    149149
    150150        public function test_date_query_after_string_inclusive() {
    151                 $p1 = $this->factory->post->create( array( 'post_date' => '2009-12-18 09:42:29', ) );
    152                 $p2 = $this->factory->post->create( array( 'post_date' => '2009-12-18 10:42:29', ) );
    153                 $p3 = $this->factory->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) );
     151                $p1 = self::$factory->post->create( array( 'post_date' => '2009-12-18 09:42:29', ) );
     152                $p2 = self::$factory->post->create( array( 'post_date' => '2009-12-18 10:42:29', ) );
     153                $p3 = self::$factory->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) );
    154154
    155155                $posts = $this->_get_query_result( array(
     
    169169         */
    170170        public function test_date_query_inclusive_between_dates() {
    171                 $p1 = $this->factory->post->create( array( 'post_date' => '2006-12-18 09:42:29', ) );
    172                 $p2 = $this->factory->post->create( array( 'post_date' => '2007-01-18 10:42:29', ) );
    173                 $p3 = $this->factory->post->create( array( 'post_date' => '2007-12-19 10:42:29', ) );
    174                 $p4 = $this->factory->post->create( array( 'post_date' => '2008-12-19 10:42:29', ) );
    175                 $p5 = $this->factory->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) );
     171                $p1 = self::$factory->post->create( array( 'post_date' => '2006-12-18 09:42:29', ) );
     172                $p2 = self::$factory->post->create( array( 'post_date' => '2007-01-18 10:42:29', ) );
     173                $p3 = self::$factory->post->create( array( 'post_date' => '2007-12-19 10:42:29', ) );
     174                $p4 = self::$factory->post->create( array( 'post_date' => '2008-12-19 10:42:29', ) );
     175                $p5 = self::$factory->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) );
    176176
    177177                $posts = $this->_get_query_result( array(
     
    196196         */
    197197        public function test_beforeafter_with_date_string_Y() {
    198                 $p1 = $this->factory->post->create( array(
     198                $p1 = self::$factory->post->create( array(
    199199                        'post_date' => '2008-05-06 13:00:00',
    200200                ) );
    201                 $p2 = $this->factory->post->create( array(
     201                $p2 = self::$factory->post->create( array(
    202202                        'post_date' => '2007-05-07 13:00:00',
    203203                ) );
     
    229229         */
    230230        public function test_beforeafter_with_date_string_Y_inclusive() {
    231                 $p1 = $this->factory->post->create( array(
     231                $p1 = self::$factory->post->create( array(
    232232                        'post_date' => '2008-05-06 13:00:00',
    233233                ) );
    234                 $p2 = $this->factory->post->create( array(
     234                $p2 = self::$factory->post->create( array(
    235235                        'post_date' => '2007-05-07 13:00:00',
    236236                ) );
     
    264264         */
    265265        public function test_beforeafter_with_date_string_Ym() {
    266                 $p1 = $this->factory->post->create( array(
     266                $p1 = self::$factory->post->create( array(
    267267                        'post_date' => '2008-05-06 13:00:00',
    268268                ) );
    269                 $p2 = $this->factory->post->create( array(
     269                $p2 = self::$factory->post->create( array(
    270270                        'post_date' => '2008-04-07 13:00:00',
    271271                ) );
     
    297297         */
    298298        public function test_beforeafter_with_date_string_Ym_inclusive() {
    299                 $p1 = $this->factory->post->create( array(
     299                $p1 = self::$factory->post->create( array(
    300300                        'post_date' => '2008-05-06 13:00:00',
    301301                ) );
    302                 $p2 = $this->factory->post->create( array(
     302                $p2 = self::$factory->post->create( array(
    303303                        'post_date' => '2008-04-07 13:00:00',
    304304                ) );
     
    332332         */
    333333        public function test_beforeafter_with_date_string_Ymd() {
    334                 $p1 = $this->factory->post->create( array(
     334                $p1 = self::$factory->post->create( array(
    335335                        'post_date' => '2008-05-06 13:00:00',
    336336                ) );
    337                 $p2 = $this->factory->post->create( array(
     337                $p2 = self::$factory->post->create( array(
    338338                        'post_date' => '2008-05-05 13:00:00',
    339339                ) );
     
    365365         */
    366366        public function test_beforeafter_with_date_string_Ymd_inclusive() {
    367                 $p1 = $this->factory->post->create( array(
     367                $p1 = self::$factory->post->create( array(
    368368                        'post_date' => '2008-05-06 13:00:00',
    369369                ) );
    370                 $p2 = $this->factory->post->create( array(
     370                $p2 = self::$factory->post->create( array(
    371371                        'post_date' => '2008-05-05 13:00:00',
    372372                ) );
     
    400400         */
    401401        public function test_beforeafter_with_date_string_YmdHi() {
    402                 $p1 = $this->factory->post->create( array(
     402                $p1 = self::$factory->post->create( array(
    403403                        'post_date' => '2008-05-06 14:05:00',
    404404                ) );
    405                 $p2 = $this->factory->post->create( array(
     405                $p2 = self::$factory->post->create( array(
    406406                        'post_date' => '2008-05-06 14:04:00',
    407407                ) );
     
    433433         */
    434434        public function test_beforeafter_with_date_string_YmdHi_inclusive() {
    435                 $p1 = $this->factory->post->create( array(
     435                $p1 = self::$factory->post->create( array(
    436436                        'post_date' => '2008-05-06 14:05:00',
    437437                ) );
    438                 $p2 = $this->factory->post->create( array(
     438                $p2 = self::$factory->post->create( array(
    439439                        'post_date' => '2008-05-06 14:04:00',
    440440                ) );
     
    468468         */
    469469        public function test_beforeafter_with_date_string_YmdHis() {
    470                 $p1 = $this->factory->post->create( array(
     470                $p1 = self::$factory->post->create( array(
    471471                        'post_date' => '2008-05-06 14:05:15',
    472472                ) );
    473                 $p2 = $this->factory->post->create( array(
     473                $p2 = self::$factory->post->create( array(
    474474                        'post_date' => '2008-05-06 14:05:14',
    475475                ) );
     
    501501         */
    502502        public function test_beforeafter_with_date_string_YmdHis_inclusive() {
    503                 $p1 = $this->factory->post->create( array(
     503                $p1 = self::$factory->post->create( array(
    504504                        'post_date' => '2008-05-06 14:04:15',
    505505                ) );
    506                 $p2 = $this->factory->post->create( array(
     506                $p2 = self::$factory->post->create( array(
    507507                        'post_date' => '2008-05-06 14:04:14',
    508508                ) );
     
    536536         */
    537537        public function test_beforeafter_with_date_string_non_parseable() {
    538                 $p1 = $this->factory->post->create( array(
     538                $p1 = self::$factory->post->create( array(
    539539                        'post_date' => '2008-05-06 14:05:15',
    540540                ) );
    541                 $p2 = $this->factory->post->create( array(
     541                $p2 = self::$factory->post->create( array(
    542542                        'post_date' => '2008-05-06 14:05:14',
    543543                ) );
     
    565565
    566566        public function test_date_query_year() {
    567                 $p1 = $this->factory->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) );
    568                 $p2 = $this->factory->post->create( array( 'post_date' => '2010-12-19 10:42:29', ) );
     567                $p1 = self::$factory->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) );
     568                $p2 = self::$factory->post->create( array( 'post_date' => '2010-12-19 10:42:29', ) );
    569569                $posts = $this->_get_query_result( array(
    570570                        'date_query' => array(
     
    579579
    580580        public function test_date_query_month() {
    581                 $p1 = $this->factory->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) );
    582                 $p2 = $this->factory->post->create( array( 'post_date' => '2010-11-19 10:42:29', ) );
     581                $p1 = self::$factory->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) );
     582                $p2 = self::$factory->post->create( array( 'post_date' => '2010-11-19 10:42:29', ) );
    583583                $posts = $this->_get_query_result( array(
    584584                        'date_query' => array(
     
    593593
    594594        public function test_date_query_week() {
    595                 $p1 = $this->factory->post->create( array( 'post_date' => '2009-01-02 10:42:29', ) );
    596                 $p2 = $this->factory->post->create( array( 'post_date' => '2010-03-19 10:42:29', ) );
     595                $p1 = self::$factory->post->create( array( 'post_date' => '2009-01-02 10:42:29', ) );
     596                $p2 = self::$factory->post->create( array( 'post_date' => '2010-03-19 10:42:29', ) );
    597597                $posts = $this->_get_query_result( array(
    598598                        'date_query' => array(
     
    607607
    608608        public function test_date_query_day() {
    609                 $p1 = $this->factory->post->create( array( 'post_date' => '2009-01-17 10:42:29', ) );
    610                 $p2 = $this->factory->post->create( array( 'post_date' => '2009-01-18 10:42:29', ) );
     609                $p1 = self::$factory->post->create( array( 'post_date' => '2009-01-17 10:42:29', ) );
     610                $p2 = self::$factory->post->create( array( 'post_date' => '2009-01-18 10:42:29', ) );
    611611
    612612                $posts = $this->_get_query_result( array(
     
    622622
    623623        public function test_date_query_dayofweek() {
    624                 $p1 = $this->factory->post->create( array( 'post_date' => '2014-10-21 10:42:29', ) );
    625                 $p2 = $this->factory->post->create( array( 'post_date' => '2014-10-20 10:42:29', ) );
     624                $p1 = self::$factory->post->create( array( 'post_date' => '2014-10-21 10:42:29', ) );
     625                $p2 = self::$factory->post->create( array( 'post_date' => '2014-10-20 10:42:29', ) );
    626626
    627627                $posts = $this->_get_query_result( array(
     
    640640         */
    641641        public function test_date_query_dayofweek_iso() {
    642                 $p1 = $this->factory->post->create( array( 'post_date' => '2014-10-31 10:42:29', ) );
    643                 $p2 = $this->factory->post->create( array( 'post_date' => '2014-10-30 10:42:29', ) );
     642                $p1 = self::$factory->post->create( array( 'post_date' => '2014-10-31 10:42:29', ) );
     643                $p2 = self::$factory->post->create( array( 'post_date' => '2014-10-30 10:42:29', ) );
    644644
    645645                $posts = $this->_get_query_result( array(
     
    655655
    656656        public function test_date_query_hour() {
    657                 $p1 = $this->factory->post->create( array( 'post_date' => '2014-10-21 13:42:29', ) );
    658                 $p2 = $this->factory->post->create( array( 'post_date' => '2014-10-21 12:42:29', ) );
     657                $p1 = self::$factory->post->create( array( 'post_date' => '2014-10-21 13:42:29', ) );
     658                $p2 = self::$factory->post->create( array( 'post_date' => '2014-10-21 12:42:29', ) );
    659659
    660660                $posts = $this->_get_query_result( array(
     
    674674        public function test_date_query_hour_should_not_ignore_0() {
    675675                return;
    676                 $p1 = $this->factory->post->create( array( 'post_date' => '2014-10-21 00:42:29', ) );
    677                 $p2 = $this->factory->post->create( array( 'post_date' => '2014-10-21 01:42:29', ) );
     676                $p1 = self::$factory->post->create( array( 'post_date' => '2014-10-21 00:42:29', ) );
     677                $p2 = self::$factory->post->create( array( 'post_date' => '2014-10-21 01:42:29', ) );
    678678
    679679                $posts = $this->_get_query_result( array(
     
    689689
    690690        public function test_date_query_minute() {
    691                 $p1 = $this->factory->post->create( array( 'post_date' => '2014-10-21 10:56:29', ) );
    692                 $p2 = $this->factory->post->create( array( 'post_date' => '2014-10-21 10:42:29', ) );
     691                $p1 = self::$factory->post->create( array( 'post_date' => '2014-10-21 10:56:29', ) );
     692                $p2 = self::$factory->post->create( array( 'post_date' => '2014-10-21 10:42:29', ) );
    693693
    694694                $posts = $this->_get_query_result( array(
     
    704704
    705705        public function test_date_query_second() {
    706                 $p1 = $this->factory->post->create( array( 'post_date' => '2014-10-21 10:42:21', ) );
    707                 $p2 = $this->factory->post->create( array( 'post_date' => '2014-10-21 10:42:29', ) );
     706                $p1 = self::$factory->post->create( array( 'post_date' => '2014-10-21 10:42:21', ) );
     707                $p2 = self::$factory->post->create( array( 'post_date' => '2014-10-21 10:42:29', ) );
    708708
    709709                $posts = $this->_get_query_result( array(
     
    719719
    720720        public function test_date_query_between_two_times() {
    721                 $p1 = $this->factory->post->create( array( 'post_date' => '2005-12-18 08:42:29', ) );
    722                 $p2 = $this->factory->post->create( array( 'post_date' => '2006-12-18 09:00:29', ) );
    723                 $p3 = $this->factory->post->create( array( 'post_date' => '2007-12-18 10:42:29', ) );
    724                 $p4 = $this->factory->post->create( array( 'post_date' => '2008-12-18 17:00:29', ) );
    725                 $p5 = $this->factory->post->create( array( 'post_date' => '2009-12-18 18:42:29', ) );
     721                $p1 = self::$factory->post->create( array( 'post_date' => '2005-12-18 08:42:29', ) );
     722                $p2 = self::$factory->post->create( array( 'post_date' => '2006-12-18 09:00:29', ) );
     723                $p3 = self::$factory->post->create( array( 'post_date' => '2007-12-18 10:42:29', ) );
     724                $p4 = self::$factory->post->create( array( 'post_date' => '2008-12-18 17:00:29', ) );
     725                $p5 = self::$factory->post->create( array( 'post_date' => '2009-12-18 18:42:29', ) );
    726726
    727727                $posts = $this->_get_query_result( array(
     
    744744
    745745        public function test_date_query_relation_or() {
    746                 $p1 = $this->factory->post->create( array( 'post_date' => '2006-12-18 14:42:29', ) );
    747                 $p2 = $this->factory->post->create( array( 'post_date' => '2007-01-18 10:42:29', ) );
    748                 $p3 = $this->factory->post->create( array( 'post_date' => '2007-12-19 10:34:29', ) );
     746                $p1 = self::$factory->post->create( array( 'post_date' => '2006-12-18 14:42:29', ) );
     747                $p2 = self::$factory->post->create( array( 'post_date' => '2007-01-18 10:42:29', ) );
     748                $p3 = self::$factory->post->create( array( 'post_date' => '2007-12-19 10:34:29', ) );
    749749
    750750                $posts = $this->_get_query_result( array(
     
    764764
    765765        public function test_date_query_compare_greater_than_or_equal_to() {
    766                 $p1 = $this->factory->post->create( array( 'post_date' => '2006-12-18 13:42:29', ) );
    767                 $p2 = $this->factory->post->create( array( 'post_date' => '2007-01-18 14:34:29', ) );
    768                 $p3 = $this->factory->post->create( array( 'post_date' => '2007-12-19 14:37:29', ) );
    769                 $p4 = $this->factory->post->create( array( 'post_date' => '2007-12-19 15:34:29', ) );
     766                $p1 = self::$factory->post->create( array( 'post_date' => '2006-12-18 13:42:29', ) );
     767                $p2 = self::$factory->post->create( array( 'post_date' => '2007-01-18 14:34:29', ) );
     768                $p3 = self::$factory->post->create( array( 'post_date' => '2007-12-19 14:37:29', ) );
     769                $p4 = self::$factory->post->create( array( 'post_date' => '2007-12-19 15:34:29', ) );
    770770
    771771                $posts = $this->_get_query_result( array(
     
    785785                global $wpdb;
    786786
    787                 $p1 = $this->factory->post->create( array( 'post_date' => '2006-05-18 13:42:29', ) );
    788                 $p2 = $this->factory->post->create( array( 'post_date' => '2007-09-18 14:34:29', ) );
    789                 $p3 = $this->factory->post->create( array( 'post_date' => '2007-01-18 14:34:29', ) );
     787                $p1 = self::$factory->post->create( array( 'post_date' => '2006-05-18 13:42:29', ) );
     788                $p2 = self::$factory->post->create( array( 'post_date' => '2007-09-18 14:34:29', ) );
     789                $p3 = self::$factory->post->create( array( 'post_date' => '2007-01-18 14:34:29', ) );
    790790
    791791                $posts = $this->_get_query_result( array(
     
    805805                global $wpdb;
    806806
    807                 $p1 = $this->factory->post->create( array( 'post_date' => '2014-10-01 13:42:29', ) );
    808                 $p2 = $this->factory->post->create( array( 'post_date' => '2014-10-22 14:34:29', ) );
    809                 $p3 = $this->factory->post->create( array( 'post_date' => '2014-10-15 14:34:29', ) );
     807                $p1 = self::$factory->post->create( array( 'post_date' => '2014-10-01 13:42:29', ) );
     808                $p2 = self::$factory->post->create( array( 'post_date' => '2014-10-22 14:34:29', ) );
     809                $p3 = self::$factory->post->create( array( 'post_date' => '2014-10-15 14:34:29', ) );
    810810
    811811                $posts = $this->_get_query_result( array(
     
    826826         */
    827827        public function test_date_query_with_taxonomy_join() {
    828                 $p1 = $this->factory->post->create( array(
     828                $p1 = self::$factory->post->create( array(
    829829                        'post_date' => '2013-04-27 01:01:01',
    830830                ) );
    831                 $p2 = $this->factory->post->create( array(
     831                $p2 = self::$factory->post->create( array(
    832832                        'post_date' => '2013-03-21 01:01:01',
    833833                ) );
     
    858858         */
    859859        public function test_date_query_one_nested_query() {
    860                 $p1 = $this->factory->post->create( array( 'post_date' => '2004-10-01 13:42:29', ) );
    861                 $p2 = $this->factory->post->create( array( 'post_date' => '2004-01-22 14:34:29', ) );
    862                 $p3 = $this->factory->post->create( array( 'post_date' => '1984-10-15 14:34:29', ) );
    863                 $p4 = $this->factory->post->create( array( 'post_date' => '1985-10-15 14:34:29', ) );
     860                $p1 = self::$factory->post->create( array( 'post_date' => '2004-10-01 13:42:29', ) );
     861                $p2 = self::$factory->post->create( array( 'post_date' => '2004-01-22 14:34:29', ) );
     862                $p3 = self::$factory->post->create( array( 'post_date' => '1984-10-15 14:34:29', ) );
     863                $p4 = self::$factory->post->create( array( 'post_date' => '1985-10-15 14:34:29', ) );
    864864                $posts = $this->_get_query_result( array(
    865865                        'date_query' => array(
     
    887887         */
    888888        public function test_date_query_one_nested_query_multiple_columns_relation_and() {
    889                 $p1 = $this->factory->post->create( array(
     889                $p1 = self::$factory->post->create( array(
    890890                        'post_date' => '2012-03-05 15:30:55',
    891891                ) );
    892892                $this->update_post_modified( $p1, '2014-11-03 14:43:00' );
    893893
    894                 $p2 = $this->factory->post->create( array(
     894                $p2 = self::$factory->post->create( array(
    895895                        'post_date' => '2012-05-05 15:30:55',
    896896                ) );
    897897                $this->update_post_modified( $p2, '2014-10-03 14:43:00' );
    898898
    899                 $p3 = $this->factory->post->create( array(
     899                $p3 = self::$factory->post->create( array(
    900900                        'post_date' => '2013-05-05 15:30:55',
    901901                ) );
    902902                $this->update_post_modified( $p3, '2014-10-03 14:43:00' );
    903903
    904                 $p4 = $this->factory->post->create( array(
     904                $p4 = self::$factory->post->create( array(
    905905                        'post_date' => '2012-02-05 15:30:55',
    906906                ) );
     
    938938         */
    939939        public function test_date_query_nested_query_multiple_columns_mixed_relations() {
    940                 $p1 = $this->factory->post->create( array(
     940                $p1 = self::$factory->post->create( array(
    941941                        'post_date' => '2012-03-05 15:30:55',
    942942                ) );
    943943                $this->update_post_modified( $p1, '2014-11-03 14:43:00' );
    944944
    945                 $p2 = $this->factory->post->create( array(
     945                $p2 = self::$factory->post->create( array(
    946946                        'post_date' => '2012-05-05 15:30:55',
    947947                ) );
    948948                $this->update_post_modified( $p2, '2014-10-03 14:43:00' );
    949949
    950                 $p3 = $this->factory->post->create( array(
     950                $p3 = self::$factory->post->create( array(
    951951                        'post_date' => '2013-05-05 15:30:55',
    952952                ) );
    953953                $this->update_post_modified( $p3, '2014-10-03 14:43:00' );
    954954
    955                 $p4 = $this->factory->post->create( array(
     955                $p4 = self::$factory->post->create( array(
    956956                        'post_date' => '2012-02-05 15:30:55',
    957957                ) );
    958958                $this->update_post_modified( $p4, '2012-12-03 14:43:00' );
    959959
    960                 $p5 = $this->factory->post->create( array(
     960                $p5 = self::$factory->post->create( array(
    961961                        'post_date' => '2014-02-05 15:30:55',
    962962                ) );
  • trunk/tests/phpunit/tests/query/isTerm.php

    r34810 r35225  
    3838                flush_rewrite_rules();
    3939
    40                 $this->tag_id = $this->factory->tag->create( array( 'slug' => 'tag-slug' ) );
    41                 $this->cat_id = $this->factory->category->create( array( 'slug' => 'cat-slug' ) );
    42                 $this->tax_id = $this->factory->term->create( array( 'taxonomy' => 'testtax', 'slug' => 'tax-slug' ) );
    43                 $this->tax_id2 = $this->factory->term->create( array( 'taxonomy' => 'testtax', 'slug' => 'tax-slug2' ) );
    44                 $this->post_id = $this->factory->post->create();
     40                $this->tag_id = self::$factory->tag->create( array( 'slug' => 'tag-slug' ) );
     41                $this->cat_id = self::$factory->category->create( array( 'slug' => 'cat-slug' ) );
     42                $this->tax_id = self::$factory->term->create( array( 'taxonomy' => 'testtax', 'slug' => 'tax-slug' ) );
     43                $this->tax_id2 = self::$factory->term->create( array( 'taxonomy' => 'testtax', 'slug' => 'tax-slug2' ) );
     44                $this->post_id = self::$factory->post->create();
    4545                wp_set_object_terms( $this->post_id, $this->cat_id, 'category' );
    4646                wp_set_object_terms( $this->post_id, array( $this->tax_id, $this->tax_id2 ), 'testtax' );
     
    246246
    247247                register_taxonomy( 'testtax2', 'post' );
    248                 $testtax2_term_id = $this->factory->term->create( array(
     248                $testtax2_term_id = self::$factory->term->create( array(
    249249                        'taxonomy' => 'testtax2',
    250250                        'slug' => 'testtax2-slug',
  • trunk/tests/phpunit/tests/query/metaQuery.php

    r31666 r35225  
    77class Tests_Query_MetaQuery extends WP_UnitTestCase {
    88        public function test_meta_query_no_key() {
    9                 $p1 = $this->factory->post->create();
    10                 $p2 = $this->factory->post->create();
    11                 $p3 = $this->factory->post->create();
     9                $p1 = self::$factory->post->create();
     10                $p2 = self::$factory->post->create();
     11                $p3 = self::$factory->post->create();
    1212
    1313                add_post_meta( $p1, 'foo', 'bar' );
     
    3131
    3232        public function test_meta_query_no_value() {
    33                 $p1 = $this->factory->post->create();
    34                 $p2 = $this->factory->post->create();
    35                 $p3 = $this->factory->post->create();
     33                $p1 = self::$factory->post->create();
     34                $p2 = self::$factory->post->create();
     35                $p3 = self::$factory->post->create();
    3636
    3737                add_post_meta( $p1, 'foo', 'bar' );
     
    5555
    5656        public function test_meta_query_single_query_compare_default() {
    57                 $p1 = $this->factory->post->create();
    58                 $p2 = $this->factory->post->create();
     57                $p1 = self::$factory->post->create();
     58                $p2 = self::$factory->post->create();
    5959
    6060                add_post_meta( $p1, 'foo', 'bar' );
     
    7777
    7878        public function test_meta_query_single_query_compare_equals() {
    79                 $p1 = $this->factory->post->create();
    80                 $p2 = $this->factory->post->create();
     79                $p1 = self::$factory->post->create();
     80                $p2 = self::$factory->post->create();
    8181
    8282                add_post_meta( $p1, 'foo', 'bar' );
     
    100100
    101101        public function test_meta_query_single_query_compare_not_equals() {
    102                 $p1 = $this->factory->post->create();
    103                 $p2 = $this->factory->post->create();
    104                 $p3 = $this->factory->post->create();
     102                $p1 = self::$factory->post->create();
     103                $p2 = self::$factory->post->create();
     104                $p3 = self::$factory->post->create();
    105105
    106106                add_post_meta( $p1, 'foo', 'bar' );
     
    125125
    126126        public function test_meta_query_single_query_compare_arithmetic_comparisons() {
    127                 $p1 = $this->factory->post->create();
    128                 $p2 = $this->factory->post->create();
    129                 $p3 = $this->factory->post->create();
     127                $p1 = self::$factory->post->create();
     128                $p2 = self::$factory->post->create();
     129                $p3 = self::$factory->post->create();
    130130
    131131                add_post_meta( $p1, 'foo', '1' );
     
    203203
    204204        public function test_meta_query_single_query_compare_like() {
    205                 $p1 = $this->factory->post->create();
    206                 $p2 = $this->factory->post->create();
     205                $p1 = self::$factory->post->create();
     206                $p2 = self::$factory->post->create();
    207207
    208208                add_post_meta( $p1, 'foo', 'bar' );
     
    226226
    227227        public function test_meta_query_single_query_compare_not_like() {
    228                 $p1 = $this->factory->post->create();
    229                 $p2 = $this->factory->post->create();
    230                 $p3 = $this->factory->post->create();
     228                $p1 = self::$factory->post->create();
     229                $p2 = self::$factory->post->create();
     230                $p3 = self::$factory->post->create();
    231231
    232232                add_post_meta( $p1, 'foo', 'bar' );
     
    251251
    252252        public function test_meta_query_single_query_compare_between_not_between() {
    253                 $p1 = $this->factory->post->create();
    254                 $p2 = $this->factory->post->create();
    255                 $p3 = $this->factory->post->create();
     253                $p1 = self::$factory->post->create();
     254                $p2 = self::$factory->post->create();
     255                $p3 = self::$factory->post->create();
    256256
    257257                add_post_meta( $p1, 'foo', '1' );
     
    295295
    296296        public function test_meta_query_single_query_compare_regexp_rlike() {
    297                 $p1 = $this->factory->post->create();
    298                 $p2 = $this->factory->post->create();
     297                $p1 = self::$factory->post->create();
     298                $p2 = self::$factory->post->create();
    299299
    300300                add_post_meta( $p1, 'foo', 'bar' );
     
    336336
    337337        public function test_meta_query_single_query_compare_not_regexp() {
    338                 $p1 = $this->factory->post->create();
    339                 $p2 = $this->factory->post->create();
     338                $p1 = self::$factory->post->create();
     339                $p2 = self::$factory->post->create();
    340340
    341341                add_post_meta( $p1, 'foo', 'bar' );
     
    360360
    361361        public function test_meta_query_relation_default() {
    362                 $p1 = $this->factory->post->create();
    363                 $p2 = $this->factory->post->create();
    364                 $p3 = $this->factory->post->create();
     362                $p1 = self::$factory->post->create();
     363                $p2 = self::$factory->post->create();
     364                $p3 = self::$factory->post->create();
    365365
    366366                add_post_meta( $p1, 'foo', 'foo value 1' );
     
    390390
    391391        public function test_meta_query_relation_or() {
    392                 $post_id = $this->factory->post->create();
     392                $post_id = self::$factory->post->create();
    393393                add_post_meta( $post_id, 'foo', rand_str() );
    394394                add_post_meta( $post_id, 'foo', rand_str() );
    395                 $post_id2 = $this->factory->post->create();
     395                $post_id2 = self::$factory->post->create();
    396396                add_post_meta( $post_id2, 'bar', 'val2' );
    397                 $post_id3 = $this->factory->post->create();
     397                $post_id3 = self::$factory->post->create();
    398398                add_post_meta( $post_id3, 'baz', rand_str() );
    399                 $post_id4 = $this->factory->post->create();
     399                $post_id4 = self::$factory->post->create();
    400400                add_post_meta( $post_id4, 'froo', rand_str() );
    401                 $post_id5 = $this->factory->post->create();
     401                $post_id5 = self::$factory->post->create();
    402402                add_post_meta( $post_id5, 'tango', 'val2' );
    403                 $post_id6 = $this->factory->post->create();
     403                $post_id6 = self::$factory->post->create();
    404404                add_post_meta( $post_id6, 'bar', 'val1' );
    405405
     
    431431
    432432        public function test_meta_query_relation_and() {
    433                 $post_id = $this->factory->post->create();
     433                $post_id = self::$factory->post->create();
    434434                add_post_meta( $post_id, 'foo', rand_str() );
    435435                add_post_meta( $post_id, 'foo', rand_str() );
    436                 $post_id2 = $this->factory->post->create();
     436                $post_id2 = self::$factory->post->create();
    437437                add_post_meta( $post_id2, 'bar', 'val2' );
    438438                add_post_meta( $post_id2, 'foo', rand_str() );
    439                 $post_id3 = $this->factory->post->create();
     439                $post_id3 = self::$factory->post->create();
    440440                add_post_meta( $post_id3, 'baz', rand_str() );
    441                 $post_id4 = $this->factory->post->create();
     441                $post_id4 = self::$factory->post->create();
    442442                add_post_meta( $post_id4, 'froo', rand_str() );
    443                 $post_id5 = $this->factory->post->create();
     443                $post_id5 = self::$factory->post->create();
    444444                add_post_meta( $post_id5, 'tango', 'val2' );
    445                 $post_id6 = $this->factory->post->create();
     445                $post_id6 = self::$factory->post->create();
    446446                add_post_meta( $post_id6, 'bar', 'val1' );
    447447                add_post_meta( $post_id6, 'foo', rand_str() );
    448                 $post_id7 = $this->factory->post->create();
     448                $post_id7 = self::$factory->post->create();
    449449                add_post_meta( $post_id7, 'foo', rand_str() );
    450450                add_post_meta( $post_id7, 'froo', rand_str() );
     
    500500         */
    501501        public function test_meta_query_compare_exists() {
    502                 $posts = $this->factory->post->create_many( 3 );
     502                $posts = self::$factory->post->create_many( 3 );
    503503                add_post_meta( $posts[0], 'foo', 'bar' );
    504504                add_post_meta( $posts[2], 'foo', 'baz' );
     
    521521         */
    522522        public function test_meta_query_compare_exists_with_value_should_convert_to_equals() {
    523                 $posts = $this->factory->post->create_many( 3 );
     523                $posts = self::$factory->post->create_many( 3 );
    524524                add_post_meta( $posts[0], 'foo', 'bar' );
    525525                add_post_meta( $posts[2], 'foo', 'baz' );
     
    543543         */
    544544        public function test_meta_query_compare_not_exists_should_ignore_value() {
    545                 $posts = $this->factory->post->create_many( 3 );
     545                $posts = self::$factory->post->create_many( 3 );
    546546                add_post_meta( $posts[0], 'foo', 'bar' );
    547547                add_post_meta( $posts[2], 'foo', 'baz' );
     
    565565         */
    566566        public function test_meta_query_compare_not_exists() {
    567                 $post_id = $this->factory->post->create();
     567                $post_id = self::$factory->post->create();
    568568                add_post_meta( $post_id, 'foo', rand_str() );
    569                 $post_id2 = $this->factory->post->create();
     569                $post_id2 = self::$factory->post->create();
    570570                add_post_meta( $post_id2, 'bar', rand_str() );
    571                 $post_id3 = $this->factory->post->create();
     571                $post_id3 = self::$factory->post->create();
    572572                add_post_meta( $post_id3, 'bar', rand_str() );
    573                 $post_id4 = $this->factory->post->create();
     573                $post_id4 = self::$factory->post->create();
    574574                add_post_meta( $post_id4, 'baz', rand_str() );
    575                 $post_id5 = $this->factory->post->create();
     575                $post_id5 = self::$factory->post->create();
    576576                add_post_meta( $post_id5, 'foo', rand_str() );
    577577
     
    637637         */
    638638        public function test_meta_query_compare_not_exists_with_another_condition_relation_or() {
    639                 $posts = $this->factory->post->create_many( 4 );
     639                $posts = self::$factory->post->create_many( 4 );
    640640                update_post_meta( $posts[0], 'color', 'orange' );
    641641                update_post_meta( $posts[1], 'color', 'blue' );
     
    673673         */
    674674        public function test_meta_query_relation_or_compare_equals() {
    675                 $posts = $this->factory->post->create_many( 4 );
     675                $posts = self::$factory->post->create_many( 4 );
    676676                add_post_meta( $posts[0], 'color', 'orange' );
    677677                add_post_meta( $posts[1], 'color', 'blue' );
     
    706706         */
    707707        public function test_meta_query_relation_or_compare_equals_different_keys() {
    708                 $posts = $this->factory->post->create_many( 4 );
     708                $posts = self::$factory->post->create_many( 4 );
    709709                add_post_meta( $posts[0], 'color', 'orange' );
    710710                add_post_meta( $posts[1], 'color', 'blue' );
     
    739739         */
    740740        public function test_meta_query_relation_or_compare_equals_and_in() {
    741                 $posts = $this->factory->post->create_many( 4 );
     741                $posts = self::$factory->post->create_many( 4 );
    742742                add_post_meta( $posts[0], 'color', 'orange' );
    743743                add_post_meta( $posts[1], 'color', 'blue' );
     
    772772         */
    773773        public function test_meta_query_relation_or_compare_equals_and_like() {
    774                 $posts = $this->factory->post->create_many( 4 );
     774                $posts = self::$factory->post->create_many( 4 );
    775775                add_post_meta( $posts[0], 'color', 'orange' );
    776776                add_post_meta( $posts[1], 'color', 'blue' );
     
    805805         */
    806806        public function test_meta_query_relation_or_compare_equals_and_between() {
    807                 $posts = $this->factory->post->create_many( 4 );
     807                $posts = self::$factory->post->create_many( 4 );
    808808                add_post_meta( $posts[0], 'number_of_colors', '2' );
    809809                add_post_meta( $posts[1], 'number_of_colors', '5' );
     
    839839         */
    840840        public function test_meta_query_relation_and_compare_in_same_keys() {
    841                 $posts = $this->factory->post->create_many( 4 );
     841                $posts = self::$factory->post->create_many( 4 );
    842842                add_post_meta( $posts[0], 'color', 'orange' );
    843843                add_post_meta( $posts[1], 'color', 'blue' );
     
    874874         */
    875875        public function test_meta_query_relation_and_compare_in_different_keys() {
    876                 $posts = $this->factory->post->create_many( 4 );
     876                $posts = self::$factory->post->create_many( 4 );
    877877                add_post_meta( $posts[0], 'color', 'orange' );
    878878                add_post_meta( $posts[1], 'color', 'blue' );
     
    909909         */
    910910        public function test_meta_query_relation_and_compare_not_equals() {
    911                 $posts = $this->factory->post->create_many( 4 );
     911                $posts = self::$factory->post->create_many( 4 );
    912912                add_post_meta( $posts[0], 'color', 'orange' );
    913913                add_post_meta( $posts[1], 'color', 'blue' );
     
    943943         */
    944944        public function test_meta_query_relation_and_compare_not_equals_different_keys() {
    945                 $posts = $this->factory->post->create_many( 4 );
     945                $posts = self::$factory->post->create_many( 4 );
    946946
    947947                // !shallot, but orange.
     
    984984         */
    985985        public function test_meta_query_relation_and_compare_not_equals_not_in() {
    986                 $posts = $this->factory->post->create_many( 4 );
     986                $posts = self::$factory->post->create_many( 4 );
    987987                add_post_meta( $posts[0], 'color', 'orange' );
    988988                add_post_meta( $posts[1], 'color', 'blue' );
     
    10181018         */
    10191019        public function test_meta_query_relation_and_compare_not_equals_and_not_like() {
    1020                 $posts = $this->factory->post->create_many( 4 );
     1020                $posts = self::$factory->post->create_many( 4 );
    10211021                add_post_meta( $posts[0], 'color', 'orange' );
    10221022                add_post_meta( $posts[1], 'color', 'blue' );
     
    10521052         */
    10531053        public function test_meta_query_decimal_results() {
    1054                 $post_1 = $this->factory->post->create();
    1055                 $post_2 = $this->factory->post->create();
    1056                 $post_3 = $this->factory->post->create();
    1057                 $post_4 = $this->factory->post->create();
     1054                $post_1 = self::$factory->post->create();
     1055                $post_2 = self::$factory->post->create();
     1056                $post_3 = self::$factory->post->create();
     1057                $post_4 = self::$factory->post->create();
    10581058
    10591059                update_post_meta( $post_1, 'decimal_value', '-0.3' );
     
    12271227         */
    12281228        public function test_meta_query_with_orderby_meta_value_relation_or() {
    1229                 $posts = $this->factory->post->create_many( 4 );
     1229                $posts = self::$factory->post->create_many( 4 );
    12301230                update_post_meta( $posts[0], 'foo', 5 );
    12311231                update_post_meta( $posts[1], 'foo', 6 );
     
    12661266         */
    12671267        public function test_meta_query_with_orderby_meta_value_relation_and() {
    1268                 $posts = $this->factory->post->create_many( 4 );
     1268                $posts = self::$factory->post->create_many( 4 );
    12691269                update_post_meta( $posts[0], 'foo', 5 );
    12701270                update_post_meta( $posts[1], 'foo', 6 );
     
    13091309         */
    13101310        public function test_meta_query_nested() {
    1311                 $p1 = $this->factory->post->create();
    1312                 $p2 = $this->factory->post->create();
    1313                 $p3 = $this->factory->post->create();
     1311                $p1 = self::$factory->post->create();
     1312                $p2 = self::$factory->post->create();
     1313                $p3 = self::$factory->post->create();
    13141314
    13151315                add_post_meta( $p1, 'foo', 'bar' );
     
    13501350         */
    13511351        public function test_meta_query_nested_two_levels_deep() {
    1352                 $p1 = $this->factory->post->create();
    1353                 $p2 = $this->factory->post->create();
    1354                 $p3 = $this->factory->post->create();
     1352                $p1 = self::$factory->post->create();
     1353                $p2 = self::$factory->post->create();
     1354                $p3 = self::$factory->post->create();
    13551355
    13561356                add_post_meta( $p1, 'foo', 'bar' );
     
    13951395
    13961396        public function test_meta_between_not_between() {
    1397                 $post_id = $this->factory->post->create();
     1397                $post_id = self::$factory->post->create();
    13981398                add_post_meta( $post_id, 'time', 500 );
    1399                 $post_id2 = $this->factory->post->create();
     1399                $post_id2 = self::$factory->post->create();
    14001400                add_post_meta( $post_id2, 'time', 1001 );
    1401                 $post_id3 = $this->factory->post->create();
     1401                $post_id3 = self::$factory->post->create();
    14021402                add_post_meta( $post_id3, 'time', 0 );
    1403                 $post_id4 = $this->factory->post->create();
     1403                $post_id4 = self::$factory->post->create();
    14041404                add_post_meta( $post_id4, 'time', 1 );
    1405                 $post_id5 = $this->factory->post->create();
     1405                $post_id5 = self::$factory->post->create();
    14061406                add_post_meta( $post_id5, 'time', 1000 );
    14071407
     
    14441444        public function test_meta_default_compare() {
    14451445                // compare should default to IN when meta_value is an array
    1446                 $post_id = $this->factory->post->create();
     1446                $post_id = self::$factory->post->create();
    14471447                add_post_meta( $post_id, 'foo', 'bar' );
    1448                 $post_id2 = $this->factory->post->create();
     1448                $post_id2 = self::$factory->post->create();
    14491449                add_post_meta( $post_id2, 'bar', 'baz' );
    1450                 $post_id3 = $this->factory->post->create();
     1450                $post_id3 = self::$factory->post->create();
    14511451                add_post_meta( $post_id3, 'foo', 'baz' );
    1452                 $post_id4 = $this->factory->post->create();
     1452                $post_id4 = self::$factory->post->create();
    14531453                add_post_meta( $post_id4, 'baz', 'bar' );
    1454                 $post_id5 = $this->factory->post->create();
     1454                $post_id5 = self::$factory->post->create();
    14551455                add_post_meta( $post_id5, 'foo', rand_str() );
    14561456
     
    14831483         */
    14841484        public function test_duplicate_posts_when_no_key() {
    1485                 $post_id = $this->factory->post->create();
     1485                $post_id = self::$factory->post->create();
    14861486                add_post_meta( $post_id, 'city', 'Lorem' );
    14871487                add_post_meta( $post_id, 'address', '123 Lorem St.' );
    1488                 $post_id2 = $this->factory->post->create();
     1488                $post_id2 = self::$factory->post->create();
    14891489                add_post_meta( $post_id2, 'city', 'Lorem' );
    1490                 $post_id3 = $this->factory->post->create();
     1490                $post_id3 = self::$factory->post->create();
    14911491                add_post_meta( $post_id3, 'city', 'Loren' );
    14921492
     
    15141514         */
    15151515        public function test_empty_meta_value() {
    1516                 $post_id = $this->factory->post->create();
     1516                $post_id = self::$factory->post->create();
    15171517                add_post_meta( $post_id, 'foo', '0' );
    15181518                add_post_meta( $post_id, 'bar', 0 );
    1519                 $post_id2 = $this->factory->post->create();
     1519                $post_id2 = self::$factory->post->create();
    15201520                add_post_meta( $post_id2, 'foo', 1 );
    1521                 $post_id3 = $this->factory->post->create();
     1521                $post_id3 = self::$factory->post->create();
    15221522                add_post_meta( $post_id3, 'baz', 0 );
    1523                 $post_id4 = $this->factory->post->create();
     1523                $post_id4 = self::$factory->post->create();
    15241524                add_post_meta( $post_id4, 'baz', 0 );
    1525                 $post_id5 = $this->factory->post->create();
     1525                $post_id5 = self::$factory->post->create();
    15261526                add_post_meta( $post_id5, 'baz', 0 );
    15271527                add_post_meta( $post_id5, 'bar', '0' );
    1528                 $post_id6 = $this->factory->post->create();
     1528                $post_id6 = self::$factory->post->create();
    15291529                add_post_meta( $post_id6, 'baz', 0 );
    15301530
     
    15781578         */
    15791579        public function test_orderby_clause_key() {
    1580                 $posts = $this->factory->post->create_many( 3 );
     1580                $posts = self::$factory->post->create_many( 3 );
    15811581                add_post_meta( $posts[0], 'foo', 'aaa' );
    15821582                add_post_meta( $posts[1], 'foo', 'zzz' );
     
    16021602         */
    16031603        public function test_orderby_clause_key_as_secondary_sort() {
    1604                 $p1 = $this->factory->post->create( array(
     1604                $p1 = self::$factory->post->create( array(
    16051605                        'post_date' => '2015-01-28 03:00:00',
    16061606                ) );
    1607                 $p2 = $this->factory->post->create( array(
     1607                $p2 = self::$factory->post->create( array(
    16081608                        'post_date' => '2015-01-28 05:00:00',
    16091609                ) );
    1610                 $p3 = $this->factory->post->create( array(
     1610                $p3 = self::$factory->post->create( array(
    16111611                        'post_date' => '2015-01-28 03:00:00',
    16121612                ) );
     
    16371637         */
    16381638        public function test_orderby_more_than_one_clause_key() {
    1639                 $posts = $this->factory->post->create_many( 3 );
     1639                $posts = self::$factory->post->create_many( 3 );
    16401640
    16411641                add_post_meta( $posts[0], 'foo', 'jjj' );
  • trunk/tests/phpunit/tests/query/postStatus.php

    r35224 r35225  
    212212                register_post_type( 'foo_pt' );
    213213                register_post_status( 'foo_ps', array( 'public' => false ) );
    214                 $p = $this->factory->post->create( array( 'post_status' => 'foo_ps' ) );
     214                $p = self::$factory->post->create( array( 'post_status' => 'foo_ps' ) );
    215215
    216216                $q = new WP_Query( array(
     
    224224                register_post_type( 'foo_pt' );
    225225                register_post_status( 'foo_ps', array( 'public' => false, 'protected' => true ) );
    226                 $p = $this->factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$editor_user_id ) );
     226                $p = self::$factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$editor_user_id ) );
    227227
    228228                wp_set_current_user( self::$author_user_id );
     
    238238                register_post_type( 'foo_pt' );
    239239                register_post_status( 'foo_ps', array( 'public' => false, 'protected' => true ) );
    240                 $p = $this->factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$author_user_id ) );
     240                $p = self::$factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$author_user_id ) );
    241241
    242242                wp_set_current_user( self::$editor_user_id );
     
    252252                register_post_type( 'foo_pt' );
    253253                register_post_status( 'foo_ps', array( 'public' => false, 'private' => true ) );
    254                 $p = $this->factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$editor_user_id ) );
     254                $p = self::$factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$editor_user_id ) );
    255255
    256256                wp_set_current_user( self::$author_user_id );
     
    266266                register_post_type( 'foo_pt' );
    267267                register_post_status( 'foo_ps', array( 'public' => false, 'private' => true ) );
    268                 $p = $this->factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$author_user_id ) );
     268                $p = self::$factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$author_user_id ) );
    269269
    270270                wp_set_current_user( self::$editor_user_id );
     
    280280                register_post_type( 'foo_pt' );
    281281                register_post_status( 'foo_ps', array( 'public' => false ) );
    282                 $p = $this->factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$author_user_id ) );
     282                $p = self::$factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$author_user_id ) );
    283283
    284284                wp_set_current_user( self::$editor_user_id );
     
    295295         */
    296296        public function test_specific_post_should_be_returned_if_trash_is_one_of_the_requested_post_statuses() {
    297                 $p1 = $this->factory->post->create( array( 'post_status' => 'trash' ) );
    298                 $p2 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
     297                $p1 = self::$factory->post->create( array( 'post_status' => 'trash' ) );
     298                $p2 = self::$factory->post->create( array( 'post_status' => 'publish' ) );
    299299
    300300                $q = new WP_Query( array(
  • trunk/tests/phpunit/tests/query/results.php

    r35186 r35225  
    457457         */
    458458        function test_query_author_vars() {
    459                 $author_1 = $this->factory->user->create( array( 'user_login' => 'admin1', 'user_pass' => rand_str(), 'role' => 'author' ) );
    460                 $post_1 = $this->factory->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_1, 'post_date' => '2007-01-01 00:00:00' ) );
    461 
    462                 $author_2 = $this->factory->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) );
    463                 $post_2 = $this->factory->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_2, 'post_date' => '2007-01-01 00:00:00' ) );
    464 
    465                 $author_3 = $this->factory->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) );
    466                 $post_3 = $this->factory->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_3, 'post_date' => '2007-01-01 00:00:00' ) );
    467 
    468                 $author_4 = $this->factory->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) );
    469                 $post_4 = $this->factory->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_4, 'post_date' => '2007-01-01 00:00:00' ) );
     459                $author_1 = self::$factory->user->create( array( 'user_login' => 'admin1', 'user_pass' => rand_str(), 'role' => 'author' ) );
     460                $post_1 = self::$factory->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_1, 'post_date' => '2007-01-01 00:00:00' ) );
     461
     462                $author_2 = self::$factory->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) );
     463                $post_2 = self::$factory->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_2, 'post_date' => '2007-01-01 00:00:00' ) );
     464
     465                $author_3 = self::$factory->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) );
     466                $post_3 = self::$factory->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_3, 'post_date' => '2007-01-01 00:00:00' ) );
     467
     468                $author_4 = self::$factory->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) );
     469                $post_4 = self::$factory->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_4, 'post_date' => '2007-01-01 00:00:00' ) );
    470470
    471471                $posts = $this->q->query( array(
     
    624624         */
    625625        function test_post_password() {
    626                 $one   = (string) $this->factory->post->create( array( 'post_password' => '' ) );
    627                 $two   = (string) $this->factory->post->create( array( 'post_password' => 'burrito' ) );
    628                 $three = (string) $this->factory->post->create( array( 'post_password' => 'burrito' ) );
     626                $one   = (string) self::$factory->post->create( array( 'post_password' => '' ) );
     627                $two   = (string) self::$factory->post->create( array( 'post_password' => 'burrito' ) );
     628                $three = (string) self::$factory->post->create( array( 'post_password' => 'burrito' ) );
    629629
    630630                $args = array( 'post__in' => array( $one, $two, $three ), 'fields' => 'ids' );
     
    666666                register_post_type( 'handbook', array( 'hierarchical' => true ) );
    667667
    668                 $post_1 = $this->factory->post->create( array( 'post_title' => 'Getting Started', 'post_type' => 'handbook' ) );
    669                 $post_2 = $this->factory->post->create( array( 'post_title' => 'Contributing to the WordPress Codex', 'post_type' => 'handbook' ) );
    670                 $post_3 = $this->factory->post->create( array( 'post_title' => 'Getting Started', 'post_parent' => $post_2, 'post_type' => 'handbook' ) );
     668                $post_1 = self::$factory->post->create( array( 'post_title' => 'Getting Started', 'post_type' => 'handbook' ) );
     669                $post_2 = self::$factory->post->create( array( 'post_title' => 'Contributing to the WordPress Codex', 'post_type' => 'handbook' ) );
     670                $post_3 = self::$factory->post->create( array( 'post_title' => 'Getting Started', 'post_parent' => $post_2, 'post_type' => 'handbook' ) );
    671671
    672672                $result = $this->q->query( array( 'handbook' => 'getting-started', 'post_type' => 'handbook' ) );
     
    680680                register_post_type( 'handbook', array( 'hierarchical' => true ) );
    681681
    682                 $post_1 = $this->factory->post->create( array( 'post_title' => 'Contributing to the WordPress Codex', 'post_type' => 'handbook' ) );
    683                 $post_2 = $this->factory->post->create( array( 'post_title' => 'Getting Started', 'post_parent' => $post_1, 'post_type' => 'handbook' ) );
     682                $post_1 = self::$factory->post->create( array( 'post_title' => 'Contributing to the WordPress Codex', 'post_type' => 'handbook' ) );
     683                $post_2 = self::$factory->post->create( array( 'post_title' => 'Getting Started', 'post_parent' => $post_1, 'post_type' => 'handbook' ) );
    684684
    685685                $this->assertContains( 'contributing-to-the-wordpress-codex/getting-started', get_permalink( $post_2 ) );
     
    691691        function test_title() {
    692692                $title = 'Tacos are Cool';
    693                 $post_id = $this->factory->post->create( array(
     693                $post_id = self::$factory->post->create( array(
    694694                        'post_title' => $title,
    695695                        'post_type' => 'post',
  • trunk/tests/phpunit/tests/query/search.php

    r34934 r35225  
    3232        function test_search_order_title_relevance() {
    3333                foreach ( range( 1, 7 ) as $i )
    34                         $this->factory->post->create( array( 'post_content' => $i . rand_str() . ' about', 'post_type' => $this->post_type ) );
    35                 $post_id = $this->factory->post->create( array( 'post_title' => 'About', 'post_type' => $this->post_type ) );
     34                        self::$factory->post->create( array( 'post_content' => $i . rand_str() . ' about', 'post_type' => $this->post_type ) );
     35                $post_id = self::$factory->post->create( array( 'post_title' => 'About', 'post_type' => $this->post_type ) );
    3636
    3737                $posts = $this->get_search_results( 'About' );
     
    6464         */
    6565        public function test_s_should_exclude_term_prefixed_with_dash() {
    66                 $p1 = $this->factory->post->create( array(
     66                $p1 = self::$factory->post->create( array(
    6767                        'post_status' => 'publish',
    6868                        'post_content' => 'This post has foo but also bar',
    6969                ) );
    70                 $p2 = $this->factory->post->create( array(
     70                $p2 = self::$factory->post->create( array(
    7171                        'post_status' => 'publish',
    7272                        'post_content' => 'This post has only foo',
     
    8585         */
    8686        public function test_s_should_exclude_first_term_if_prefixed_with_dash() {
    87                 $p1 = $this->factory->post->create( array(
     87                $p1 = self::$factory->post->create( array(
    8888                        'post_status' => 'publish',
    8989                        'post_content' => 'This post has foo but also bar',
    9090                ) );
    91                 $p2 = $this->factory->post->create( array(
     91                $p2 = self::$factory->post->create( array(
    9292                        'post_status' => 'publish',
    9393                        'post_content' => 'This post has only bar',
     
    106106         */
    107107        public function test_s_should_not_exclude_for_dashes_in_the_middle_of_words() {
    108                 $p1 = $this->factory->post->create( array(
     108                $p1 = self::$factory->post->create( array(
    109109                        'post_status' => 'publish',
    110110                        'post_content' => 'This post has foo but also bar',
    111111                ) );
    112                 $p2 = $this->factory->post->create( array(
     112                $p2 = self::$factory->post->create( array(
    113113                        'post_status' => 'publish',
    114114                        'post_content' => 'This post has only bar',
    115115                ) );
    116                 $p3 = $this->factory->post->create( array(
     116                $p3 = self::$factory->post->create( array(
    117117                        'post_status' => 'publish',
    118118                        'post_content' => 'This post has only foo-bar',
  • trunk/tests/phpunit/tests/query/setupPostdata.php

    r34089 r35225  
    4040
    4141        public function test_id() {
    42                 $p = $this->factory->post->create_and_get();
     42                $p = self::$factory->post->create_and_get();
    4343                setup_postdata( $p );
    4444
     
    5151         */
    5252        public function test_setup_by_id() {
    53                 $p = $this->factory->post->create_and_get();
     53                $p = self::$factory->post->create_and_get();
    5454                setup_postdata( $p->ID );
    5555
     
    7373         */
    7474        public function test_setup_by_postish_object() {
    75                 $p = $this->factory->post->create();
     75                $p = self::$factory->post->create();
    7676
    7777                $post = new stdClass();
     
    8383
    8484        public function test_authordata() {
    85                 $u = $this->factory->user->create_and_get();
    86                 $p = $this->factory->post->create_and_get( array(
     85                $u = self::$factory->user->create_and_get();
     86                $p = self::$factory->post->create_and_get( array(
    8787                        'post_author' => $u->ID,
    8888                ) );
     
    9494
    9595        public function test_currentday() {
    96                 $p = $this->factory->post->create_and_get( array(
     96                $p = self::$factory->post->create_and_get( array(
    9797                        'post_date' => '1980-09-09 06:30:00',
    9898                ) );
     
    103103
    104104        public function test_currentmonth() {
    105                 $p = $this->factory->post->create_and_get( array(
     105                $p = self::$factory->post->create_and_get( array(
    106106                        'post_date' => '1980-09-09 06:30:00',
    107107                ) );
     
    112112
    113113        public function test_secondary_query_post_vars() {
    114                 $users = $this->factory->user->create_many( 2 );
    115 
    116                 $post1 = $this->factory->post->create_and_get( array(
     114                $users = self::$factory->user->create_many( 2 );
     115
     116                $post1 = self::$factory->post->create_and_get( array(
    117117                        'post_author' => $users[0],
    118118                        'post_date' => '2012-02-02 02:00:00',
    119119                ) );
    120120
    121                 $post2 = $this->factory->post->create_and_get( array(
     121                $post2 = self::$factory->post->create_and_get( array(
    122122                        'post_author' => $users[1],
    123123                        'post_date' => '2013-03-03 03:00:00',
     
    158158
    159159        public function test_single_page() {
    160                 $post = $this->factory->post->create_and_get( array(
     160                $post = self::$factory->post->create_and_get( array(
    161161                        'post_content' => 'Page 0',
    162162                ) );
     
    169169
    170170        public function test_multi_page() {
    171                 $post = $this->factory->post->create_and_get( array(
     171                $post = self::$factory->post->create_and_get( array(
    172172                        'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3',
    173173                ) );
     
    183183         */
    184184        public function test_nextpage_at_start_of_content() {
    185                 $post = $this->factory->post->create_and_get( array(
     185                $post = self::$factory->post->create_and_get( array(
    186186                        'post_content' => '<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3',
    187187                ) );
     
    194194
    195195        public function test_trim_nextpage_linebreaks() {
    196                 $post = $this->factory->post->create_and_get( array(
     196                $post = self::$factory->post->create_and_get( array(
    197197                        'post_content' => "Page 0\n<!--nextpage-->\nPage 1\nhas a line break\n<!--nextpage-->Page 2<!--nextpage-->\n\nPage 3",
    198198                ) );
     
    206206         */
    207207        public function test_secondary_query_nextpage() {
    208                 $post1 = $this->factory->post->create( array(
     208                $post1 = self::$factory->post->create( array(
    209209                        'post_content' => 'Post 1 Page 1<!--nextpage-->Post 1 Page 2',
    210210                ) );
    211                 $post2 = $this->factory->post->create( array(
     211                $post2 = self::$factory->post->create( array(
    212212                        'post_content' => 'Post 2 Page 1<!--nextpage-->Post 2 Page 2',
    213213                ) );
     
    238238
    239239        public function test_page_from_wp_query() {
    240                 $page = $this->factory->post->create_and_get( array(
     240                $page = self::$factory->post->create_and_get( array(
    241241                        'post_type' => 'page',
    242242                ) );
     
    251251
    252252        public function test_page_when_on_page() {
    253                 $page = $this->factory->post->create_and_get( array(
     253                $page = self::$factory->post->create_and_get( array(
    254254                        'post_type' => 'page',
    255255                ) );
     
    264264         */
    265265        public function test_secondary_query_page() {
    266                 $post = $this->factory->post->create_and_get();
     266                $post = self::$factory->post->create_and_get();
    267267                $this->go_to( '/?page=3' );
    268268                setup_postdata( $post );
     
    272272
    273273                // Secondary loop.
    274                 $posts = $this->factory->post->create_many( 5 );
     274                $posts = self::$factory->post->create_many( 5 );
    275275                $q = new WP_Query( array(
    276276                        'page' => 4,
     
    295295         */
    296296        public function test_more_when_on_setup_post() {
    297                 $post = $this->factory->post->create_and_get();
     297                $post = self::$factory->post->create_and_get();
    298298                $this->go_to( get_permalink( $post ) );
    299299                setup_postdata( $post );
     
    308308         */
    309309        public function test_more_when_on_single() {
    310                 $post1 = $this->factory->post->create_and_get();
    311                 $post2 = $this->factory->post->create_and_get();
     310                $post1 = self::$factory->post->create_and_get();
     311                $post2 = self::$factory->post->create_and_get();
    312312                $this->go_to( get_permalink( $post1 ) );
    313313                setup_postdata( $post2 );
     
    322322         */
    323323        public function test_more_when_on_page() {
    324                 $post = $this->factory->post->create_and_get();
    325                 $page = $this->factory->post->create_and_get( array(
     324                $post = self::$factory->post->create_and_get();
     325                $page = self::$factory->post->create_and_get( array(
    326326                        'post_type' => 'page',
    327327                ) );
     
    336336         */
    337337        public function test_more_when_on_feed() {
    338                 $post = $this->factory->post->create_and_get();
     338                $post = self::$factory->post->create_and_get();
    339339                $this->go_to( '/?feed=rss' );
    340340                setup_postdata( $post );
     
    348348         */
    349349        public function test_secondary_query_more() {
    350                 $post = $this->factory->post->create_and_get();
     350                $post = self::$factory->post->create_and_get();
    351351                $this->go_to( get_permalink( $post ) );
    352352                setup_postdata( $post );
     
    380380         */
    381381        function test_setup_postdata_loop() {
    382                 $post_id = $this->factory->post->create( array( 'post_content' => 'global post' ) );
     382                $post_id = self::$factory->post->create( array( 'post_content' => 'global post' ) );
    383383                $GLOBALS['wp_query']->post = $GLOBALS['post'] = get_post( $post_id );
    384384
    385                 $ids = $this->factory->post->create_many(5);
     385                $ids = self::$factory->post->create_many(5);
    386386                foreach ( $ids as $id ) {
    387387                        $page = get_post( $id );
  • trunk/tests/phpunit/tests/query/taxQuery.php

    r35162 r35225  
    77class Tests_Query_TaxQuery extends WP_UnitTestCase {
    88        public function test_tax_query_single_query_single_term_field_slug() {
    9                 $t = $this->factory->term->create( array(
     9                $t = self::$factory->term->create( array(
    1010                        'taxonomy' => 'category',
    1111                        'slug' => 'foo',
    1212                        'name' => 'Foo',
    1313                ) );
    14                 $p1 = $this->factory->post->create();
    15                 $p2 = $this->factory->post->create();
     14                $p1 = self::$factory->post->create();
     15                $p2 = self::$factory->post->create();
    1616
    1717                wp_set_post_terms( $p1, $t, 'category' );
     
    3434
    3535        public function test_tax_query_single_query_single_term_field_name() {
    36                 $t = $this->factory->term->create( array(
     36                $t = self::$factory->term->create( array(
    3737                        'taxonomy' => 'category',
    3838                        'slug' => 'foo',
    3939                        'name' => 'Foo',
    4040                ) );
    41                 $p1 = $this->factory->post->create();
    42                 $p2 = $this->factory->post->create();
     41                $p1 = self::$factory->post->create();
     42                $p2 = self::$factory->post->create();
    4343
    4444                wp_set_post_terms( $p1, $t, 'category' );
     
    6666                register_taxonomy( 'wptests_tax', 'post' );
    6767
    68                 $t = $this->factory->term->create( array(
     68                $t = self::$factory->term->create( array(
    6969                        'taxonomy' => 'wptests_tax',
    7070                        'slug' => 'foo',
    7171                        'name' => 'Foo Bar',
    7272                ) );
    73                 $p1 = $this->factory->post->create();
    74                 $p2 = $this->factory->post->create();
     73                $p1 = self::$factory->post->create();
     74                $p2 = self::$factory->post->create();
    7575
    7676                wp_set_object_terms( $p1, $t, 'wptests_tax' );
     
    9191
    9292        public function test_tax_query_single_query_single_term_field_term_taxonomy_id() {
    93                 $t = $this->factory->term->create( array(
     93                $t = self::$factory->term->create( array(
    9494                        'taxonomy' => 'category',
    9595                        'slug' => 'foo',
    9696                        'name' => 'Foo',
    9797                ) );
    98                 $p1 = $this->factory->post->create();
    99                 $p2 = $this->factory->post->create();
     98                $p1 = self::$factory->post->create();
     99                $p2 = self::$factory->post->create();
    100100
    101101                $tt_ids = wp_set_post_terms( $p1, $t, 'category' );
     
    118118
    119119        public function test_tax_query_single_query_single_term_field_term_id() {
    120                 $t = $this->factory->term->create( array(
     120                $t = self::$factory->term->create( array(
    121121                        'taxonomy' => 'category',
    122122                        'slug' => 'foo',
    123123                        'name' => 'Foo',
    124124                ) );
    125                 $p1 = $this->factory->post->create();
    126                 $p2 = $this->factory->post->create();
     125                $p1 = self::$factory->post->create();
     126                $p2 = self::$factory->post->create();
    127127
    128128                wp_set_post_terms( $p1, $t, 'category' );
     
    145145
    146146        public function test_tax_query_single_query_single_term_operator_in() {
    147                 $t = $this->factory->term->create( array(
     147                $t = self::$factory->term->create( array(
    148148                        'taxonomy' => 'category',
    149149                        'slug' => 'foo',
    150150                        'name' => 'Foo',
    151151                ) );
    152                 $p1 = $this->factory->post->create();
    153                 $p2 = $this->factory->post->create();
     152                $p1 = self::$factory->post->create();
     153                $p2 = self::$factory->post->create();
    154154
    155155                wp_set_post_terms( $p1, $t, 'category' );
     
    173173
    174174        public function test_tax_query_single_query_single_term_operator_not_in() {
    175                 $t = $this->factory->term->create( array(
     175                $t = self::$factory->term->create( array(
    176176                        'taxonomy' => 'category',
    177177                        'slug' => 'foo',
    178178                        'name' => 'Foo',
    179179                ) );
    180                 $p1 = $this->factory->post->create();
    181                 $p2 = $this->factory->post->create();
     180                $p1 = self::$factory->post->create();
     181                $p2 = self::$factory->post->create();
    182182
    183183                wp_set_post_terms( $p1, $t, 'category' );
     
    201201
    202202        public function test_tax_query_single_query_single_term_operator_and() {
    203                 $t = $this->factory->term->create( array(
     203                $t = self::$factory->term->create( array(
    204204                        'taxonomy' => 'category',
    205205                        'slug' => 'foo',
    206206                        'name' => 'Foo',
    207207                ) );
    208                 $p1 = $this->factory->post->create();
    209                 $p2 = $this->factory->post->create();
     208                $p1 = self::$factory->post->create();
     209                $p2 = self::$factory->post->create();
    210210
    211211                wp_set_post_terms( $p1, $t, 'category' );
     
    229229
    230230        public function test_tax_query_single_query_multiple_terms_operator_in() {
    231                 $t1 = $this->factory->term->create( array(
     231                $t1 = self::$factory->term->create( array(
    232232                        'taxonomy' => 'category',
    233233                        'slug' => 'foo',
    234234                        'name' => 'Foo',
    235235                ) );
    236                 $t2 = $this->factory->term->create( array(
     236                $t2 = self::$factory->term->create( array(
    237237                        'taxonomy' => 'category',
    238238                        'slug' => 'bar',
    239239                        'name' => 'Bar',
    240240                ) );
    241                 $p1 = $this->factory->post->create();
    242                 $p2 = $this->factory->post->create();
    243                 $p3 = $this->factory->post->create();
     241                $p1 = self::$factory->post->create();
     242                $p2 = self::$factory->post->create();
     243                $p3 = self::$factory->post->create();
    244244
    245245                wp_set_post_terms( $p1, $t1, 'category' );
     
    264264
    265265        public function test_tax_query_single_query_multiple_terms_operator_not_in() {
    266                 $t1 = $this->factory->term->create( array(
     266                $t1 = self::$factory->term->create( array(
    267267                        'taxonomy' => 'category',
    268268                        'slug' => 'foo',
    269269                        'name' => 'Foo',
    270270                ) );
    271                 $t2 = $this->factory->term->create( array(
     271                $t2 = self::$factory->term->create( array(
    272272                        'taxonomy' => 'category',
    273273                        'slug' => 'bar',
    274274                        'name' => 'Bar',
    275275                ) );
    276                 $p1 = $this->factory->post->create();
    277                 $p2 = $this->factory->post->create();
    278                 $p3 = $this->factory->post->create();
     276                $p1 = self::$factory->post->create();
     277                $p2 = self::$factory->post->create();
     278                $p3 = self::$factory->post->create();
    279279
    280280                wp_set_post_terms( $p1, $t1, 'category' );
     
    302302         */
    303303        public function test_tax_query_single_query_multiple_queries_operator_not_in() {
    304                 $t1 = $this->factory->term->create( array(
     304                $t1 = self::$factory->term->create( array(
    305305                        'taxonomy' => 'category',
    306306                        'slug' => 'foo',
    307307                        'name' => 'Foo',
    308308                ) );
    309                 $t2 = $this->factory->term->create( array(
     309                $t2 = self::$factory->term->create( array(
    310310                        'taxonomy' => 'category',
    311311                        'slug' => 'bar',
    312312                        'name' => 'Bar',
    313313                ) );
    314                 $p1 = $this->factory->post->create();
    315                 $p2 = $this->factory->post->create();
    316                 $p3 = $this->factory->post->create();
     314                $p1 = self::$factory->post->create();
     315                $p2 = self::$factory->post->create();
     316                $p3 = self::$factory->post->create();
    317317
    318318                wp_set_post_terms( $p1, $t1, 'category' );
     
    344344
    345345        public function test_tax_query_single_query_multiple_terms_operator_and() {
    346                 $t1 = $this->factory->term->create( array(
     346                $t1 = self::$factory->term->create( array(
    347347                        'taxonomy' => 'category',
    348348                        'slug' => 'foo',
    349349                        'name' => 'Foo',
    350350                ) );
    351                 $t2 = $this->factory->term->create( array(
     351                $t2 = self::$factory->term->create( array(
    352352                        'taxonomy' => 'category',
    353353                        'slug' => 'bar',
    354354                        'name' => 'Bar',
    355355                ) );
    356                 $p1 = $this->factory->post->create();
    357                 $p2 = $this->factory->post->create();
    358                 $p3 = $this->factory->post->create();
     356                $p1 = self::$factory->post->create();
     357                $p2 = self::$factory->post->create();
     358                $p3 = self::$factory->post->create();
    359359
    360360                wp_set_object_terms( $p1, $t1, 'category' );
     
    385385                register_taxonomy( 'wptests_tax2', 'post' );
    386386
    387                 $t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
    388                 $t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
    389 
    390                 $p1 = $this->factory->post->create();
    391                 $p2 = $this->factory->post->create();
    392                 $p3 = $this->factory->post->create();
     387                $t1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
     388                $t2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
     389
     390                $p1 = self::$factory->post->create();
     391                $p2 = self::$factory->post->create();
     392                $p3 = self::$factory->post->create();
    393393
    394394                wp_set_object_terms( $p1, array( $t1 ), 'wptests_tax1' );
     
    417417                register_taxonomy( 'wptests_tax2', 'post' );
    418418
    419                 $t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
    420                 $t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
    421 
    422                 $p1 = $this->factory->post->create();
    423                 $p2 = $this->factory->post->create();
    424                 $p3 = $this->factory->post->create();
     419                $t1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
     420                $t2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
     421
     422                $p1 = self::$factory->post->create();
     423                $p2 = self::$factory->post->create();
     424                $p3 = self::$factory->post->create();
    425425
    426426                wp_set_object_terms( $p1, array( $t1 ), 'wptests_tax1' );
     
    449449                register_taxonomy( 'wptests_tax2', 'post' );
    450450
    451                 $t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
    452                 $t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
    453 
    454                 $p1 = $this->factory->post->create();
    455                 $p2 = $this->factory->post->create();
    456                 $p3 = $this->factory->post->create();
     451                $t1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
     452                $t2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
     453
     454                $p1 = self::$factory->post->create();
     455                $p2 = self::$factory->post->create();
     456                $p3 = self::$factory->post->create();
    457457
    458458                wp_set_object_terms( $p1, array( $t1 ), 'wptests_tax1' );
     
    482482                register_taxonomy( 'wptests_tax2', 'post' );
    483483
    484                 $t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
    485                 $t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
    486 
    487                 $p1 = $this->factory->post->create();
    488                 $p2 = $this->factory->post->create();
    489                 $p3 = $this->factory->post->create();
     484                $t1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
     485                $t2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
     486
     487                $p1 = self::$factory->post->create();
     488                $p2 = self::$factory->post->create();
     489                $p3 = self::$factory->post->create();
    490490
    491491                wp_set_object_terms( $p1, array( $t1 ), 'wptests_tax1' );
     
    507507
    508508        public function test_tax_query_multiple_queries_relation_and() {
    509                 $t1 = $this->factory->term->create( array(
     509                $t1 = self::$factory->term->create( array(
    510510                        'taxonomy' => 'category',
    511511                        'slug' => 'foo',
    512512                        'name' => 'Foo',
    513513                ) );
    514                 $t2 = $this->factory->term->create( array(
     514                $t2 = self::$factory->term->create( array(
    515515                        'taxonomy' => 'category',
    516516                        'slug' => 'bar',
    517517                        'name' => 'Bar',
    518518                ) );
    519                 $p1 = $this->factory->post->create();
    520                 $p2 = $this->factory->post->create();
    521                 $p3 = $this->factory->post->create();
     519                $p1 = self::$factory->post->create();
     520                $p2 = self::$factory->post->create();
     521                $p3 = self::$factory->post->create();
    522522
    523523                wp_set_object_terms( $p1, $t1, 'category' );
     
    547547
    548548        public function test_tax_query_multiple_queries_relation_or() {
    549                 $t1 = $this->factory->term->create( array(
     549                $t1 = self::$factory->term->create( array(
    550550                        'taxonomy' => 'category',
    551551                        'slug' => 'foo',
    552552                        'name' => 'Foo',
    553553                ) );
    554                 $t2 = $this->factory->term->create( array(
     554                $t2 = self::$factory->term->create( array(
    555555                        'taxonomy' => 'category',
    556556                        'slug' => 'bar',
    557557                        'name' => 'Bar',
    558558                ) );
    559                 $p1 = $this->factory->post->create();
    560                 $p2 = $this->factory->post->create();
    561                 $p3 = $this->factory->post->create();
     559                $p1 = self::$factory->post->create();
     560                $p2 = self::$factory->post->create();
     561                $p3 = self::$factory->post->create();
    562562
    563563                wp_set_object_terms( $p1, $t1, 'category' );
     
    587587
    588588        public function test_tax_query_multiple_queries_different_taxonomies() {
    589                 $t1 = $this->factory->term->create( array(
     589                $t1 = self::$factory->term->create( array(
    590590                        'taxonomy' => 'post_tag',
    591591                        'slug' => 'foo',
    592592                        'name' => 'Foo',
    593593                ) );
    594                 $t2 = $this->factory->term->create( array(
     594                $t2 = self::$factory->term->create( array(
    595595                        'taxonomy' => 'category',
    596596                        'slug' => 'bar',
    597597                        'name' => 'Bar',
    598598                ) );
    599                 $p1 = $this->factory->post->create();
    600                 $p2 = $this->factory->post->create();
    601                 $p3 = $this->factory->post->create();
     599                $p1 = self::$factory->post->create();
     600                $p2 = self::$factory->post->create();
     601                $p3 = self::$factory->post->create();
    602602
    603603                wp_set_object_terms( $p1, $t1, 'post_tag' );
     
    633633                register_taxonomy( 'bar', 'post' );
    634634
    635                 $foo_term_1 = $this->factory->term->create( array(
     635                $foo_term_1 = self::$factory->term->create( array(
    636636                        'taxonomy' => 'foo',
    637637                ) );
    638                 $foo_term_2 = $this->factory->term->create( array(
     638                $foo_term_2 = self::$factory->term->create( array(
    639639                        'taxonomy' => 'foo',
    640640                ) );
    641                 $bar_term_1 = $this->factory->term->create( array(
     641                $bar_term_1 = self::$factory->term->create( array(
    642642                        'taxonomy' => 'bar',
    643643                ) );
    644                 $bar_term_2 = $this->factory->term->create( array(
     644                $bar_term_2 = self::$factory->term->create( array(
    645645                        'taxonomy' => 'bar',
    646646                ) );
    647647
    648                 $p1 = $this->factory->post->create();
    649                 $p2 = $this->factory->post->create();
    650                 $p3 = $this->factory->post->create();
     648                $p1 = self::$factory->post->create();
     649                $p2 = self::$factory->post->create();
     650                $p3 = self::$factory->post->create();
    651651
    652652                wp_set_object_terms( $p1, array( $foo_term_1 ), 'foo' );
     
    705705                register_taxonomy( 'bar', 'post' );
    706706
    707                 $foo_term_1 = $this->factory->term->create( array(
     707                $foo_term_1 = self::$factory->term->create( array(
    708708                        'taxonomy' => 'foo',
    709709                ) );
    710                 $foo_term_2 = $this->factory->term->create( array(
     710                $foo_term_2 = self::$factory->term->create( array(
    711711                        'taxonomy' => 'foo',
    712712                ) );
    713                 $bar_term_1 = $this->factory->term->create( array(
     713                $bar_term_1 = self::$factory->term->create( array(
    714714                        'taxonomy' => 'bar',
    715715                ) );
    716                 $bar_term_2 = $this->factory->term->create( array(
     716                $bar_term_2 = self::$factory->term->create( array(
    717717                        'taxonomy' => 'bar',
    718718                ) );
    719719
    720                 $p1 = $this->factory->post->create();
    721                 $p2 = $this->factory->post->create();
    722                 $p3 = $this->factory->post->create();
     720                $p1 = self::$factory->post->create();
     721                $p2 = self::$factory->post->create();
     722                $p3 = self::$factory->post->create();
    723723
    724724                wp_set_object_terms( $p1, array( $foo_term_1 ), 'foo' );
     
    769769                register_taxonomy( 'bar', 'post' );
    770770
    771                 $foo_term_1 = $this->factory->term->create( array(
     771                $foo_term_1 = self::$factory->term->create( array(
    772772                        'taxonomy' => 'foo',
    773773                ) );
    774                 $foo_term_2 = $this->factory->term->create( array(
     774                $foo_term_2 = self::$factory->term->create( array(
    775775                        'taxonomy' => 'foo',
    776776                ) );
    777                 $bar_term_1 = $this->factory->term->create( array(
     777                $bar_term_1 = self::$factory->term->create( array(
    778778                        'taxonomy' => 'bar',
    779779                ) );
    780                 $bar_term_2 = $this->factory->term->create( array(
     780                $bar_term_2 = self::$factory->term->create( array(
    781781                        'taxonomy' => 'bar',
    782782                ) );
    783783
    784                 $p1 = $this->factory->post->create();
    785                 $p2 = $this->factory->post->create();
    786                 $p3 = $this->factory->post->create();
    787                 $p4 = $this->factory->post->create();
     784                $p1 = self::$factory->post->create();
     785                $p2 = self::$factory->post->create();
     786                $p3 = self::$factory->post->create();
     787                $p4 = self::$factory->post->create();
    788788
    789789                wp_set_object_terms( $p1, array( $foo_term_1 ), 'foo' );
     
    841841                // An empty tax query should return an empty array, not all posts.
    842842
    843                 $this->factory->post->create_many( 2 );
     843                self::$factory->post->create_many( 2 );
    844844
    845845                $query = new WP_Query( array(
     
    874874                // An empty tax query should return an empty array, not all posts.
    875875
    876                 $this->factory->post->create_many( 2 );
     876                self::$factory->post->create_many( 2 );
    877877
    878878                $query = new WP_Query( array(
     
    902902
    903903        public function test_tax_query_include_children() {
    904                 $cat_a = $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'Australia' ) );
    905                 $cat_b = $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'Sydney', 'parent' => $cat_a ) );
    906                 $cat_c = $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'East Syndney', 'parent' => $cat_b ) );
    907                 $cat_d = $this->factory->term->create( array( 'taxonomy' => 'category', 'name' => 'West Syndney', 'parent' => $cat_b ) );
    908 
    909                 $post_a = $this->factory->post->create( array( 'post_category' => array( $cat_a ) ) );
    910                 $post_b = $this->factory->post->create( array( 'post_category' => array( $cat_b ) ) );
    911                 $post_c = $this->factory->post->create( array( 'post_category' => array( $cat_c ) ) );
    912                 $post_d = $this->factory->post->create( array( 'post_category' => array( $cat_d ) ) );
     904                $cat_a = self::$factory->term->create( array( 'taxonomy' => 'category', 'name' => 'Australia' ) );
     905                $cat_b = self::$factory->term->create( array( 'taxonomy' => 'category', 'name' => 'Sydney', 'parent' => $cat_a ) );
     906                $cat_c = self::$factory->term->create( array( 'taxonomy' => 'category', 'name' => 'East Syndney', 'parent' => $cat_b ) );
     907                $cat_d = self::$factory->term->create( array( 'taxonomy' => 'category', 'name' => 'West Syndney', 'parent' => $cat_b ) );
     908
     909                $post_a = self::$factory->post->create( array( 'post_category' => array( $cat_a ) ) );
     910                $post_b = self::$factory->post->create( array( 'post_category' => array( $cat_b ) ) );
     911                $post_c = self::$factory->post->create( array( 'post_category' => array( $cat_c ) ) );
     912                $post_d = self::$factory->post->create( array( 'post_category' => array( $cat_d ) ) );
    913913
    914914                $posts = get_posts( array(
     
    10101010
    10111011                register_taxonomy_for_object_type( 'post_tag', 'attachment:image' );
    1012                 $tag_id = $this->factory->term->create( array( 'slug' => rand_str(), 'name' => rand_str() ) );
    1013                 $image_id = $this->factory->attachment->create_object( 'image.jpg', 0, array(
     1012                $tag_id = self::$factory->term->create( array( 'slug' => rand_str(), 'name' => rand_str() ) );
     1013                $image_id = self::$factory->attachment->create_object( 'image.jpg', 0, array(
    10141014                        'post_mime_type' => 'image/jpeg',
    10151015                        'post_type' => 'attachment'
     
    10361036
    10371037        public function test_tax_query_no_taxonomy() {
    1038                 $cat_id = $this->factory->category->create( array( 'name' => 'alpha' ) );
    1039                 $this->factory->post->create( array( 'post_title' => 'alpha', 'post_category' => array( $cat_id ) ) );
     1038                $cat_id = self::$factory->category->create( array( 'name' => 'alpha' ) );
     1039                self::$factory->post->create( array( 'post_title' => 'alpha', 'post_category' => array( $cat_id ) ) );
    10401040
    10411041                $response1 = new WP_Query( array(
     
    10771077                $q = new WP_Query();
    10781078
    1079                 $posts = $this->factory->post->create_many( 5 );
     1079                $posts = self::$factory->post->create_many( 5 );
    10801080
    10811081                $cats = $tags = array();
     
    11561156        public function test_populate_taxonomy_query_var_from_tax_query() {
    11571157                register_taxonomy( 'foo', 'post' );
    1158                 $t = $this->factory->term->create( array(
     1158                $t = self::$factory->term->create( array(
    11591159                        'taxonomy' => 'foo',
    11601160                ) );
    1161                 $c = $this->factory->term->create( array(
     1161                $c = self::$factory->term->create( array(
    11621162                        'taxonomy' => 'category',
    11631163                ) );
     
    11921192                register_taxonomy( 'foo', 'post' );
    11931193                register_taxonomy( 'foo1', 'post' );
    1194                 $t = $this->factory->term->create( array(
     1194                $t = self::$factory->term->create( array(
    11951195                        'taxonomy' => 'foo',
    11961196                ) );
     
    12141214        public function test_populate_term_query_var_from_tax_query() {
    12151215                register_taxonomy( 'foo', 'post' );
    1216                 $t = $this->factory->term->create( array(
     1216                $t = self::$factory->term->create( array(
    12171217                        'taxonomy' => 'foo',
    12181218                        'slug' => 'bar',
     
    12361236        public function test_populate_term_id_query_var_from_tax_query() {
    12371237                register_taxonomy( 'foo', 'post' );
    1238                 $t = $this->factory->term->create( array(
     1238                $t = self::$factory->term->create( array(
    12391239                        'taxonomy' => 'foo',
    12401240                        'slug' => 'bar',
     
    12611261        public function test_populate_cat_category_name_query_var_from_tax_query() {
    12621262                register_taxonomy( 'foo', 'post' );
    1263                 $t = $this->factory->term->create( array(
     1263                $t = self::$factory->term->create( array(
    12641264                        'taxonomy' => 'foo',
    12651265                ) );
    1266                 $c = $this->factory->term->create( array(
     1266                $c = self::$factory->term->create( array(
    12671267                        'taxonomy' => 'category',
    12681268                        'slug' => 'bar',
     
    13021302        public function test_populate_tag_id_query_var_from_tax_query() {
    13031303                register_taxonomy( 'foo', 'post' );
    1304                 $t = $this->factory->term->create( array(
     1304                $t = self::$factory->term->create( array(
    13051305                        'taxonomy' => 'foo',
    13061306                ) );
    1307                 $tag = $this->factory->term->create( array(
     1307                $tag = self::$factory->term->create( array(
    13081308                        'taxonomy' => 'post_tag',
    13091309                        'slug' => 'bar',
  • trunk/tests/phpunit/tests/rest-api/rest-server.php

    r34928 r35225  
    137137                ) );
    138138
    139                 $editor = $this->factory->user->create( array( 'role' => 'editor' ) );
     139                $editor = self::$factory->user->create( array( 'role' => 'editor' ) );
    140140
    141141                $request = new WP_REST_Request( 'GET', '/test-ns/test', array() );
  • trunk/tests/phpunit/tests/rewrite.php

    r35195 r35225  
    8686        function test_url_to_postid() {
    8787
    88                 $id = $this->factory->post->create();
    89                 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
    90 
    91                 $id = $this->factory->post->create( array( 'post_type' => 'page' ) );
     88                $id = self::$factory->post->create();
     89                $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
     90
     91                $id = self::$factory->post->create( array( 'post_type' => 'page' ) );
    9292                $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
    9393        }
    9494
    9595        function test_url_to_postid_set_url_scheme_https_to_http() {
    96                 $post_id = $this->factory->post->create();
     96                $post_id = self::$factory->post->create();
    9797                $permalink = get_permalink( $post_id );
    9898                $this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'https' ) ) );
    9999
    100                 $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
     100                $post_id = self::$factory->post->create( array( 'post_type' => 'page' ) );
    101101                $permalink = get_permalink( $post_id );
    102102                $this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'https' ) ) );
     
    110110                $_SERVER['HTTPS'] = 'on';
    111111
    112                 $post_id = $this->factory->post->create();
     112                $post_id = self::$factory->post->create();
    113113                $permalink = get_permalink( $post_id );
    114114                $this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'http' ) ) );
    115115
    116                 $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
     116                $post_id = self::$factory->post->create( array( 'post_type' => 'page' ) );
    117117                $permalink = get_permalink( $post_id );
    118118                $this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'http' ) ) );
     
    129129                register_post_type( $post_type, array( 'public' => true ) );
    130130
    131                 $id = $this->factory->post->create( array( 'post_type' => $post_type ) );
     131                $id = self::$factory->post->create( array( 'post_type' => $post_type ) );
    132132                $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
    133133
     
    137137        function test_url_to_postid_hierarchical() {
    138138
    139                 $parent_id = $this->factory->post->create( array( 'post_title' => 'Parent', 'post_type' => 'page' ) );
    140                 $child_id = $this->factory->post->create( array( 'post_title' => 'Child', 'post_type' => 'page', 'post_parent' => $parent_id ) );
     139                $parent_id = self::$factory->post->create( array( 'post_title' => 'Parent', 'post_type' => 'page' ) );
     140                $child_id = self::$factory->post->create( array( 'post_title' => 'Child', 'post_type' => 'page', 'post_parent' => $parent_id ) );
    141141
    142142                $this->assertEquals( $parent_id, url_to_postid( get_permalink( $parent_id ) ) );
     
    146146        function test_url_to_postid_hierarchical_with_matching_leaves() {
    147147
    148                 $parent_id = $this->factory->post->create( array(
     148                $parent_id = self::$factory->post->create( array(
    149149                        'post_name' => 'parent',
    150150                        'post_type' => 'page',
    151151                ) );
    152                 $child_id_1 = $this->factory->post->create( array(
     152                $child_id_1 = self::$factory->post->create( array(
    153153                        'post_name'   => 'child1',
    154154                        'post_type'   => 'page',
    155155                        'post_parent' => $parent_id,
    156156                ) );
    157                 $child_id_2 = $this->factory->post->create( array(
     157                $child_id_2 = self::$factory->post->create( array(
    158158                        'post_name'   => 'child2',
    159159                        'post_type'   => 'page',
    160160                        'post_parent' => $parent_id,
    161161                ) );
    162                 $grandchild_id_1 = $this->factory->post->create( array(
     162                $grandchild_id_1 = self::$factory->post->create( array(
    163163                        'post_name'   => 'grandchild',
    164164                        'post_type'   => 'page',
    165165                        'post_parent' => $child_id_1,
    166166                ) );
    167                 $grandchild_id_2 = $this->factory->post->create( array(
     167                $grandchild_id_2 = self::$factory->post->create( array(
    168168                        'post_name'   => 'grandchild',
    169169                        'post_type'   => 'page',
     
    181181                update_option( 'home', home_url( '/example/' ) );
    182182
    183                 $id = $this->factory->post->create( array( 'post_title' => 'Hi', 'post_type' => 'page', 'post_name' => 'examp' ) );
     183                $id = self::$factory->post->create( array( 'post_title' => 'Hi', 'post_type' => 'page', 'post_name' => 'examp' ) );
    184184                $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
    185185                $this->assertEquals( $id, url_to_postid( site_url('/example/examp' ) ) );
     
    245245                update_option( 'home', home_url('/example/') );
    246246
    247                 $id = $this->factory->post->create( array( 'post_title' => 'Hi', 'post_type' => 'page', 'post_name' => 'example' ) );
     247                $id = self::$factory->post->create( array( 'post_title' => 'Hi', 'post_type' => 'page', 'post_name' => 'example' ) );
    248248
    249249                $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) );
     
    259259                update_option( 'home', home_url( '/example' ) );
    260260
    261                 $this->factory->post->create( array( 'post_title' => 'Collision', 'post_type' => 'page', 'post_name' => 'collision' ) );
     261                self::$factory->post->create( array( 'post_title' => 'Collision', 'post_type' => 'page', 'post_name' => 'collision' ) );
    262262
    263263                // This url should NOT return a post ID
     
    278278                }
    279279
    280                 $blog_id = $this->factory->blog->create( array( 'path' => '/example' ) );
     280                $blog_id = self::$factory->blog->create( array( 'path' => '/example' ) );
    281281                switch_to_blog( $blog_id );
    282282
    283                 $this->factory->post->create( array( 'post_title' => 'Collision ', 'post_type' => 'page' ) );
     283                self::$factory->post->create( array( 'post_title' => 'Collision ', 'post_type' => 'page' ) );
    284284
    285285                // This url should NOT return a post ID
     
    295295        public function test_is_home_should_be_false_when_visiting_custom_endpoint_without_a_registered_query_var_and_page_on_front_is_set() {
    296296
    297                 $page_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
     297                $page_id = self::$factory->post->create( array( 'post_type' => 'page' ) );
    298298                update_option( 'show_on_front', 'page' );
    299299                update_option( 'page_on_front', $page_id );
     
    314314                $this->set_permalink_structure( '/%postname%/' );
    315315
    316                 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_status' => 'trash' ) );
    317                 $post_id = $this->factory->post->create( array( 'post_title' => get_post( $page_id )->post_title ) );
    318                
     316                $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_status' => 'trash' ) );
     317                $post_id = self::$factory->post->create( array( 'post_title' => get_post( $page_id )->post_title ) );
     318
    319319                $this->assertEquals( $post_id, url_to_postid( get_permalink( $post_id ) ) );
    320320
     
    328328                $this->set_permalink_structure( '/%postname%/' );
    329329
    330                 $page_id = $this->factory->post->create( array( 'post_type' => 'page', 'post_status' => 'trash' ) );
    331                 $post_id = $this->factory->post->create( array( 'post_title' => get_post( $page_id )->post_title ) );
    332                
     330                $page_id = self::$factory->post->create( array( 'post_type' => 'page', 'post_status' => 'trash' ) );
     331                $post_id = self::$factory->post->create( array( 'post_title' => get_post( $page_id )->post_title ) );
     332
    333333                $this->go_to( get_permalink( $post_id ) );
    334334
  • trunk/tests/phpunit/tests/rewrite/numericSlugs.php

    r34810 r35225  
    1010        public function setUp() {
    1111                parent::setUp();
    12                 $this->author_id = $this->factory->user->create( array( 'role' => 'editor' ) );
     12                $this->author_id = self::$factory->user->create( array( 'role' => 'editor' ) );
    1313
    1414                // Override the post/archive slug collision prevention in `wp_unique_post_slug()`.
     
    2424                $this->set_permalink_structure( '/%postname%/' );
    2525
    26                 $id = $this->factory->post->create( array(
     26                $id = self::$factory->post->create( array(
    2727                        'post_author'  => $this->author_id,
    2828                        'post_status'  => 'publish',
     
    5252                $this->set_permalink_structure( '/%postname%/' );
    5353
    54                 $id = $this->factory->post->create( array(
     54                $id = self::$factory->post->create( array(
    5555                        'post_author'  => $this->author_id,
    5656                        'post_status'  => 'publish',
     
    7777                $this->set_permalink_structure( '/%postname%/' );
    7878
    79                 $id = $this->factory->post->create( array(
     79                $id = self::$factory->post->create( array(
    8080                        'post_author'  => $this->author_id,
    8181                        'post_status'  => 'publish',
     
    9393                $this->set_permalink_structure( '/%postname%/' );
    9494
    95                 $id = $this->factory->post->create( array(
     95                $id = self::$factory->post->create( array(
    9696                        'post_author'  => $this->author_id,
    9797                        'post_status'  => 'publish',
     
    107107                $this->set_permalink_structure( '/%year%/%postname%/' );
    108108
    109                 $id = $this->factory->post->create( array(
     109                $id = self::$factory->post->create( array(
    110110                        'post_author'  => $this->author_id,
    111111                        'post_status'  => 'publish',
     
    124124                $this->set_permalink_structure( '/%year%/%postname%/' );
    125125
    126                 $id = $this->factory->post->create( array(
     126                $id = self::$factory->post->create( array(
    127127                        'post_author'  => $this->author_id,
    128128                        'post_status'  => 'publish',
     
    139139                $this->set_permalink_structure( '/%year%/%postname%/' );
    140140
    141                 $id = $this->factory->post->create( array(
     141                $id = self::$factory->post->create( array(
    142142                        'post_author'  => $this->author_id,
    143143                        'post_status'  => 'publish',
     
    156156                $this->set_permalink_structure( '/%year%/%postname%/' );
    157157
    158                 $id = $this->factory->post->create( array(
     158                $id = self::$factory->post->create( array(
    159159                        'post_author'  => $this->author_id,
    160160                        'post_status'  => 'publish',
     
    171171                $this->set_permalink_structure( '/%year%/%postname%/' );
    172172
    173                 $id = $this->factory->post->create( array(
     173                $id = self::$factory->post->create( array(
    174174                        'post_author'  => $this->author_id,
    175175                        'post_status'  => 'publish',
     
    187187                $this->set_permalink_structure( '/%year%/%postname%/' );
    188188
    189                 $id = $this->factory->post->create( array(
     189                $id = self::$factory->post->create( array(
    190190                        'post_author'  => $this->author_id,
    191191                        'post_status'  => 'publish',
     
    201201                $this->set_permalink_structure( '/%year%/%postname%/' );
    202202
    203                 $id = $this->factory->post->create( array(
     203                $id = self::$factory->post->create( array(
    204204                        'post_author'  => $this->author_id,
    205205                        'post_status'  => 'publish',
     
    217217                $this->set_permalink_structure( '/%year%/%postname%/' );
    218218
    219                 $id = $this->factory->post->create( array(
     219                $id = self::$factory->post->create( array(
    220220                        'post_author'  => $this->author_id,
    221221                        'post_status'  => 'publish',
     
    231231                $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' );
    232232
    233                 $id = $this->factory->post->create( array(
     233                $id = self::$factory->post->create( array(
    234234                        'post_author'  => $this->author_id,
    235235                        'post_status'  => 'publish',
     
    248248                $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' );
    249249
    250                 $id = $this->factory->post->create( array(
     250                $id = self::$factory->post->create( array(
    251251                        'post_author'  => $this->author_id,
    252252                        'post_status'  => 'publish',
     
    263263                $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' );
    264264
    265                 $id = $this->factory->post->create( array(
     265                $id = self::$factory->post->create( array(
    266266                        'post_author'  => $this->author_id,
    267267                        'post_status'  => 'publish',
     
    279279                $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' );
    280280
    281                 $id = $this->factory->post->create( array(
     281                $id = self::$factory->post->create( array(
    282282                        'post_author'  => $this->author_id,
    283283                        'post_status'  => 'publish',
     
    293293                $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' );
    294294
    295                 $id = $this->factory->post->create( array(
     295                $id = self::$factory->post->create( array(
    296296                        'post_author'  => $this->author_id,
    297297                        'post_status'  => 'publish',
     
    315315
    316316                // Make sure a post is published in 2013/02, to avoid 404s.
    317                 $this->factory->post->create( array(
     317                self::$factory->post->create( array(
    318318                        'post_author'  => $this->author_id,
    319319                        'post_status'  => 'publish',
     
    323323                ) );
    324324
    325                 $id = $this->factory->post->create( array(
     325                $id = self::$factory->post->create( array(
    326326                        'post_author'  => $this->author_id,
    327327                        'post_status'  => 'publish',
     
    343343
    344344                // Make sure a post is published on 2015/01/01, to avoid 404s.
    345                 $this->factory->post->create( array(
     345                self::$factory->post->create( array(
    346346                        'post_author'  => $this->author_id,
    347347                        'post_status'  => 'publish',
     
    351351                ) );
    352352
    353                 $id = $this->factory->post->create( array(
     353                $id = self::$factory->post->create( array(
    354354                        'post_author'  => $this->author_id,
    355355                        'post_status'  => 'publish',
     
    370370                $this->set_permalink_structure( '/%year%/%postname%/' );
    371371
    372                 $id = $this->factory->post->create( array(
     372                $id = self::$factory->post->create( array(
    373373                        'post_author'  => $this->author_id,
    374374                        'post_status'  => 'publish',
     
    386386                $this->set_permalink_structure( '/%year%/%postname%/' );
    387387
    388                 $id = $this->factory->post->create( array(
     388                $id = self::$factory->post->create( array(
    389389                        'post_author'  => $this->author_id,
    390390                        'post_status'  => 'publish',
     
    402402                $this->set_permalink_structure( '/%year%/%postname%/' );
    403403
    404                 $id = $this->factory->post->create( array(
     404                $id = self::$factory->post->create( array(
    405405                        'post_author'  => $this->author_id,
    406406                        'post_status'  => 'publish',
     
    419419                $this->set_permalink_structure( '/%year%/%postname%/' );
    420420
    421                 $id = $this->factory->post->create( array(
     421                $id = self::$factory->post->create( array(
    422422                        'post_author'  => $this->author_id,
    423423                        'post_status'  => 'publish',
  • trunk/tests/phpunit/tests/rewrite/oldSlugRedirect.php

    r34810 r35225  
    1313                parent::setUp();
    1414
    15                 $this->post_id = $this->factory->post->create( array(
     15                $this->post_id = self::$factory->post->create( array(
    1616                        'post_title'   => 'Foo Bar',
    1717                        'post_name'   => 'foo-bar',
     
    100100        public function test_old_slug_redirect_attachment() {
    101101                $file          = DIR_TESTDATA . '/images/canola.jpg';
    102                 $attachment_id = $this->factory->attachment->create_object( $file, $this->post_id, array(
     102                $attachment_id = self::$factory->attachment->create_object( $file, $this->post_id, array(
    103103                        'post_mime_type' => 'image/jpeg',
    104104                        'post_name'      => 'my-attachment',
  • trunk/tests/phpunit/tests/taxonomy.php

    r34247 r35225  
    3535
    3636        function test_get_the_taxonomies() {
    37                 $post_id = $this->factory->post->create();
     37                $post_id = self::$factory->post->create();
    3838
    3939                $taxes = get_the_taxonomies( $post_id );
     
    4141                $this->assertEquals( array( 'category' ), array_keys( $taxes ) );
    4242
    43                 $id = $this->factory->tag->create();
     43                $id = self::$factory->tag->create();
    4444                wp_set_post_tags( $post_id, array( $id ) );
    4545
     
    5454         */
    5555        public function test_get_the_taxonomies_term_template() {
    56                 $post_id = $this->factory->post->create();
     56                $post_id = self::$factory->post->create();
    5757
    5858                $taxes = get_the_taxonomies( $post_id, array( 'term_template' => '%2$s' ) );
     
    6565
    6666        function test_the_taxonomies() {
    67                 $post_id = $this->factory->post->create();
     67                $post_id = self::$factory->post->create();
    6868
    6969                ob_start();
     
    8080         */
    8181        function test_the_taxonomies_term_template() {
    82                 $post_id = $this->factory->post->create();
     82                $post_id = self::$factory->post->create();
    8383
    8484                $output = get_echo( 'the_taxonomies', array( array( 'post' => $post_id, 'term_template' => '%2$s' ) ) );
     
    263263
    264264        public function test_get_objects_in_term_should_return_objects_ids() {
    265                 $tag_id = $this->factory->tag->create();
    266                 $cat_id = $this->factory->category->create();
     265                $tag_id = self::$factory->tag->create();
     266                $cat_id = self::$factory->category->create();
    267267                $posts_with_tag = array();
    268268                $posts_with_category = array();
    269269
    270270                for ( $i = 0; $i < 3; $i++ ) {
    271                         $post_id = $this->factory->post->create();
     271                        $post_id = self::$factory->post->create();
    272272                        wp_set_post_tags( $post_id, array( $tag_id ) );
    273273                        $posts_with_tag[] = $post_id;
     
    275275
    276276                for ( $i = 0; $i < 3; $i++ ) {
    277                         $post_id = $this->factory->post->create();
     277                        $post_id = self::$factory->post->create();
    278278                        wp_set_post_categories( $post_id, array( $cat_id ) );
    279279                        $posts_with_category[] = $post_id;
     
    281281
    282282                for ( $i = 0; $i < 3; $i++ ) {
    283                         $this->factory->post->create();
     283                        self::$factory->post->create();
    284284                }
    285285
     
    296296         */
    297297        function test_in_category() {
    298                 $post = $this->factory->post->create_and_get();
     298                $post = self::$factory->post->create_and_get();
    299299
    300300                // in_category() returns false when first parameter is empty()
     
    347347        public function test_get_ancestors_taxonomy_non_hierarchical() {
    348348                register_taxonomy( 'wptests_tax', 'post' );
    349                 $t = $this->factory->term->create( array(
     349                $t = self::$factory->term->create( array(
    350350                        'taxonomy' => 'wptests_tax',
    351351                ) );
     
    359359                        'hierarchical' => true,
    360360                ) );
    361                 $t1 = $this->factory->term->create( array(
    362                         'taxonomy' => 'wptests_tax',
    363                 ) );
    364                 $t2 = $this->factory->term->create( array(
     361                $t1 = self::$factory->term->create( array(
     362                        'taxonomy' => 'wptests_tax',
     363                ) );
     364                $t2 = self::$factory->term->create( array(
    365365                        'taxonomy' => 'wptests_tax',
    366366                        'parent' => $t1,
    367367                ) );
    368                 $t3 = $this->factory->term->create( array(
     368                $t3 = self::$factory->term->create( array(
    369369                        'taxonomy' => 'wptests_tax',
    370370                        'parent' => $t2,
    371371                ) );
    372                 $t4 = $this->factory->term->create( array(
     372                $t4 = self::$factory->term->create( array(
    373373                        'taxonomy' => 'wptests_tax',
    374374                        'parent' => $t1,
     
    381381        public function test_get_ancestors_post_type_non_hierarchical() {
    382382                register_post_type( 'wptests_pt' );
    383                 $p = $this->factory->post->create( array(
     383                $p = self::$factory->post->create( array(
    384384                        'taxonomy' => 'wptests_pt',
    385385                ) );
     
    392392                        'hierarchical' => true,
    393393                ) );
    394                 $p1 = $this->factory->post->create( array(
     394                $p1 = self::$factory->post->create( array(
    395395                        'post_type' => 'wptests_pt',
    396396                ) );
    397                 $p2 = $this->factory->post->create( array(
     397                $p2 = self::$factory->post->create( array(
    398398                        'post_type' => 'wptests_pt',
    399399                        'post_parent' => $p1,
    400400                ) );
    401                 $p3 = $this->factory->post->create( array(
     401                $p3 = self::$factory->post->create( array(
    402402                        'post_type' => 'wptests_pt',
    403403                        'post_parent' => $p2,
    404404                ) );
    405                 $p4 = $this->factory->post->create( array(
     405                $p4 = self::$factory->post->create( array(
    406406                        'post_type' => 'wptests_pt',
    407407                        'post_parent' => $p1,
     
    419419                        'hierarchical' => true,
    420420                ) );
    421                 $p1 = $this->factory->post->create( array(
     421                $p1 = self::$factory->post->create( array(
    422422                        'post_type' => 'wptests_conflict',
    423423                ) );
    424                 $p2 = $this->factory->post->create( array(
     424                $p2 = self::$factory->post->create( array(
    425425                        'post_type' => 'wptests_conflict',
    426426                        'post_parent' => $p1,
     
    430430                        'hierarchical' => true,
    431431                ) );
    432                 $t1 = $this->factory->term->create( array(
     432                $t1 = self::$factory->term->create( array(
    433433                        'taxonomy' => 'wptests_conflict',
    434434                ) );
    435                 $t2 = $this->factory->term->create( array(
     435                $t2 = self::$factory->term->create( array(
    436436                        'taxonomy' => 'wptests_conflict',
    437437                        'parent' => $t1,
     
    452452                ) );
    453453
    454                 $t = $this->factory->term->create_and_get( array(
    455                         'taxonomy' => 'wptests_tax',
    456                 ) );
    457 
    458                 $p = $this->factory->post->create();
     454                $t = self::$factory->term->create_and_get( array(
     455                        'taxonomy' => 'wptests_tax',
     456                ) );
     457
     458                $p = self::$factory->post->create();
    459459                wp_set_object_terms( $p, $t->slug, 'wptests_tax' );
    460460
     
    472472                ) );
    473473
    474                 $t = $this->factory->term->create_and_get( array(
    475                         'taxonomy' => 'wptests_tax',
    476                 ) );
    477 
    478                 $p = $this->factory->post->create();
     474                $t = self::$factory->term->create_and_get( array(
     475                        'taxonomy' => 'wptests_tax',
     476                ) );
     477
     478                $p = self::$factory->post->create();
    479479                wp_set_object_terms( $p, $t->slug, 'wptests_tax' );
    480480
  • trunk/tests/phpunit/tests/term.php

    r35186 r35225  
    2424                ) );
    2525
    26                 $parent = $this->factory->term->create( array(
    27                         'taxonomy' => 'wptests_tax',
    28                 ) );
    29 
    30                 $child = $this->factory->term->create( array(
     26                $parent = self::$factory->term->create( array(
     27                        'taxonomy' => 'wptests_tax',
     28                ) );
     29
     30                $child = self::$factory->term->create( array(
    3131                        'taxonomy' => 'wptests_tax',
    3232                        'parent' => $parent,
     
    227227                register_taxonomy( 'wptests_tax', 'post' );
    228228                $p = self::$post_ids[0];
    229                 $t1 = $this->factory->term->create( array(
    230                         'taxonomy' => 'wptests_tax',
    231                 ) );
    232                 $t2 = $this->factory->term->create( array(
     229                $t1 = self::$factory->term->create( array(
     230                        'taxonomy' => 'wptests_tax',
     231                ) );
     232                $t2 = self::$factory->term->create( array(
    233233                        'taxonomy' => 'wptests_tax',
    234234                ) );
     
    248248                register_taxonomy( 'wptests_tax', 'post' );
    249249                $p = self::$post_ids[0];
    250                 $t1 = $this->factory->term->create( array(
    251                         'taxonomy' => 'wptests_tax',
    252                 ) );
    253                 $t2 = $this->factory->term->create( array(
     250                $t1 = self::$factory->term->create( array(
     251                        'taxonomy' => 'wptests_tax',
     252                ) );
     253                $t2 = self::$factory->term->create( array(
    254254                        'taxonomy' => 'wptests_tax',
    255255                ) );
     
    269269                register_taxonomy( 'wptests_tax', 'post' );
    270270                $p = self::$post_ids[0];
    271                 $t1 = $this->factory->term->create( array(
    272                         'taxonomy' => 'wptests_tax',
    273                 ) );
    274                 $t2 = $this->factory->term->create( array(
     271                $t1 = self::$factory->term->create( array(
     272                        'taxonomy' => 'wptests_tax',
     273                ) );
     274                $t2 = self::$factory->term->create( array(
    275275                        'taxonomy' => 'wptests_tax',
    276276                ) );
     
    365365        function test_wp_add_remove_object_terms() {
    366366                $posts = self::$post_ids;
    367                 $tags = $this->factory->tag->create_many( 5 );
     367                $tags = self::$factory->tag->create_many( 5 );
    368368
    369369                $tt = wp_add_object_terms( $posts[0], $tags[1], 'post_tag' );
     
    524524        function test_object_term_cache_when_term_changes() {
    525525                $post_id = self::$post_ids[0];
    526                 $tag_id = $this->factory->tag->create( array(
     526                $tag_id = self::$factory->tag->create( array(
    527527                        'name' => 'Amaze Tag',
    528528                        'description' => 'My Amazing Tag'
     
    554554                $p = self::$post_ids[0];
    555555                register_taxonomy( 'wptests_tax', 'post' );
    556                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     556                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    557557                wp_set_object_terms( $p, $t, 'wptests_tax' );
    558558
     
    573573                $p = self::$post_ids[0];
    574574                register_taxonomy( 'wptests_tax', 'post' );
    575                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     575                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    576576                wp_set_object_terms( $p, $t, 'wptests_tax' );
    577577
     
    619619         */
    620620        function test_orphan_category() {
    621                 $cat_id1 = $this->factory->category->create();
     621                $cat_id1 = self::$factory->category->create();
    622622
    623623                wp_delete_category( $cat_id1 );
    624624
    625                 $cat_id2 = $this->factory->category->create( array( 'parent' => $cat_id1 ) );
     625                $cat_id2 = self::$factory->category->create( array( 'parent' => $cat_id1 ) );
    626626                $this->assertWPError( $cat_id2 );
    627627        }
  • trunk/tests/phpunit/tests/term/cache.php

    r35171 r35225  
    1616        function test_category_children_cache() {
    1717                // Test with only one Parent => Child
    18                 $term_id1 = $this->factory->category->create();
    19                 $term_id1_child = $this->factory->category->create( array( 'parent' => $term_id1 ) );
     18                $term_id1 = self::$factory->category->create();
     19                $term_id1_child = self::$factory->category->create( array( 'parent' => $term_id1 ) );
    2020                $hierarchy = _get_term_hierarchy( 'category' );
    2121
     
    2323
    2424                // Add another Parent => Child
    25                 $term_id2 = $this->factory->category->create();
    26                 $term_id2_child = $this->factory->category->create( array( 'parent' => $term_id2 ) );
     25                $term_id2 = self::$factory->category->create();
     26                $term_id2_child = self::$factory->category->create( array( 'parent' => $term_id2 ) );
    2727                $hierarchy = _get_term_hierarchy( 'category' );
    2828
     
    3434         */
    3535        function test_category_name_change() {
    36                 $term = $this->factory->category->create_and_get( array( 'name' => 'Foo' ) );
    37                 $post_id = $this->factory->post->create();
     36                $term = self::$factory->category->create_and_get( array( 'name' => 'Foo' ) );
     37                $post_id = self::$factory->post->create();
    3838                wp_set_post_categories( $post_id, $term->term_id );
    3939
     
    9999
    100100                register_taxonomy( 'wptests_tax', 'post' );
    101                 $term = $this->factory->term->create( array(
     101                $term = self::$factory->term->create( array(
    102102                        'taxonomy' => 'wptests_tax',
    103103                ) );
     
    125125
    126126                register_taxonomy( 'wptests_tax', 'post' );
    127                 $term = $this->factory->term->create( array(
     127                $term = self::$factory->term->create( array(
    128128                        'taxonomy' => 'wptests_tax',
    129129                ) );
     
    152152
    153153                register_taxonomy( 'wptests_tax', 'post' );
    154                 $term = $this->factory->term->create( array(
     154                $term = self::$factory->term->create( array(
    155155                        'taxonomy' => 'wptests_tax',
    156156                ) );
     
    183183                register_taxonomy( 'wptests_tax', 'post' );
    184184
    185                 $terms = $this->factory->term->create_many( 5, array(
     185                $terms = self::$factory->term->create_many( 5, array(
    186186                        'taxonomy' => 'wptests_tax',
    187187                ) );
  • trunk/tests/phpunit/tests/term/categoryExists.php

    r31140 r35225  
    66         */
    77        public function test_category_exists_should_return_only_top_level_categories_when_parent_is_0() {
    8                 $c1 = $this->factory->category->create();
    9                 $c2 = $this->factory->category->create( array(
     8                $c1 = self::$factory->category->create();
     9                $c2 = self::$factory->category->create( array(
    1010                        'name' => 'Foo',
    1111                        'parent' => $c1,
    1212                ) );
    13                 $c3 = $this->factory->category->create( array(
     13                $c3 = self::$factory->category->create( array(
    1414                        'name' => 'Foo',
    1515                ) );
     
    2525        public function test_category_exists_should_select_oldest_matching_category_when_no_parent_is_specified_1() {
    2626                // Foo child of c1 is created first.
    27                 $c1 = $this->factory->category->create();
    28                 $c2 = $this->factory->category->create( array(
     27                $c1 = self::$factory->category->create();
     28                $c2 = self::$factory->category->create( array(
    2929                        'name' => 'Foo',
    3030                        'parent' => $c1,
    3131                ) );
    32                 $c3 = $this->factory->category->create( array(
     32                $c3 = self::$factory->category->create( array(
    3333                        'name' => 'Foo',
    3434                ) );
     
    4444        public function test_category_exists_should_select_oldest_matching_category_when_no_parent_is_specified_2() {
    4545                // Top-level Foo is created first.
    46                 $c1 = $this->factory->category->create();
    47                 $c2 = $this->factory->category->create( array(
     46                $c1 = self::$factory->category->create();
     47                $c2 = self::$factory->category->create( array(
    4848                        'name' => 'Foo',
    4949                ) );
    50                 $c3 = $this->factory->category->create( array(
     50                $c3 = self::$factory->category->create( array(
    5151                        'name' => 'Foo',
    5252                        'parent' => $c1,
     
    6262         */
    6363        public function test_category_exists_should_respect_nonempty_parent() {
    64                 $c1 = $this->factory->category->create();
    65                 $c2 = $this->factory->category->create( array(
     64                $c1 = self::$factory->category->create();
     65                $c2 = self::$factory->category->create( array(
    6666                        'name' => 'Foo',
    6767                        'parent' => $c1,
    6868                ) );
    69                 $c3 = $this->factory->category->create( array(
     69                $c3 = self::$factory->category->create( array(
    7070                        'name' => 'Foo',
    7171                ) );
  • trunk/tests/phpunit/tests/term/getEditTermLink.php

    r34519 r35225  
    77        public function setUp() {
    88                parent::setUp();
    9                 wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     9                wp_set_current_user( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    1010                register_taxonomy( 'wptests_tax', 'post' );
    1111        }
    1212
    1313        public function test_get_edit_term_link_default() {
    14                 $term1 = $this->factory->term->create( array(
     14                $term1 = self::$factory->term->create( array(
    1515                        'taxonomy' => 'wptests_tax',
    1616                        'name' => 'foo',
     
    2626         */
    2727        public function test_get_edit_term_link_invalid_id() {
    28                 $term1 = $this->factory->term->create( array(
     28                $term1 = self::$factory->term->create( array(
    2929                        'taxonomy' => 'wptests_tax',
    3030                        'name' => 'foo',
  • trunk/tests/phpunit/tests/term/getTerm.php

    r34997 r35225  
    2525                global $wpdb;
    2626
    27                 $term = $this->factory->term->create_and_get( array( 'taxonomy' => 'wptests_tax' ) );
     27                $term = self::$factory->term->create_and_get( array( 'taxonomy' => 'wptests_tax' ) );
    2828                clean_term_cache( $term->term_id, 'wptests_tax' );
    2929
     
    4747                global $wpdb;
    4848
    49                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     49                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    5050                clean_term_cache( $t, 'wptests_tax' );
    5151
     
    6161
    6262        public function test_output_object() {
    63                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     63                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    6464                $this->assertInternalType( 'object', get_term( $t, 'wptests_tax', OBJECT ) );
    6565        }
    6666
    6767        public function test_output_array_a() {
    68                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     68                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    6969                $term = get_term( $t, 'wptests_tax', ARRAY_A );
    7070                $this->assertInternalType( 'array', $term );
     
    7373
    7474        public function test_output_array_n() {
    75                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     75                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    7676                $term = get_term( $t, 'wptests_tax', ARRAY_N );
    7777                $this->assertInternalType( 'array', $term );
     
    8383
    8484        public function test_output_should_fall_back_to_object_for_invalid_input() {
    85                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     85                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    8686                $this->assertInternalType( 'object', get_term( $t, 'wptests_tax', 'foo' ) );
    8787        }
     
    9393                global $wpdb;
    9494
    95                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     95                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    9696
    9797                // Get raw data from the database.
  • trunk/tests/phpunit/tests/term/getTermBy.php

    r34997 r35225  
    2929
    3030                $slug = 'ńaș';
    31                 $t = $this->factory->term->create( array(
     31                $t = self::$factory->term->create( array(
    3232                        'slug' => $slug,
    3333                        'taxonomy' => 'wptests_tax',
     
    4545
    4646                register_taxonomy( 'wptests_tax', 'post' );
    47                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     47                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    4848                $term = get_term( $t, 'wptests_tax' );
    4949
     
    6868
    6969                register_taxonomy( 'wptests_tax', 'post' );
    70                 $t = $this->factory->term->create( array(
     70                $t = self::$factory->term->create( array(
    7171                        'taxonomy' => 'wptests_tax',
    7272                        'slug' => 'foo',
  • trunk/tests/phpunit/tests/term/getTermField.php

    r35028 r35225  
    1818         */
    1919        public function test_get_term_field_should_not_return_error_for_empty_taxonomy() {
    20                 $term = $this->factory->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );
     20                $term = self::$factory->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );
    2121
    2222                $found = get_term_field( 'taxonomy', $term->term_id, '' );
     
    2929         */
    3030        public function test_get_term_field_supplying_a_taxonomy() {
    31                 $term = $this->factory->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );
     31                $term = self::$factory->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );
    3232
    3333                $found = get_term_field( 'taxonomy', $term->term_id, $term->taxonomy );
     
    3939         */
    4040        public function test_get_term_field_supplying_no_taxonomy() {
    41                 $term = $this->factory->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );
     41                $term = self::$factory->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );
    4242
    4343                $found = get_term_field( 'taxonomy', $term->term_id );
     
    4949         */
    5050        public function test_get_term_field_should_accept_a_WP_Term_object_or_a_term_id() {
    51                 $term = $this->factory->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );
     51                $term = self::$factory->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );
    5252
    5353                $this->assertInstanceOf( 'WP_Term', $term );
     
    6060         */
    6161        public function test_get_term_field_invalid_taxonomy_should_return_WP_Error() {
    62                 $term = $this->factory->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );
     62                $term = self::$factory->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );
    6363
    6464                $found = get_term_field( 'taxonomy', $term, 'foo-taxonomy' );
  • trunk/tests/phpunit/tests/term/getTermLink.php

    r34810 r35225  
    1313
    1414        public function test_integer_should_be_interpreted_as_term_id() {
    15                 $t1 = $this->factory->term->create( array(
     15                $t1 = self::$factory->term->create( array(
    1616                        'taxonomy' => 'wptests_tax',
    1717                        'name' => 'foo',
    1818                ) );
    19                 $t2 = $this->factory->term->create( array(
     19                $t2 = self::$factory->term->create( array(
    2020                        'taxonomy' => 'wptests_tax',
    2121                        'slug' => $t1,
     
    2929
    3030        public function test_numeric_string_should_be_interpreted_as_term_slug() {
    31                 $t1 = $this->factory->term->create( array(
     31                $t1 = self::$factory->term->create( array(
    3232                        'taxonomy' => 'wptests_tax',
    3333                        'name' => 'foo',
    3434                ) );
    35                 $t2 = $this->factory->term->create( array(
     35                $t2 = self::$factory->term->create( array(
    3636                        'taxonomy' => 'wptests_tax',
    3737                        'slug' => $t1,
     
    5050
    5151        public function test_category_should_use_cat_query_var_with_term_id() {
    52                 $c = $this->factory->category->create();
     52                $c = self::$factory->category->create();
    5353
    5454                $actual = get_term_link( $c, 'category' );
     
    6161                ) );
    6262
    63                 $t = $this->factory->term->create( array(
     63                $t = self::$factory->term->create( array(
    6464                        'taxonomy' => 'wptests_tax2',
    6565                        'slug' => 'bar',
     
    7575                ) );
    7676
    77                 $t = $this->factory->term->create( array(
     77                $t = self::$factory->term->create( array(
    7878                        'taxonomy' => 'wptests_tax2',
    7979                        'slug' => 'bar',
     
    9898                flush_rewrite_rules();
    9999
    100                 $t1 = $this->factory->term->create( array(
     100                $t1 = self::$factory->term->create( array(
    101101                        'taxonomy' => 'wptests_tax2',
    102102                        'slug' => 'term1',
    103103                ) );
    104104
    105                 $t2 = $this->factory->term->create( array(
     105                $t2 = self::$factory->term->create( array(
    106106                        'taxonomy' => 'wptests_tax2',
    107107                        'slug' => 'term2',
     
    127127                flush_rewrite_rules();
    128128
    129                 $t1 = $this->factory->term->create( array(
     129                $t1 = self::$factory->term->create( array(
    130130                        'taxonomy' => 'wptests_tax2',
    131131                        'slug' => 'term1',
    132132                ) );
    133133
    134                 $t2 = $this->factory->term->create( array(
     134                $t2 = self::$factory->term->create( array(
    135135                        'taxonomy' => 'wptests_tax2',
    136136                        'slug' => 'term2',
  • trunk/tests/phpunit/tests/term/getTerms.php

    r35196 r35225  
    106106         */
    107107        function test_get_terms_should_allow_arbitrary_indexed_taxonomies_array() {
    108                 $term_id = $this->factory->tag->create();
     108                $term_id = self::$factory->tag->create();
    109109                $terms = get_terms( array( '111' => 'post_tag' ), array( 'hide_empty' => false ) );
    110110                $this->assertEquals( $term_id, reset( $terms )->term_id );
     
    115115         */
    116116        function test_get_terms_fields() {
    117                 $term_id1 = $this->factory->tag->create( array( 'slug' => 'woo', 'name' => 'WOO!' ) );
    118                 $term_id2 = $this->factory->tag->create( array( 'slug' => 'hoo', 'name' => 'HOO!', 'parent' => $term_id1 ) );
     117                $term_id1 = self::$factory->tag->create( array( 'slug' => 'woo', 'name' => 'WOO!' ) );
     118                $term_id2 = self::$factory->tag->create( array( 'slug' => 'hoo', 'name' => 'HOO!', 'parent' => $term_id1 ) );
    119119
    120120                $terms_id_parent = get_terms( 'post_tag', array( 'hide_empty' => false, 'fields' => 'id=>parent' ) );
     
    149149                global $wpdb;
    150150
    151                 $term_id1 = $this->factory->tag->create();
    152                 $term_id2 = $this->factory->tag->create();
     151                $term_id1 = self::$factory->tag->create();
     152                $term_id2 = self::$factory->tag->create();
    153153                $inc_terms = get_terms( 'post_tag', array(
    154154                        'include' => array( $term_id1, $term_id2 ),
     
    180180                register_taxonomy( 'wptests_tax', 'post' );
    181181
    182                 $terms = $this->factory->term->create_many( 2, array(
     182                $terms = self::$factory->term->create_many( 2, array(
    183183                        'taxonomy' => 'wptests_tax',
    184184                ) );
     
    203203                $term_id_uncategorized = get_option( 'default_category' );
    204204
    205                 $term_id1 = $this->factory->category->create();
    206                 $term_id11 = $this->factory->category->create( array( 'parent' => $term_id1 ) );
    207                 $term_id2 = $this->factory->category->create();
    208                 $term_id22 = $this->factory->category->create( array( 'parent' => $term_id2 ) );
     205                $term_id1 = self::$factory->category->create();
     206                $term_id11 = self::$factory->category->create( array( 'parent' => $term_id1 ) );
     207                $term_id2 = self::$factory->category->create();
     208                $term_id22 = self::$factory->category->create( array( 'parent' => $term_id2 ) );
    209209
    210210                $terms = get_terms( 'category', array(
     
    229229         */
    230230        function test_get_terms_search() {
    231                 $term_id1 = $this->factory->tag->create( array( 'slug' => 'burrito' ) );
    232                 $term_id2 = $this->factory->tag->create( array( 'name' => 'Wilbur' ) );
     231                $term_id1 = self::$factory->tag->create( array( 'slug' => 'burrito' ) );
     232                $term_id2 = self::$factory->tag->create( array( 'name' => 'Wilbur' ) );
    233233
    234234                $terms = get_terms( 'post_tag', array( 'hide_empty' => false, 'search' => 'bur', 'fields' => 'ids' ) );
     
    240240         */
    241241        function test_get_terms_like() {
    242                 $term_id1 = $this->factory->tag->create( array( 'name' => 'burrito', 'description' => 'This is a burrito.' ) );
    243                 $term_id2 = $this->factory->tag->create( array( 'name' => 'taco', 'description' => 'Burning man.' ) );
     242                $term_id1 = self::$factory->tag->create( array( 'name' => 'burrito', 'description' => 'This is a burrito.' ) );
     243                $term_id2 = self::$factory->tag->create( array( 'name' => 'taco', 'description' => 'Burning man.' ) );
    244244
    245245                $terms = get_terms( 'post_tag', array( 'hide_empty' => false, 'name__like' => 'bur', 'fields' => 'ids' ) );
     
    275275                register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
    276276
    277                 $cheese = $this->factory->term->create( array( 'name' => 'Cheese', 'taxonomy' => $tax ) );
    278 
    279                 $cheddar = $this->factory->term->create( array( 'name' => 'Cheddar', 'parent' => $cheese, 'taxonomy' => $tax ) );
    280 
    281                 $post_ids = $this->factory->post->create_many( 2 );
     277                $cheese = self::$factory->term->create( array( 'name' => 'Cheese', 'taxonomy' => $tax ) );
     278
     279                $cheddar = self::$factory->term->create( array( 'name' => 'Cheddar', 'parent' => $cheese, 'taxonomy' => $tax ) );
     280
     281                $post_ids = self::$factory->post->create_many( 2 );
    282282                foreach ( $post_ids as $id ) {
    283283                        wp_set_post_terms( $id, $cheddar, $tax );
     
    286286                $this->assertEquals( 2, $term->count );
    287287
    288                 $brie = $this->factory->term->create( array( 'name' => 'Brie', 'parent' => $cheese, 'taxonomy' => $tax ) );
    289                 $post_id = $this->factory->post->create();
     288                $brie = self::$factory->term->create( array( 'name' => 'Brie', 'parent' => $cheese, 'taxonomy' => $tax ) );
     289                $post_id = self::$factory->post->create();
    290290                wp_set_post_terms( $post_id, $brie, $tax );
    291291                $term = get_term( $brie, $tax );
    292292                $this->assertEquals( 1, $term->count );
    293293
    294                 $crackers = $this->factory->term->create( array( 'name' => 'Crackers', 'taxonomy' => $tax ) );
    295 
    296                 $butter = $this->factory->term->create( array( 'name' => 'Butter', 'parent' => $crackers, 'taxonomy' => $tax ) );
    297                 $post_ids = $this->factory->post->create_many( 1 );
     294                $crackers = self::$factory->term->create( array( 'name' => 'Crackers', 'taxonomy' => $tax ) );
     295
     296                $butter = self::$factory->term->create( array( 'name' => 'Butter', 'parent' => $crackers, 'taxonomy' => $tax ) );
     297                $post_ids = self::$factory->post->create_many( 1 );
    298298                foreach ( $post_ids as $id ) {
    299299                        wp_set_post_terms( $id, $butter, $tax );
     
    302302                $this->assertEquals( 1, $term->count );
    303303
    304                 $multigrain = $this->factory->term->create( array( 'name' => 'Multigrain', 'parent' => $crackers, 'taxonomy' => $tax ) );
    305                 $post_ids = $this->factory->post->create_many( 1 );
     304                $multigrain = self::$factory->term->create( array( 'name' => 'Multigrain', 'parent' => $crackers, 'taxonomy' => $tax ) );
     305                $post_ids = self::$factory->post->create_many( 1 );
    306306                foreach ( $post_ids as $id ) {
    307307                        wp_set_post_terms( $id, $multigrain, $tax );
     
    310310                $this->assertEquals( 1, $term->count );
    311311
    312                 $fruit = $this->factory->term->create( array( 'name' => 'Fruit', 'taxonomy' => $tax ) );
    313                 $cranberries = $this->factory->term->create( array( 'name' => 'Cranberries', 'parent' => $fruit, 'taxonomy' => $tax ) );
     312                $fruit = self::$factory->term->create( array( 'name' => 'Fruit', 'taxonomy' => $tax ) );
     313                $cranberries = self::$factory->term->create( array( 'name' => 'Cranberries', 'parent' => $fruit, 'taxonomy' => $tax ) );
    314314
    315315                $terms = get_terms( $tax, array( 'parent' => 0, 'cache_domain' => $tax ) );
     
    325325                register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
    326326
    327                 $cheese = $this->factory->term->create( array( 'name' => 'Cheese', 'taxonomy' => $tax ) );
    328                 $cheddar = $this->factory->term->create( array( 'name' => 'Cheddar', 'parent' => $cheese, 'taxonomy' => $tax ) );
    329                 $spread = $this->factory->term->create( array( 'name' => 'Spread', 'parent' => $cheddar, 'taxonomy' => $tax ) );
    330                 $post_id = $this->factory->post->create();
     327                $cheese = self::$factory->term->create( array( 'name' => 'Cheese', 'taxonomy' => $tax ) );
     328                $cheddar = self::$factory->term->create( array( 'name' => 'Cheddar', 'parent' => $cheese, 'taxonomy' => $tax ) );
     329                $spread = self::$factory->term->create( array( 'name' => 'Spread', 'parent' => $cheddar, 'taxonomy' => $tax ) );
     330                $post_id = self::$factory->post->create();
    331331                wp_set_post_terms( $post_id, $spread, $tax );
    332332                $term = get_term( $spread, $tax );
     
    349349                $t = array();
    350350                foreach ( range( 1, 7 ) as $depth ) {
    351                         $t[$depth] = $this->factory->term->create( array( 'name' => 'term' . $depth, 'taxonomy' => $tax, 'parent' => $parent ) );
     351                        $t[$depth] = self::$factory->term->create( array( 'name' => 'term' . $depth, 'taxonomy' => $tax, 'parent' => $parent ) );
    352352                        $parent = $t[$depth];
    353353                }
    354                 $post_id = $this->factory->post->create();
     354                $post_id = self::$factory->post->create();
    355355                wp_set_post_terms( $post_id, $t[7], $tax );
    356356                $term = get_term( $t[7], $tax );
     
    368368         */
    369369        function test_get_terms_child_of() {
    370                 $parent = $this->factory->category->create();
    371                 $child = $this->factory->category->create( array( 'parent' => $parent ) );
     370                $parent = self::$factory->category->create();
     371                $child = self::$factory->category->create( array( 'parent' => $parent ) );
    372372
    373373                $terms = get_terms( 'category', array( 'child_of' => $parent, 'hide_empty' => false ) );
     
    383383                register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true, ) );
    384384
    385                 $terms = $this->factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
     385                $terms = self::$factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
    386386
    387387                $num_queries = $wpdb->num_queries;
     
    403403                register_taxonomy( 'wptests_tax2', 'post', array( 'hierarchical' => true ) );
    404404
    405                 $t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
    406                 $t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
    407                 $t3 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t2 ) );
     405                $t1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
     406                $t2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
     407                $t3 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t2 ) );
    408408
    409409                $found = get_terms( array( 'wptests_tax1', 'wptests_tax2' ), array(
     
    441441                remove_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10 );
    442442
    443                 $c1 = $this->factory->category->create();
    444                 $c2 = $this->factory->category->create( array( 'parent' => $c1 ) );
    445                 $c3 = $this->factory->category->create( array( 'parent' => $c2 ) );
     443                $c1 = self::$factory->category->create();
     444                $c2 = self::$factory->category->create( array( 'parent' => $c1 ) );
     445                $c3 = self::$factory->category->create( array( 'parent' => $c2 ) );
    446446                wp_update_term( $c1, 'category', array( 'parent' => $c3 ) );
    447447
     
    460460                remove_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10 );
    461461
    462                 $c1 = $this->factory->category->create_and_get();
    463                 $c2 = $this->factory->category->create_and_get( array( 'parent' => $c1->term_id ) );
    464                 $c3 = $this->factory->category->create_and_get( array( 'parent' => $c2->term_id ) );
     462                $c1 = self::$factory->category->create_and_get();
     463                $c2 = self::$factory->category->create_and_get( array( 'parent' => $c1->term_id ) );
     464                $c3 = self::$factory->category->create_and_get( array( 'parent' => $c2->term_id ) );
    465465                wp_update_term( $c1->term_id, 'category', array( 'parent' => $c3->term_id ) );
    466466
     
    473473
    474474        public function test_get_terms_by_slug() {
    475                 $t1 = $this->factory->tag->create( array( 'slug' => 'foo' ) );
    476                 $t2 = $this->factory->tag->create( array( 'slug' => 'bar' ) );
     475                $t1 = self::$factory->tag->create( array( 'slug' => 'foo' ) );
     476                $t2 = self::$factory->tag->create( array( 'slug' => 'bar' ) );
    477477
    478478                $found = get_terms( 'post_tag', array(
     
    489489         */
    490490        public function test_get_terms_by_multiple_slugs() {
    491                 $t1 = $this->factory->tag->create( array( 'slug' => 'foo' ) );
    492                 $t2 = $this->factory->tag->create( array( 'slug' => 'bar' ) );
    493                 $t3 = $this->factory->tag->create( array( 'slug' => 'barry' ) );
     491                $t1 = self::$factory->tag->create( array( 'slug' => 'foo' ) );
     492                $t2 = self::$factory->tag->create( array( 'slug' => 'bar' ) );
     493                $t3 = self::$factory->tag->create( array( 'slug' => 'barry' ) );
    494494
    495495                $found = get_terms( 'post_tag', array(
     
    506506         */
    507507        public function test_get_terms_by_name() {
    508                 $t1 = $this->factory->tag->create( array( 'name' => 'Foo' ) );
    509                 $t2 = $this->factory->tag->create( array( 'name' => 'Bar' ) );
     508                $t1 = self::$factory->tag->create( array( 'name' => 'Foo' ) );
     509                $t2 = self::$factory->tag->create( array( 'name' => 'Bar' ) );
    510510
    511511                $found = get_terms( 'post_tag', array(
     
    522522         */
    523523        public function test_get_terms_by_multiple_names() {
    524                 $t1 = $this->factory->tag->create( array( 'name' => 'Foo' ) );
    525                 $t2 = $this->factory->tag->create( array( 'name' => 'Bar' ) );
    526                 $t3 = $this->factory->tag->create( array( 'name' => 'Barry' ) );
     524                $t1 = self::$factory->tag->create( array( 'name' => 'Foo' ) );
     525                $t2 = self::$factory->tag->create( array( 'name' => 'Bar' ) );
     526                $t3 = self::$factory->tag->create( array( 'name' => 'Barry' ) );
    527527
    528528                $found = get_terms( 'post_tag', array(
     
    541541                register_taxonomy( 'wptests_tax', 'post' );
    542542
    543                 $t = $this->factory->term->create( array(
     543                $t = self::$factory->term->create( array(
    544544                        'taxonomy' => 'wptests_tax',
    545545                        'name' => 'Foo & Bar',
     
    570570                $flat_tax = 'countries';
    571571                register_taxonomy( $flat_tax, 'post', array( 'hierarchical' => false ) );
    572                 $australia = $this->factory->term->create( array( 'name' => 'Australia', 'taxonomy' => $flat_tax ) );
    573                 $china     = $this->factory->term->create( array( 'name' => 'China',     'taxonomy' => $flat_tax ) );
    574                 $tanzania  =  $this->factory->term->create( array( 'name' => 'Tanzania',  'taxonomy' => $flat_tax ) );
     572                $australia = self::$factory->term->create( array( 'name' => 'Australia', 'taxonomy' => $flat_tax ) );
     573                $china     = self::$factory->term->create( array( 'name' => 'China',     'taxonomy' => $flat_tax ) );
     574                $tanzania  =  self::$factory->term->create( array( 'name' => 'Tanzania',  'taxonomy' => $flat_tax ) );
    575575
    576576                $terms = get_terms( $flat_tax, array(
     
    602602                */
    603603                // Level 1
    604                 $canada = $this->factory->term->create( array( 'name' => 'Canada', 'taxonomy' => $tax ) );
     604                $canada = self::$factory->term->create( array( 'name' => 'Canada', 'taxonomy' => $tax ) );
    605605
    606606                // Level 2
    607                 $ontario = $this->factory->term->create( array( 'name' => 'Ontario', 'parent' => $canada, 'taxonomy' => $tax ) );
    608                 $quebec  = $this->factory->term->create( array( 'name' => 'Quebec', 'parent' => $canada, 'taxonomy' => $tax ) );
    609                 $pei     = $this->factory->term->create( array( 'name' => 'PEI', 'parent' => $canada, 'taxonomy' => $tax ) );
     607                $ontario = self::$factory->term->create( array( 'name' => 'Ontario', 'parent' => $canada, 'taxonomy' => $tax ) );
     608                $quebec  = self::$factory->term->create( array( 'name' => 'Quebec', 'parent' => $canada, 'taxonomy' => $tax ) );
     609                $pei     = self::$factory->term->create( array( 'name' => 'PEI', 'parent' => $canada, 'taxonomy' => $tax ) );
    610610
    611611                // Level 3
    612                 $toronto  = $this->factory->term->create( array( 'name' => 'Toronto', 'parent' => $ontario, 'taxonomy' => $tax ) );
    613                 $ottawa   = $this->factory->term->create( array( 'name' => 'Ottawa', 'parent' => $ontario, 'taxonomy' => $tax ) );
    614                 $montreal = $this->factory->term->create( array( 'name' => 'Montreal', 'parent' => $quebec, 'taxonomy' => $tax ) );
     612                $toronto  = self::$factory->term->create( array( 'name' => 'Toronto', 'parent' => $ontario, 'taxonomy' => $tax ) );
     613                $ottawa   = self::$factory->term->create( array( 'name' => 'Ottawa', 'parent' => $ontario, 'taxonomy' => $tax ) );
     614                $montreal = self::$factory->term->create( array( 'name' => 'Montreal', 'parent' => $quebec, 'taxonomy' => $tax ) );
    615615
    616616                // Level 4
    617                 $nepean = $this->factory->term->create( array( 'name' => 'Nepean', 'parent' => $ottawa, 'taxonomy' => $tax ) );
     617                $nepean = self::$factory->term->create( array( 'name' => 'Nepean', 'parent' => $ottawa, 'taxonomy' => $tax ) );
    618618
    619619                $terms = get_terms( $tax, array(
     
    634634
    635635                // Level 1
    636                 $canada = $this->factory->term->create( array( 'name' => 'Canada', 'taxonomy' => $tax ) );
     636                $canada = self::$factory->term->create( array( 'name' => 'Canada', 'taxonomy' => $tax ) );
    637637
    638638                // Level 2
    639                 $ontario = $this->factory->term->create( array( 'name' => 'Ontario', 'parent' => $canada, 'taxonomy' => $tax ) );
    640                 $quebec  = $this->factory->term->create( array( 'name' => 'Quebec', 'parent' => $canada, 'taxonomy' => $tax ) );
     639                $ontario = self::$factory->term->create( array( 'name' => 'Ontario', 'parent' => $canada, 'taxonomy' => $tax ) );
     640                $quebec  = self::$factory->term->create( array( 'name' => 'Quebec', 'parent' => $canada, 'taxonomy' => $tax ) );
    641641
    642642                // Level 3
    643                 $laval   = $this->factory->term->create( array( 'name' => 'Laval', 'parent' => $quebec, 'taxonomy' => $tax ) );
    644                 $montreal = $this->factory->term->create( array( 'name' => 'Montreal', 'parent' => $quebec, 'taxonomy' => $tax ) );
     643                $laval   = self::$factory->term->create( array( 'name' => 'Laval', 'parent' => $quebec, 'taxonomy' => $tax ) );
     644                $montreal = self::$factory->term->create( array( 'name' => 'Montreal', 'parent' => $quebec, 'taxonomy' => $tax ) );
    645645
    646646                // Level 4
    647                 $dorval = $this->factory->term->create( array( 'name' => 'Dorval', 'parent' => $montreal, 'taxonomy' => $tax ) );
     647                $dorval = self::$factory->term->create( array( 'name' => 'Dorval', 'parent' => $montreal, 'taxonomy' => $tax ) );
    648648
    649649                $terms = get_terms( $tax, array(
     
    664664                register_taxonomy( 'wptests_tax2', 'post', array( 'hierarchical' => true ) );
    665665
    666                 $t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
    667                 $t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax1', 'parent' => $t1 ) );
    668                 $t3 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
    669                 $t4 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t3 ) );
     666                $t1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
     667                $t2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax1', 'parent' => $t1 ) );
     668                $t3 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
     669                $t4 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t3 ) );
    670670
    671671                $found = get_terms( array( 'wptests_tax1', 'wptests_tax2' ), array(
     
    10991099                register_taxonomy( 'wptests_tax2', 'post', array( 'hierarchical' => true ) );
    11001100
    1101                 $t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
    1102                 $t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax1', 'parent' => $t1 ) );
    1103                 $t3 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax1', 'parent' => $t2 ) );
    1104 
    1105                 $t4 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
    1106                 $t5 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t4 ) );
    1107                 $t6 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t5 ) );
    1108 
    1109                 $p = $this->factory->post->create();
     1101                $t1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
     1102                $t2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax1', 'parent' => $t1 ) );
     1103                $t3 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax1', 'parent' => $t2 ) );
     1104
     1105                $t4 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
     1106                $t5 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t4 ) );
     1107                $t6 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t5 ) );
     1108
     1109                $p = self::$factory->post->create();
    11101110
    11111111                wp_set_object_terms( $p, $t3, 'wptests_tax1' );
     
    11411141                register_taxonomy( $tax, 'post' );
    11421142
    1143                 $t1 = $this->factory->term->create( array( 'taxonomy' => $tax ) );
    1144                 $t2 = $this->factory->term->create( array( 'taxonomy' => $tax ) );
    1145                 $t3 = $this->factory->term->create( array( 'taxonomy' => $tax ) );
    1146                 $t4 = $this->factory->term->create( array( 'taxonomy' => $tax ) );
     1143                $t1 = self::$factory->term->create( array( 'taxonomy' => $tax ) );
     1144                $t2 = self::$factory->term->create( array( 'taxonomy' => $tax ) );
     1145                $t3 = self::$factory->term->create( array( 'taxonomy' => $tax ) );
     1146                $t4 = self::$factory->term->create( array( 'taxonomy' => $tax ) );
    11471147
    11481148                $found = get_terms( $tax, array(
     
    11651165                register_taxonomy( $tax, 'post' );
    11661166
    1167                 $t1 = $this->factory->term->create( array( 'taxonomy' => $tax, 'description' => 'fff' ) );
    1168                 $t2 = $this->factory->term->create( array( 'taxonomy' => $tax, 'description' => 'aaa' ) );
    1169                 $t3 = $this->factory->term->create( array( 'taxonomy' => $tax, 'description' => 'zzz' ) );
    1170                 $t4 = $this->factory->term->create( array( 'taxonomy' => $tax, 'description' => 'jjj' ) );
     1167                $t1 = self::$factory->term->create( array( 'taxonomy' => $tax, 'description' => 'fff' ) );
     1168                $t2 = self::$factory->term->create( array( 'taxonomy' => $tax, 'description' => 'aaa' ) );
     1169                $t3 = self::$factory->term->create( array( 'taxonomy' => $tax, 'description' => 'zzz' ) );
     1170                $t4 = self::$factory->term->create( array( 'taxonomy' => $tax, 'description' => 'jjj' ) );
    11711171
    11721172                $found = get_terms( $tax, array(
     
    11861186        public function test_orderby_term_id() {
    11871187                register_taxonomy( 'wptests_tax', 'post' );
    1188                 $t1 = $this->factory->term->create( array(
     1188                $t1 = self::$factory->term->create( array(
    11891189                        'taxonomy' => 'wptests_tax',
    11901190                        'name' => 'AAA',
    11911191                ) );
    1192                 $t2 = $this->factory->term->create( array(
     1192                $t2 = self::$factory->term->create( array(
    11931193                        'taxonomy' => 'wptests_tax',
    11941194                        'name' => 'ZZZ',
    11951195                ) );
    1196                 $t3 = $this->factory->term->create( array(
     1196                $t3 = self::$factory->term->create( array(
    11971197                        'taxonomy' => 'wptests_tax',
    11981198                        'name' => 'JJJ',
     
    12441244        public function test_hierarchical_false_with_child_of_and_direct_child() {
    12451245                $initial_terms = $this->create_hierarchical_terms();
    1246                 $post_id = $this->factory->post->create();
     1246                $post_id = self::$factory->post->create();
    12471247                wp_set_post_terms(
    12481248                        $post_id,
     
    13241324                register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true, ) );
    13251325
    1326                 $terms = $this->factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
     1326                $terms = self::$factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
    13271327
    13281328                $num_queries = $wpdb->num_queries;
     
    13441344                register_taxonomy( 'wptests_tax2', 'post', array( 'hierarchical' => true ) );
    13451345
    1346                 $t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
    1347                 $t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
    1348                 $t3 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t2 ) );
     1346                $t1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
     1347                $t2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
     1348                $t3 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t2 ) );
    13491349
    13501350                $found = get_terms( array( 'wptests_tax1', 'wptests_tax2' ), array(
     
    13961396                register_taxonomy( 'wptests_tax_1', 'post', array( 'hierarchical' => true ) );
    13971397
    1398                 $posts = $this->factory->post->create_many( 3 );
    1399 
    1400                 $t1 = $this->factory->term->create( array(
     1398                $posts = self::$factory->post->create_many( 3 );
     1399
     1400                $t1 = self::$factory->term->create( array(
    14011401                        'taxonomy' => 'wptests_tax_1',
    14021402                ) );
    1403                 $t2 = $this->factory->term->create( array(
     1403                $t2 = self::$factory->term->create( array(
    14041404                        'taxonomy' => 'wptests_tax_1',
    14051405                        'parent' => $t1,
    14061406                ) );
    1407                 $t3 = $this->factory->term->create( array(
     1407                $t3 = self::$factory->term->create( array(
    14081408                        'taxonomy' => 'wptests_tax_1',
    14091409                        'parent' => $t2,
     
    14371437                remove_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10 );
    14381438
    1439                 $c1 = $this->factory->category->create();
    1440                 $c2 = $this->factory->category->create( array( 'parent' => $c1 ) );
    1441                 $c3 = $this->factory->category->create( array( 'parent' => $c2 ) );
     1439                $c1 = self::$factory->category->create();
     1440                $c2 = self::$factory->category->create( array( 'parent' => $c1 ) );
     1441                $c3 = self::$factory->category->create( array( 'parent' => $c2 ) );
    14421442                wp_update_term( $c1, 'category', array( 'parent' => $c3 ) );
    14431443
    14441444                add_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10, 3 );
    14451445
    1446                 $posts = $this->factory->post->create_many( 3 );
     1446                $posts = self::$factory->post->create_many( 3 );
    14471447                wp_set_post_terms( $posts[0], $c1, 'category' );
    14481448                wp_set_post_terms( $posts[1], $c2, 'category' );
     
    14671467                register_taxonomy( 'wptests_tax2', 'post', array( 'hierarchical' => true ) );
    14681468
    1469                 $t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
    1470                 $t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
    1471                 $t3 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t2 ) );
    1472 
    1473                 $posts = $this->factory->post->create_many( 3 );
     1469                $t1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
     1470                $t2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
     1471                $t3 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t2 ) );
     1472
     1473                $posts = self::$factory->post->create_many( 3 );
    14741474                wp_set_object_terms( $posts[0], $t1, 'wptests_tax1' );
    14751475                wp_set_object_terms( $posts[1], $t2, 'wptests_tax2' );
     
    15001500
    15011501                register_taxonomy( 'wptests_tax', 'post' );
    1502                 $terms = $this->factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
     1502                $terms = self::$factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
    15031503                add_term_meta( $terms[0], 'foo', 'bar' );
    15041504                add_term_meta( $terms[1], 'foo', 'bar' );
     
    15261526
    15271527                register_taxonomy( 'wptests_tax', 'post' );
    1528                 $terms = $this->factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
     1528                $terms = self::$factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
    15291529                add_term_meta( $terms[0], 'foo', 'bar' );
    15301530                add_term_meta( $terms[1], 'foo', 'bar' );
     
    15511551        public function test_meta_query() {
    15521552                register_taxonomy( 'wptests_tax', 'post' );
    1553                 $terms = $this->factory->term->create_many( 5, array( 'taxonomy' => 'wptests_tax' ) );
     1553                $terms = self::$factory->term->create_many( 5, array( 'taxonomy' => 'wptests_tax' ) );
    15541554                add_term_meta( $terms[0], 'foo', 'bar' );
    15551555                add_term_meta( $terms[1], 'foo', 'bar' );
     
    15761576        public function test_should_return_wp_term_objects() {
    15771577                register_taxonomy( 'wptests_tax', 'post' );
    1578                 $terms = $this->factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
     1578                $terms = self::$factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
    15791579
    15801580                $found = get_terms( 'wptests_tax', array(
     
    15981598
    15991599                register_taxonomy( 'wptests_tax', 'post' );
    1600                 $terms = $this->factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
     1600                $terms = self::$factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
    16011601
    16021602                // Prime the cache.
     
    16291629
    16301630                register_taxonomy( 'wptests_tax', 'post' );
    1631                 $terms = $this->factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
     1631                $terms = self::$factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
    16321632
    16331633                $found = get_terms( 'wptests_tax', array(
     
    16451645                $terms = array();
    16461646
    1647                 $terms['parent1'] = $this->factory->term->create( array( 'slug' => 'parent-1', 'name' => 'Parent 1', 'taxonomy' => 'hierarchical_fields' ) );
    1648                 $terms['parent2'] = $this->factory->term->create( array( 'slug' => 'parent-2', 'name' => 'Parent 2', 'taxonomy' => 'hierarchical_fields' ) );
    1649                 $terms['child1'] = $this->factory->term->create( array( 'slug' => 'child-1', 'name' => 'Child 1', 'taxonomy' => 'hierarchical_fields', 'parent' => $terms['parent1'] ) );
    1650                 $terms['child2'] = $this->factory->term->create( array( 'slug' => 'child-2', 'name' => 'Child 2', 'taxonomy' => 'hierarchical_fields', 'parent' => $terms['parent1'] ) );
    1651                 $terms['grandchild1'] = $this->factory->term->create( array( 'slug' => 'grandchild-1', 'name' => 'Grandchild 1', 'taxonomy' => 'hierarchical_fields', 'parent' => $terms['child1'] ) );
    1652 
    1653                 $post_id = $this->factory->post->create();
     1647                $terms['parent1'] = self::$factory->term->create( array( 'slug' => 'parent-1', 'name' => 'Parent 1', 'taxonomy' => 'hierarchical_fields' ) );
     1648                $terms['parent2'] = self::$factory->term->create( array( 'slug' => 'parent-2', 'name' => 'Parent 2', 'taxonomy' => 'hierarchical_fields' ) );
     1649                $terms['child1'] = self::$factory->term->create( array( 'slug' => 'child-1', 'name' => 'Child 1', 'taxonomy' => 'hierarchical_fields', 'parent' => $terms['parent1'] ) );
     1650                $terms['child2'] = self::$factory->term->create( array( 'slug' => 'child-2', 'name' => 'Child 2', 'taxonomy' => 'hierarchical_fields', 'parent' => $terms['parent1'] ) );
     1651                $terms['grandchild1'] = self::$factory->term->create( array( 'slug' => 'grandchild-1', 'name' => 'Grandchild 1', 'taxonomy' => 'hierarchical_fields', 'parent' => $terms['child1'] ) );
     1652
     1653                $post_id = self::$factory->post->create();
    16541654                wp_set_post_terms( $post_id, $terms['parent2'], 'hierarchical_fields', true );
    16551655                wp_set_post_terms( $post_id, $terms['child1'], 'hierarchical_fields', true );
     
    17151715
    17161716                // Ensure child terms are not empty
    1717                 $first_post_id = $this->factory->post->create();
    1718                 $second_post_id = $this->factory->post->create();
     1717                $first_post_id = self::$factory->post->create();
     1718                $second_post_id = self::$factory->post->create();
    17191719                wp_set_post_terms( $first_post_id, array( $three_term['term_id'] ), 'category' );
    17201720                wp_set_post_terms( $second_post_id, array( $six_term['term_id'] ), 'category' );
     
    17321732
    17331733        protected function set_up_three_posts_and_tags() {
    1734                 $posts = $this->factory->post->create_many( 3, array( 'post_type' => 'post' ) );
     1734                $posts = self::$factory->post->create_many( 3, array( 'post_type' => 'post' ) );
    17351735                foreach ( $posts as $post ) {
    17361736                        wp_set_object_terms( $post, rand_str(), 'post_tag' );
  • trunk/tests/phpunit/tests/term/isObjectInTerm.php

    r34812 r35225  
    88                register_taxonomy( 'wptests_tax', 'post' );
    99
    10                 $t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    11                 $t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     10                $t1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     11                $t2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    1212
    13                 $posts = $this->factory->post->create_many( 2 );
     13                $posts = self::$factory->post->create_many( 2 );
    1414                wp_set_object_terms( $posts[0], array( $t1 ), 'wptests_tax' );
    1515
     
    2323                register_taxonomy( 'wptests_tax', 'post' );
    2424
    25                 $t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    26                 $t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     25                $t1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     26                $t2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    2727
    28                 $posts = $this->factory->post->create_many( 2 );
     28                $posts = self::$factory->post->create_many( 2 );
    2929                wp_set_object_terms( $posts[0], array( $t1 ), 'wptests_tax' );
    3030
     
    4141                register_taxonomy( 'wptests_tax', 'post' );
    4242
    43                 $t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Foo' ) );
    44                 $t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Bar') );
     43                $t1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Foo' ) );
     44                $t2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Bar') );
    4545
    46                 $posts = $this->factory->post->create_many( 2 );
     46                $posts = self::$factory->post->create_many( 2 );
    4747                wp_set_object_terms( $posts[0], array( $t1 ), 'wptests_tax' );
    4848
     
    5656                register_taxonomy( 'wptests_tax', 'post' );
    5757
    58                 $t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax', 'slug' => 'foo' ) );
    59                 $t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax', 'slug' => 'bar') );
     58                $t1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'slug' => 'foo' ) );
     59                $t2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'slug' => 'bar') );
    6060
    61                 $posts = $this->factory->post->create_many( 2 );
     61                $posts = self::$factory->post->create_many( 2 );
    6262                wp_set_object_terms( $posts[0], array( $t1 ), 'wptests_tax' );
    6363
     
    7171                register_taxonomy( 'wptests_tax', 'post' );
    7272
    73                 $t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax', 'slug' => 'foo' ) );
    74                 $t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax', 'slug' => 'bar') );
     73                $t1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'slug' => 'foo' ) );
     74                $t2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax', 'slug' => 'bar') );
    7575
    76                 $posts = $this->factory->post->create_many( 2 );
     76                $posts = self::$factory->post->create_many( 2 );
    7777                wp_set_object_terms( $posts[0], array( $t1 ), 'wptests_tax' );
    7878
     
    8888        public function test_should_not_return_true_if_term_name_begins_with_existing_term_id() {
    8989                register_taxonomy( 'wptests_tax', 'post' );
    90                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     90                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    9191
    92                 $post_ID  = $this->factory->post->create();
     92                $post_ID  = self::$factory->post->create();
    9393                wp_set_object_terms( $post_ID, $t, 'wptests_tax' );
    9494
     
    109109
    110110                register_taxonomy( 'wptests_tax', 'post' );
    111                 $terms = $this->factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
     111                $terms = self::$factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
    112112
    113113                $o = 12345;
     
    130130
    131131                register_taxonomy( 'wptests_tax', 'post' );
    132                 $terms = $this->factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
     132                $terms = self::$factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
    133133
    134134                $o = 12345;
  • trunk/tests/phpunit/tests/term/meta.php

    r35112 r35225  
    1313
    1414        public function test_add() {
    15                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     15                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    1616
    1717                $this->assertNotEmpty( add_term_meta( $t, 'foo', 'bar' ) );
     
    1919
    2020        public function test_add_unique() {
    21                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     21                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    2222
    2323                $this->assertNotEmpty( add_term_meta( $t, 'foo', 'bar' ) );
     
    2626
    2727        public function test_delete() {
    28                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     28                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    2929                add_term_meta( $t, 'foo', 'bar' );
    3030
     
    3333
    3434        public function test_delete_with_invalid_meta_key_should_return_false() {
    35                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     35                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    3636
    3737                $this->assertFalse( delete_term_meta( $t, 'foo' ) );
     
    3939
    4040        public function test_delete_should_respect_meta_value() {
    41                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     41                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    4242                add_term_meta( $t, 'foo', 'bar' );
    4343                add_term_meta( $t, 'foo', 'baz' );
     
    5050
    5151        public function test_get_with_no_key_should_fetch_all_keys() {
    52                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     52                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    5353                add_term_meta( $t, 'foo', 'bar' );
    5454                add_term_meta( $t, 'foo1', 'baz' );
     
    6464
    6565        public function test_get_with_key_should_fetch_all_for_key() {
    66                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     66                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    6767                add_term_meta( $t, 'foo', 'bar' );
    6868                add_term_meta( $t, 'foo', 'baz' );
     
    7676
    7777        public function test_get_should_respect_single_true() {
    78                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     78                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    7979                add_term_meta( $t, 'foo', 'bar' );
    8080                add_term_meta( $t, 'foo', 'baz' );
     
    8585
    8686        public function test_update_should_pass_to_add_when_no_value_exists_for_key() {
    87                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     87                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    8888
    8989                $actual = update_term_meta( $t, 'foo', 'bar' );
     
    9696
    9797        public function test_update_should_return_true_when_updating_existing_value_for_key() {
    98                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     98                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    9999
    100100                add_term_meta( $t, 'foo', 'bar' );
     
    110110                global $wpdb;
    111111
    112                 $p = $this->factory->post->create( array( 'post_status' => 'publish' ) );
     112                $p = self::$factory->post->create( array( 'post_status' => 'publish' ) );
    113113
    114114                register_taxonomy( 'wptests_tax', 'post' );
    115                 $terms = $this->factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
     115                $terms = self::$factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
    116116                wp_set_object_terms( $p, $terms, 'wptests_tax' );
    117117                foreach ( $terms as $t ) {
     
    120120
    121121                // Create another term, which should *not* be lazy loaded because it's unattached.
    122                 $orphan_term = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     122                $orphan_term = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    123123                add_term_meta( $orphan_term, 'foo', 'bar' );
    124124
     
    155155                global $wpdb;
    156156
    157                 $posts = $this->factory->post->create_many( 3, array( 'post_status' => 'publish' ) );
     157                $posts = self::$factory->post->create_many( 3, array( 'post_status' => 'publish' ) );
    158158                register_taxonomy( 'wptests_tax', 'post' );
    159                 $terms = $this->factory->term->create_many( 6, array( 'taxonomy' => 'wptests_tax' ) );
     159                $terms = self::$factory->term->create_many( 6, array( 'taxonomy' => 'wptests_tax' ) );
    160160
    161161                wp_set_object_terms( $posts[0], array( $terms[0], $terms[1] ), 'wptests_tax' );
     
    202202
    203203        public function test_adding_term_meta_should_bust_get_terms_cache() {
    204                 $terms = $this->factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
     204                $terms = self::$factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
    205205
    206206                add_term_meta( $terms[0], 'foo', 'bar' );
     
    237237
    238238        public function test_updating_term_meta_should_bust_get_terms_cache() {
    239                 $terms = $this->factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
     239                $terms = self::$factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
    240240
    241241                add_term_meta( $terms[0], 'foo', 'bar' );
     
    273273
    274274        public function test_deleting_term_meta_should_bust_get_terms_cache() {
    275                 $terms = $this->factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
     275                $terms = self::$factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
    276276
    277277                add_term_meta( $terms[0], 'foo', 'bar' );
  • trunk/tests/phpunit/tests/term/query.php

    r30031 r35225  
    126126
    127127        public function test_transform_query_resulting_field_sanitized() {
    128                 $t1 = $this->factory->category->create( array( 'slug' => 'foo', ) );
    129                 $t2 = $this->factory->category->create( array( 'slug' => 'bar', ) );
    130                 $p = $this->factory->post->create();
     128                $t1 = self::$factory->category->create( array( 'slug' => 'foo', ) );
     129                $t2 = self::$factory->category->create( array( 'slug' => 'bar', ) );
     130                $p = self::$factory->post->create();
    131131                wp_set_post_categories( $p, $t1 );
    132132
     
    151151
    152152        public function test_transform_query_field_slug() {
    153                 $t1 = $this->factory->category->create( array( 'slug' => 'foo', ) );
    154                 $p = $this->factory->post->create();
     153                $t1 = self::$factory->category->create( array( 'slug' => 'foo', ) );
     154                $p = self::$factory->post->create();
    155155                $tt_ids = wp_set_post_categories( $p, $t1 );
    156156
     
    169169
    170170        public function test_transform_query_field_name() {
    171                 $t1 = $this->factory->category->create( array( 'slug' => 'foo', 'name' => 'Foo', ) );
    172                 $p = $this->factory->post->create();
     171                $t1 = self::$factory->category->create( array( 'slug' => 'foo', 'name' => 'Foo', ) );
     172                $p = self::$factory->post->create();
    173173                $tt_ids = wp_set_post_categories( $p, $t1 );
    174174
     
    187187
    188188        public function test_transform_query_field_term_taxonomy_id() {
    189                 $t1 = $this->factory->category->create( array( 'slug' => 'foo', 'name' => 'Foo', ) );
    190                 $p = $this->factory->post->create();
     189                $t1 = self::$factory->category->create( array( 'slug' => 'foo', 'name' => 'Foo', ) );
     190                $p = self::$factory->post->create();
    191191                $tt_ids = wp_set_post_categories( $p, $t1 );
    192192
     
    205205
    206206        public function test_transform_query_field_term_taxonomy_default() {
    207                 $t1 = $this->factory->category->create( array( 'slug' => 'foo', 'name' => 'Foo', ) );
    208                 $p = $this->factory->post->create();
     207                $t1 = self::$factory->category->create( array( 'slug' => 'foo', 'name' => 'Foo', ) );
     208                $p = self::$factory->post->create();
    209209                $tt_ids = wp_set_post_categories( $p, $t1 );
    210210
     
    241241                register_taxonomy( 'wptests_tax', 'post' );
    242242
    243                 $t1 = $this->factory->term->create( array(
    244                         'taxonomy' => 'wptests_tax',
    245                 ) );
    246                 $t2 = $this->factory->term->create( array(
    247                         'taxonomy' => 'wptests_tax',
    248                 ) );
    249                 $t3 = $this->factory->term->create( array(
     243                $t1 = self::$factory->term->create( array(
     244                        'taxonomy' => 'wptests_tax',
     245                ) );
     246                $t2 = self::$factory->term->create( array(
     247                        'taxonomy' => 'wptests_tax',
     248                ) );
     249                $t3 = self::$factory->term->create( array(
    250250                        'taxonomy' => 'wptests_tax',
    251251                ) );
     
    285285                register_taxonomy( 'wptests_tax', 'post' );
    286286
    287                 $t1 = $this->factory->term->create( array(
    288                         'taxonomy' => 'wptests_tax',
    289                 ) );
    290                 $t2 = $this->factory->term->create( array(
    291                         'taxonomy' => 'wptests_tax',
    292                 ) );
    293                 $t3 = $this->factory->term->create( array(
     287                $t1 = self::$factory->term->create( array(
     288                        'taxonomy' => 'wptests_tax',
     289                ) );
     290                $t2 = self::$factory->term->create( array(
     291                        'taxonomy' => 'wptests_tax',
     292                ) );
     293                $t3 = self::$factory->term->create( array(
    294294                        'taxonomy' => 'wptests_tax',
    295295                ) );
     
    328328                register_taxonomy( 'wptests_tax', 'post' );
    329329
    330                 $t1 = $this->factory->term->create( array(
    331                         'taxonomy' => 'wptests_tax',
    332                 ) );
    333                 $t2 = $this->factory->term->create( array(
    334                         'taxonomy' => 'wptests_tax',
    335                 ) );
    336                 $t3 = $this->factory->term->create( array(
     330                $t1 = self::$factory->term->create( array(
     331                        'taxonomy' => 'wptests_tax',
     332                ) );
     333                $t2 = self::$factory->term->create( array(
     334                        'taxonomy' => 'wptests_tax',
     335                ) );
     336                $t3 = self::$factory->term->create( array(
    337337                        'taxonomy' => 'wptests_tax',
    338338                ) );
  • trunk/tests/phpunit/tests/term/slashes.php

    r25002 r35225  
    99        function setUp() {
    1010                parent::setUp();
    11                 $this->author_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
     11                $this->author_id = self::$factory->user->create( array( 'role' => 'administrator' ) );
    1212                $this->old_current_user = get_current_user_id();
    1313                wp_set_current_user( $this->author_id );
     
    8585                );
    8686                foreach ( $taxonomies as $taxonomy ) {
    87                         $id = $this->factory->term->create(array(
     87                        $id = self::$factory->term->create(array(
    8888                                'taxonomy' => $taxonomy
    8989                        ));
  • trunk/tests/phpunit/tests/term/termExists.php

    r30118 r35225  
    1010
    1111        public function test_term_exists_term_int_taxonomy_nonempty_term_exists() {
    12                 $t = $this->factory->term->create( array(
     12                $t = self::$factory->term->create( array(
    1313                        'taxonomy' => 'post_tag',
    1414                ) );
     
    2323
    2424        public function test_term_exists_term_int_taxonomy_nonempty_wrong_taxonomy() {
    25                 $t = $this->factory->term->create( array(
     25                $t = self::$factory->term->create( array(
    2626                        'taxonomy' => 'post_tag',
    2727                ) );
     
    3131
    3232        public function test_term_exists_term_int_taxonomy_empty_term_exists() {
    33                 $t = $this->factory->term->create( array(
     33                $t = self::$factory->term->create( array(
    3434                        'taxonomy' => 'post_tag',
    3535                ) );
     
    4444
    4545        public function test_term_exists_unslash_term() {
    46                 $t = $this->factory->term->create( array(
     46                $t = self::$factory->term->create( array(
    4747                        'taxonomy' => 'post_tag',
    4848                        'name' => 'I "love" WordPress\'s taxonomy system',
     
    5454
    5555        public function test_term_exists_trim_term() {
    56                 $t = $this->factory->term->create( array(
     56                $t = self::$factory->term->create( array(
    5757                        'taxonomy' => 'post_tag',
    5858                        'slug' => 'foo',
     
    8585                ) );
    8686
    87                 $parent_term = $this->factory->term->create( array(
    88                         'taxonomy' => 'foo',
    89                 ) );
    90 
    91                 $t = $this->factory->term->create( array(
     87                $parent_term = self::$factory->term->create( array(
     88                        'taxonomy' => 'foo',
     89                ) );
     90
     91                $t = self::$factory->term->create( array(
    9292                        'taxonomy' => 'foo',
    9393                        'parent' => $parent_term,
     
    111111                ) );
    112112
    113                 $parent_term = $this->factory->term->create( array(
    114                         'taxonomy' => 'foo',
    115                 ) );
    116 
    117                 $t = $this->factory->term->create( array(
     113                $parent_term = self::$factory->term->create( array(
     114                        'taxonomy' => 'foo',
     115                ) );
     116
     117                $t = self::$factory->term->create( array(
    118118                        'taxonomy' => 'foo',
    119119                        'parent' => $parent_term,
     
    133133                ) );
    134134
    135                 $parent_term = $this->factory->term->create( array(
    136                         'taxonomy' => 'foo',
    137                 ) );
    138 
    139                 $t = $this->factory->term->create( array(
     135                $parent_term = self::$factory->term->create( array(
     136                        'taxonomy' => 'foo',
     137                ) );
     138
     139                $t = self::$factory->term->create( array(
    140140                        'taxonomy' => 'foo',
    141141                        'parent' => $parent_term,
     
    154154                register_taxonomy( 'foo', 'post', array() );
    155155
    156                 $t = $this->factory->term->create( array(
     156                $t = self::$factory->term->create( array(
    157157                        'taxonomy' => 'foo',
    158158                        'slug' => 'kewl-dudez',
     
    170170                register_taxonomy( 'foo', 'post', array() );
    171171
    172                 $t = $this->factory->term->create( array(
     172                $t = self::$factory->term->create( array(
    173173                        'taxonomy' => 'foo',
    174174                        'name' => 'Kewl Dudez',
     
    186186                register_taxonomy( 'foo', 'post', array() );
    187187
    188                 $t = $this->factory->term->create( array(
     188                $t = self::$factory->term->create( array(
    189189                        'taxonomy' => 'foo',
    190190                        'name' => 'juicy-fruit',
     
    202202                register_taxonomy( 'foo', 'post', array() );
    203203
    204                 $t = $this->factory->term->create( array(
     204                $t = self::$factory->term->create( array(
    205205                        'taxonomy' => 'foo',
    206206                        'name' => 'Juicy Fruit',
  • trunk/tests/phpunit/tests/term/wpDeleteObjectTermRelationships.php

    r31021 r35225  
    1010                register_taxonomy( 'wptests_tax2', 'post' );
    1111
    12                 $t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
    13                 $t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
     12                $t1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
     13                $t2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
    1414
    1515                $object_id = 567;
     
    3434                register_taxonomy( 'wptests_tax3', 'post' );
    3535
    36                 $t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
    37                 $t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
    38                 $t3 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax3' ) );
     36                $t1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
     37                $t2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
     38                $t3 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax3' ) );
    3939
    4040                $object_id = 567;
  • trunk/tests/phpunit/tests/term/wpDeleteTerm.php

    r33711 r35225  
    1313                register_taxonomy( 'wptests_tax', 'post' );
    1414
    15                 $terms = $this->factory->term->create_many( 2, array(
     15                $terms = self::$factory->term->create_many( 2, array(
    1616                        'taxonomy' => 'wptests_tax',
    1717                ) );
    1818
    19                 $p = $this->factory->post->create();
     19                $p = self::$factory->post->create();
    2020
    2121                wp_set_object_terms( $p, array( $terms[0] ), 'wptests_tax' );
  • trunk/tests/phpunit/tests/term/wpGenerateTagCloud.php

    r34519 r35225  
    44 */
    55class Tests_WP_Generate_Tag_Cloud extends WP_UnitTestCase {
     6        protected $terms = array();
     7
    68        /**
    79         * Testing when passed $tags array is empty
     
    2628         */
    2729        function test_empty_tags_list_returned( $expected, $args ) {
    28                 $this->factory->term->create_many( 4, array( 'taxonomy' => 'post_tag' ) );
     30                $term_ids = self::$factory->term->create_many( 4, array( 'taxonomy' => 'post_tag' ) );
     31                $this->terms = array();
     32                foreach ( $term_ids as $term_id ) {
     33                        $this->terms[] = get_term( $term_id, 'post_tag' );
     34                }
    2935                $tags = $this->retrieve_terms( array( 'number' => 4 ) );
    3036                $this->assertSame( $expected, wp_generate_tag_cloud( $tags, $args ) );
     
    6571        }
    6672
    67 
    68         /**
    69          * Testing the various output for a single link
    70          * in various formats
    71          *
    72          * @dataProvider single_link_data_provider
    73          *
    74          * @param int   $create          How many tags to create.
    75          * @param array $get_terms_args  What args we want to pass to retreve terms.
    76          * @param mixed $expected        Expected output from `wp_generate_tag_cloud()`.
    77          * @param array $args            Options for `wp_generate_tag_cloud()`.
    78          *
    79          */
    80         function test_wp_generate_tag_cloud( $create, $get_terms_args, $expected, $args ) {
    81                 $this->factory->term->create_many( $create, array( 'taxonomy' => 'post_tag' ) );
    82                 $tags = $this->retrieve_terms( $get_terms_args );
    83 
    84                 $this->assertEquals( $expected, wp_generate_tag_cloud( $tags, $args ) );
    85         }
    86 
    87 
    88         function single_link_data_provider() {
    89                 return array(
    90                         array(
    91                                 1,
    92                                 array(
    93                                         'number' => 1,
    94                                         'hide_empty' => false,
    95                                 ),
    96                                 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag=term-1' class='tag-link-0' title='0 topics' style='font-size: 8pt;'>Term 1</a>",
    97                                 array(
    98                                         'hide_empty' => false,
    99                                 ),
    100                         ),
    101 
    102                         // Should return an array of links.
    103                         array(
    104                                 1,
    105                                 array(
    106                                         'number' => 1,
    107                                         'hide_empty' => false,
    108                                 ),
    109                                 array(
    110                                         "<a href='http://" . WP_TESTS_DOMAIN . "/?tag=term-1' class='tag-link-0' title='0 topics' style='font-size: 8pt;'>Term 1</a>",
    111                                 ),
    112                                 array(
    113                                         'hide_empty' => false,
    114                                         'format'     => 'array',
    115                                 ),
    116                         ),
    117 
    118                         // Should return a string containing a <ul> list of links.
    119                         array(
    120                                 1,
    121                                 array(
    122                                         'number' => 1,
    123                                         'hide_empty' => false,
    124                                 ),
    125                                 "<ul class='wp-tag-cloud'>\n\t<li><a href='http://" . WP_TESTS_DOMAIN . "/?tag=term-1' class='tag-link-0' title='0 topics' style='font-size: 8pt;'>Term 1</a></li>\n</ul>\n",
    126                                 array(
    127                                         'hide_empty' => false,
    128                                         'format'     => 'list',
    129                                 ),
    130                         ),
    131 
    132                         array(
    133                                 4,
    134                                 array(
    135                                         'number' => 4,
    136                                         'hide_empty' => false,
    137                                 ),
    138                                 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag=term-1' class='tag-link-0' title='0 topics' style='font-size: 8pt;'>Term 1</a>\n".
    139                                 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag=term-2' class='tag-link-1' title='0 topics' style='font-size: 8pt;'>Term 2</a>\n".
    140                                 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag=term-3' class='tag-link-2' title='0 topics' style='font-size: 8pt;'>Term 3</a>\n".
    141                                 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag=term-4' class='tag-link-3' title='0 topics' style='font-size: 8pt;'>Term 4</a>",
    142                                 array(
    143                                         'hide_empty' => false,
    144                                 ),
    145                         ),
    146 
    147                         array(
    148                                 4,
    149                                 array(
    150                                         'number' => 4,
    151                                         'hide_empty' => false,
    152                                 ),
    153                                 "<ul class='wp-tag-cloud'>\n\t<li>".
    154                                 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag=term-1' class='tag-link-0' title='0 topics' style='font-size: 8pt;'>Term 1</a></li>\n\t<li>".
    155                                 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag=term-2' class='tag-link-1' title='0 topics' style='font-size: 8pt;'>Term 2</a></li>\n\t<li>".
    156                                 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag=term-3' class='tag-link-2' title='0 topics' style='font-size: 8pt;'>Term 3</a></li>\n\t<li>".
    157                                 "<a href='http://" . WP_TESTS_DOMAIN . "/?tag=term-4' class='tag-link-3' title='0 topics' style='font-size: 8pt;'>Term 4</a>".
    158                                 "</li>\n</ul>\n",
    159                                 array(
    160                                         'hide_empty' => false,
    161                                         'format'     => 'list',
    162                                 ),
    163                         ),
    164                 );
     73        function test_hide_empty_false() {
     74                $term_id = self::$factory->tag->create();
     75                $term = get_term( $term_id, 'post_tag' );
     76
     77                $tags = $this->retrieve_terms( array(
     78                        'number' => 1,
     79                        'hide_empty' => false,
     80                ) );
     81                $expected = "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$term->slug}' class='tag-link-0' title='0 topics' style='font-size: 8pt;'>{$term->name}</a>";
     82                $this->assertEquals( $expected, wp_generate_tag_cloud( $tags, array(
     83                        'hide_empty' => false,
     84                ) ) );
     85        }
     86
     87        function test_hide_empty_false_format_array() {
     88                $term_id = self::$factory->tag->create();
     89                $term = get_term( $term_id, 'post_tag' );
     90
     91                $tags = $this->retrieve_terms( array(
     92                        'number' => 1,
     93                        'hide_empty' => false,
     94                        'format'     => 'array',
     95                ) );
     96
     97                $expected = "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$term->slug}' class='tag-link-0' title='0 topics' style='font-size: 8pt;'>{$term->name}</a>";
     98                $this->assertEquals( $expected, wp_generate_tag_cloud( $tags, array(
     99                        'hide_empty' => false,
     100                ) ) );
     101        }
     102
     103        function test_hide_empty_false_format_list() {
     104                $term_id = self::$factory->tag->create();
     105                $term = get_term( $term_id, 'post_tag' );
     106
     107                $tags = $this->retrieve_terms( array(
     108                        'number' => 1,
     109                        'hide_empty' => false,
     110                ) );
     111
     112                $expected = "<ul class='wp-tag-cloud'>\n\t<li><a href='http://" . WP_TESTS_DOMAIN . "/?tag={$term->slug}' class='tag-link-0' title='0 topics' style='font-size: 8pt;'>{$term->name}</a></li>\n</ul>\n";
     113                $this->assertEquals( $expected, wp_generate_tag_cloud( $tags, array(
     114                        'hide_empty' => false,
     115                        'format'     => 'list',
     116                ) ) );
     117        }
     118
     119        function test_hide_empty_false_multi() {
     120                $term_ids = self::$factory->tag->create_many( 4 );
     121                $terms = array();
     122                foreach ( $term_ids as $term_id ) {
     123                        $terms[] = get_term( $term_id, 'post_tag' );
     124                }
     125
     126                $tags = $this->retrieve_terms( array(
     127                        'number' => 4,
     128                        'order' => 'id',
     129                        'hide_empty' => false,
     130                ) );
     131
     132                $expected = "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[0]->slug}' class='tag-link-0' title='0 topics' style='font-size: 8pt;'>{$terms[0]->name}</a>\n".
     133                        "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[1]->slug}' class='tag-link-1' title='0 topics' style='font-size: 8pt;'>{$terms[1]->name}</a>\n".
     134                        "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[2]->slug}' class='tag-link-2' title='0 topics' style='font-size: 8pt;'>{$terms[2]->name}</a>\n".
     135                        "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[3]->slug}' class='tag-link-3' title='0 topics' style='font-size: 8pt;'>{$terms[3]->name}</a>";
     136                $this->assertEquals( $expected, wp_generate_tag_cloud( $tags, array(
     137                        'hide_empty' => false,
     138                ) ) );
     139        }
     140
     141        function test_hide_empty_false_multi_format_list() {
     142                $term_ids = self::$factory->tag->create_many( 4 );
     143                $terms = array();
     144                foreach ( $term_ids as $term_id ) {
     145                        $terms[] = get_term( $term_id, 'post_tag' );
     146                }
     147
     148                $tags = $this->retrieve_terms( array(
     149                        'number' => 4,
     150                        'orderby' => 'id',
     151                        'hide_empty' => false,
     152                ) );
     153
     154                $expected = "<ul class='wp-tag-cloud'>\n\t<li>".
     155                        "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[0]->slug}' class='tag-link-0' title='0 topics' style='font-size: 8pt;'>{$terms[0]->name}</a></li>\n\t<li>".
     156                        "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[1]->slug}' class='tag-link-1' title='0 topics' style='font-size: 8pt;'>{$terms[1]->name}</a></li>\n\t<li>".
     157                        "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[2]->slug}' class='tag-link-2' title='0 topics' style='font-size: 8pt;'>{$terms[2]->name}</a></li>\n\t<li>".
     158                        "<a href='http://" . WP_TESTS_DOMAIN . "/?tag={$terms[3]->slug}' class='tag-link-3' title='0 topics' style='font-size: 8pt;'>{$terms[3]->name}</a>".
     159                        "</li>\n</ul>\n";
     160
     161                $this->assertEquals( $expected, wp_generate_tag_cloud( $tags, array(
     162                        'hide_empty' => false,
     163                        'format'     => 'list',
     164                ) ) );
    165165        }
    166166
    167167        public function test_topic_count_text() {
    168168                register_taxonomy( 'wptests_tax', 'post' );
    169                 $terms = $this->factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
    170                 $posts = $this->factory->post->create_many( 2 );
    171 
    172                 wp_set_post_terms( $posts[0], $terms, 'wptests_tax' );
    173                 wp_set_post_terms( $posts[1], array( $terms[1] ), 'wptests_tax' );
     169                $term_ids = self::$factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
     170                $this->terms = array();
     171                foreach ( $term_ids as $term_id ) {
     172                        $this->terms[] = get_term( $term_id, 'post_tag' );
     173                }
     174                $posts = self::$factory->post->create_many( 2 );
     175
     176                wp_set_post_terms( $posts[0], $term_ids, 'wptests_tax' );
     177                wp_set_post_terms( $posts[1], array( $term_ids[1] ), 'wptests_tax' );
    174178
    175179                $term_objects = $this->retrieve_terms( array(
    176                         'include' => $terms,
     180                        'include' => $term_ids,
    177181                ), 'wptests_tax' );
    178182
     
    193197        public function test_topic_count_text_callback() {
    194198                register_taxonomy( 'wptests_tax', 'post' );
    195                 $terms = $this->factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
    196                 $posts = $this->factory->post->create_many( 2 );
    197 
    198                 wp_set_post_terms( $posts[0], $terms, 'wptests_tax' );
    199                 wp_set_post_terms( $posts[1], array( $terms[1] ), 'wptests_tax' );
     199                $term_ids = self::$factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );
     200                $this->terms = array();
     201                foreach ( $term_ids as $term_id ) {
     202                        $this->terms[] = get_term( $term_id, 'post_tag' );
     203                }
     204                $posts = self::$factory->post->create_many( 2 );
     205
     206                wp_set_post_terms( $posts[0], $term_ids, 'wptests_tax' );
     207                wp_set_post_terms( $posts[1], array( $term_ids[1] ), 'wptests_tax' );
    200208
    201209                $term_objects = $this->retrieve_terms( array(
    202                         'include' => $terms,
     210                        'include' => $term_ids,
    203211                ), 'wptests_tax' );
    204212
  • trunk/tests/phpunit/tests/term/wpGetObjectTerms.php

    r34999 r35225  
    1414
    1515        public function test_get_object_terms_by_slug() {
    16                 $post_id = $this->factory->post->create();
     16                $post_id = self::$factory->post->create();
    1717
    1818                $terms_1 = array('Foo', 'Bar', 'Baz');
     
    3232         */
    3333        public function test_should_not_filter_out_duplicate_terms_associated_with_different_objects() {
    34                 $post_id1 = $this->factory->post->create();
    35                 $post_id2 = $this->factory->post->create();
    36                 $cat_id = $this->factory->category->create();
    37                 $cat_id2 = $this->factory->category->create();
     34                $post_id1 = self::$factory->post->create();
     35                $post_id2 = self::$factory->post->create();
     36                $cat_id = self::$factory->category->create();
     37                $cat_id2 = self::$factory->category->create();
    3838                wp_set_post_categories( $post_id1, array( $cat_id, $cat_id2 ) );
    3939                wp_set_post_categories( $post_id2, $cat_id );
     
    5555         */
    5656        public function test_should_return_objects_with_int_properties() {
    57                 $post_id = $this->factory->post->create();
     57                $post_id = self::$factory->post->create();
    5858                $term = wp_insert_term( 'one', $this->taxonomy );
    5959                wp_set_object_terms( $post_id, $term, $this->taxonomy );
     
    7474         */
    7575        public function test_references_should_be_reset_after_wp_get_object_terms_filter() {
    76                 $post_id = $this->factory->post->create();
     76                $post_id = self::$factory->post->create();
    7777                $terms_1 = array('foo', 'bar', 'baz');
    7878
     
    8787
    8888        public function test_orderby_name() {
    89                 $p = $this->factory->post->create();
    90 
    91                 $t1 = $this->factory->term->create( array(
     89                $p = self::$factory->post->create();
     90
     91                $t1 = self::$factory->term->create( array(
    9292                        'taxonomy' => $this->taxonomy,
    9393                        'name' => 'AAA',
    9494                ) );
    95                 $t2 = $this->factory->term->create( array(
     95                $t2 = self::$factory->term->create( array(
    9696                        'taxonomy' => $this->taxonomy,
    9797                        'name' => 'ZZZ',
    9898                ) );
    99                 $t3 = $this->factory->term->create( array(
     99                $t3 = self::$factory->term->create( array(
    100100                        'taxonomy' => $this->taxonomy,
    101101                        'name' => 'JJJ',
     
    113113
    114114        public function test_orderby_count() {
    115                 $posts = $this->factory->post->create_many( 3 );
    116 
    117                 $t1 = $this->factory->term->create( array(
     115                $posts = self::$factory->post->create_many( 3 );
     116
     117                $t1 = self::$factory->term->create( array(
    118118                        'taxonomy' => $this->taxonomy,
    119119                        'name' => 'AAA',
    120120                ) );
    121                 $t2 = $this->factory->term->create( array(
     121                $t2 = self::$factory->term->create( array(
    122122                        'taxonomy' => $this->taxonomy,
    123123                        'name' => 'ZZZ',
    124124                ) );
    125                 $t3 = $this->factory->term->create( array(
     125                $t3 = self::$factory->term->create( array(
    126126                        'taxonomy' => $this->taxonomy,
    127127                        'name' => 'JJJ',
     
    141141
    142142        public function test_orderby_slug() {
    143                 $p = $this->factory->post->create();
    144 
    145                 $t1 = $this->factory->term->create( array(
     143                $p = self::$factory->post->create();
     144
     145                $t1 = self::$factory->term->create( array(
    146146                        'taxonomy' => $this->taxonomy,
    147147                        'slug' => 'aaa',
    148148                ) );
    149                 $t2 = $this->factory->term->create( array(
     149                $t2 = self::$factory->term->create( array(
    150150                        'taxonomy' => $this->taxonomy,
    151151                        'slug' => 'zzz',
    152152                ) );
    153                 $t3 = $this->factory->term->create( array(
     153                $t3 = self::$factory->term->create( array(
    154154                        'taxonomy' => $this->taxonomy,
    155155                        'slug' => 'jjj',
     
    167167
    168168        public function test_orderby_term_group() {
    169                 $p = $this->factory->post->create();
    170 
    171                 $t1 = $this->factory->term->create( array(
    172                         'taxonomy' => $this->taxonomy,
    173                 ) );
    174                 $t2 = $this->factory->term->create( array(
    175                         'taxonomy' => $this->taxonomy,
    176                 ) );
    177                 $t3 = $this->factory->term->create( array(
     169                $p = self::$factory->post->create();
     170
     171                $t1 = self::$factory->term->create( array(
     172                        'taxonomy' => $this->taxonomy,
     173                ) );
     174                $t2 = self::$factory->term->create( array(
     175                        'taxonomy' => $this->taxonomy,
     176                ) );
     177                $t3 = self::$factory->term->create( array(
    178178                        'taxonomy' => $this->taxonomy,
    179179                ) );
     
    196196
    197197        public function test_orderby_term_order() {
    198                 $p = $this->factory->post->create();
    199 
    200                 $t1 = $this->factory->term->create( array(
    201                         'taxonomy' => $this->taxonomy,
    202                 ) );
    203                 $t2 = $this->factory->term->create( array(
    204                         'taxonomy' => $this->taxonomy,
    205                 ) );
    206                 $t3 = $this->factory->term->create( array(
     198                $p = self::$factory->post->create();
     199
     200                $t1 = self::$factory->term->create( array(
     201                        'taxonomy' => $this->taxonomy,
     202                ) );
     203                $t2 = self::$factory->term->create( array(
     204                        'taxonomy' => $this->taxonomy,
     205                ) );
     206                $t3 = self::$factory->term->create( array(
    207207                        'taxonomy' => $this->taxonomy,
    208208                ) );
     
    232232         */
    233233        public function test_orderby_parent() {
    234                 $p = $this->factory->post->create();
    235 
    236                 $t1 = $this->factory->term->create( array(
    237                         'taxonomy' => $this->taxonomy,
    238                 ) );
    239                 $t2 = $this->factory->term->create( array(
    240                         'taxonomy' => $this->taxonomy,
    241                 ) );
    242                 $t3 = $this->factory->term->create( array(
     234                $p = self::$factory->post->create();
     235
     236                $t1 = self::$factory->term->create( array(
     237                        'taxonomy' => $this->taxonomy,
     238                ) );
     239                $t2 = self::$factory->term->create( array(
     240                        'taxonomy' => $this->taxonomy,
     241                ) );
     242                $t3 = self::$factory->term->create( array(
    243243                        'taxonomy' => $this->taxonomy,
    244244                ) );
     
    270270                register_taxonomy( 'wptests_tax_3', 'post' );
    271271
    272                 $p = $this->factory->post->create();
    273 
    274                 $t1 = $this->factory->term->create( array(
    275                         'taxonomy' => $this->taxonomy,
    276                 ) );
    277                 $t2 = $this->factory->term->create( array(
     272                $p = self::$factory->post->create();
     273
     274                $t1 = self::$factory->term->create( array(
     275                        'taxonomy' => $this->taxonomy,
     276                ) );
     277                $t2 = self::$factory->term->create( array(
    278278                        'taxonomy' => 'wptests_tax_3',
    279279                ) );
    280                 $t3 = $this->factory->term->create( array(
     280                $t3 = self::$factory->term->create( array(
    281281                        'taxonomy' => 'wptests_tax_2',
    282282                ) );
     
    298298         */
    299299        public function test_orderby_tt_id() {
    300                 $p = $this->factory->post->create();
    301 
    302                 $t1 = $this->factory->term->create( array(
    303                         'taxonomy' => $this->taxonomy,
    304                 ) );
    305                 $t2 = $this->factory->term->create( array(
    306                         'taxonomy' => $this->taxonomy,
    307                 ) );
    308                 $t3 = $this->factory->term->create( array(
     300                $p = self::$factory->post->create();
     301
     302                $t1 = self::$factory->term->create( array(
     303                        'taxonomy' => $this->taxonomy,
     304                ) );
     305                $t2 = self::$factory->term->create( array(
     306                        'taxonomy' => $this->taxonomy,
     307                ) );
     308                $t3 = self::$factory->term->create( array(
    309309                        'taxonomy' => $this->taxonomy,
    310310                ) );
     
    331331
    332332        public function test_order_desc() {
    333                 $p = $this->factory->post->create();
    334 
    335                 $t1 = $this->factory->term->create( array(
     333                $p = self::$factory->post->create();
     334
     335                $t1 = self::$factory->term->create( array(
    336336                        'taxonomy' => $this->taxonomy,
    337337                        'name' => 'AAA',
    338338                ) );
    339                 $t2 = $this->factory->term->create( array(
     339                $t2 = self::$factory->term->create( array(
    340340                        'taxonomy' => $this->taxonomy,
    341341                        'name' => 'ZZZ',
    342342                ) );
    343                 $t3 = $this->factory->term->create( array(
     343                $t3 = self::$factory->term->create( array(
    344344                        'taxonomy' => $this->taxonomy,
    345345                        'name' => 'JJJ',
     
    361361         */
    362362        public function test_parent() {
    363                 $t1 = $this->factory->term->create( array(
    364                         'taxonomy' => $this->taxonomy,
    365                 ) );
    366                 $t2 = $this->factory->term->create( array(
    367                         'taxonomy' => $this->taxonomy,
    368                 ) );
    369                 $t3 = $this->factory->term->create( array(
     363                $t1 = self::$factory->term->create( array(
     364                        'taxonomy' => $this->taxonomy,
     365                ) );
     366                $t2 = self::$factory->term->create( array(
     367                        'taxonomy' => $this->taxonomy,
     368                ) );
     369                $t3 = self::$factory->term->create( array(
    370370                        'taxonomy' => $this->taxonomy,
    371371                        'parent' => $t1,
    372372                ) );
    373                 $t4 = $this->factory->term->create( array(
     373                $t4 = self::$factory->term->create( array(
    374374                        'taxonomy' => $this->taxonomy,
    375375                        'parent' => $t2,
    376376                ) );
    377377
    378                 $p = $this->factory->post->create();
     378                $p = self::$factory->post->create();
    379379
    380380                wp_set_object_terms( $p, array( $t1, $t2, $t3, $t3 ), $this->taxonomy );
     
    392392         */
    393393        public function test_parent_0() {
    394                 $t1 = $this->factory->term->create( array(
    395                         'taxonomy' => $this->taxonomy,
    396                 ) );
    397                 $t2 = $this->factory->term->create( array(
    398                         'taxonomy' => $this->taxonomy,
    399                 ) );
    400                 $t3 = $this->factory->term->create( array(
     394                $t1 = self::$factory->term->create( array(
     395                        'taxonomy' => $this->taxonomy,
     396                ) );
     397                $t2 = self::$factory->term->create( array(
     398                        'taxonomy' => $this->taxonomy,
     399                ) );
     400                $t3 = self::$factory->term->create( array(
    401401                        'taxonomy' => $this->taxonomy,
    402402                        'parent' => $t1,
    403403                ) );
    404                 $t4 = $this->factory->term->create( array(
     404                $t4 = self::$factory->term->create( array(
    405405                        'taxonomy' => $this->taxonomy,
    406406                        'parent' => $t2,
    407407                ) );
    408408
    409                 $p = $this->factory->post->create();
     409                $p = self::$factory->post->create();
    410410
    411411                wp_set_object_terms( $p, array( $t1, $t2, $t3, $t3 ), $this->taxonomy );
     
    426426
    427427                register_taxonomy( 'wptests_tax', 'post' );
    428                 $terms = $this->factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
     428                $terms = self::$factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
    429429                add_term_meta( $terms[0], 'foo', 'bar' );
    430430                add_term_meta( $terms[1], 'foo', 'bar' );
    431431                add_term_meta( $terms[2], 'foo', 'bar' );
    432432
    433                 $p = $this->factory->post->create();
     433                $p = self::$factory->post->create();
    434434                wp_set_object_terms( $p, $terms, 'wptests_tax' );
    435435
     
    452452
    453453                register_taxonomy( 'wptests_tax', 'post' );
    454                 $terms = $this->factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
     454                $terms = self::$factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
    455455                add_term_meta( $terms[0], 'foo', 'bar' );
    456456                add_term_meta( $terms[1], 'foo', 'bar' );
    457457                add_term_meta( $terms[2], 'foo', 'bar' );
    458458
    459                 $p = $this->factory->post->create();
     459                $p = self::$factory->post->create();
    460460                wp_set_object_terms( $p, $terms, 'wptests_tax' );
    461461
     
    478478        public function test_meta_query() {
    479479                register_taxonomy( 'wptests_tax', 'post' );
    480                 $terms = $this->factory->term->create_many( 5, array( 'taxonomy' => 'wptests_tax' ) );
     480                $terms = self::$factory->term->create_many( 5, array( 'taxonomy' => 'wptests_tax' ) );
    481481                add_term_meta( $terms[0], 'foo', 'bar' );
    482482                add_term_meta( $terms[1], 'foo', 'bar' );
     
    484484                add_term_meta( $terms[3], 'foob', 'ar' );
    485485
    486                 $p = $this->factory->post->create();
     486                $p = self::$factory->post->create();
    487487                wp_set_object_terms( $p, $terms, 'wptests_tax' );
    488488
     
    504504        public function test_should_return_wp_term_objects_for_fields_all() {
    505505                register_taxonomy( 'wptests_tax', 'post' );
    506                 $p = $this->factory->post->create();
    507                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     506                $p = self::$factory->post->create();
     507                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    508508                wp_set_object_terms( $p, $t, 'wptests_tax' );
    509509
     
    523523        public function test_should_return_wp_term_objects_for_fields_all_with_object_id() {
    524524                register_taxonomy( 'wptests_tax', 'post' );
    525                 $p = $this->factory->post->create();
    526                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     525                $p = self::$factory->post->create();
     526                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    527527                wp_set_object_terms( $p, $t, 'wptests_tax' );
    528528
     
    544544
    545545                register_taxonomy( 'wptests_tax', 'post' );
    546                 $p = $this->factory->post->create();
    547                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     546                $p = self::$factory->post->create();
     547                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    548548                wp_set_object_terms( $p, $t, 'wptests_tax' );
    549549
     
    562562        public function test_object_id_should_not_be_cached_with_term_object() {
    563563                register_taxonomy( 'wptests_tax', 'post' );
    564                 $p = $this->factory->post->create();
    565                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     564                $p = self::$factory->post->create();
     565                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    566566                wp_set_object_terms( $p, $t, 'wptests_tax' );
    567567
     
    586586                register_taxonomy( 'wptests_tax1', 'post' );
    587587                register_taxonomy( 'wptests_tax2', 'post' );
    588                 $p = $this->factory->post->create();
    589                 $t1 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
    590                 $t2 = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
     588                $p = self::$factory->post->create();
     589                $t1 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );
     590                $t2 = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );
    591591                wp_set_object_terms( $p, $t1, 'wptests_tax1' );
    592592                wp_set_object_terms( $p, $t2, 'wptests_tax2' );
     
    612612        public function test_object_id_should_be_set_on_objects_that_share_terms() {
    613613                register_taxonomy( 'wptests_tax', 'post' );
    614                 $posts = $this->factory->post->create_many( 2 );
    615                 $t = $this->factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
     614                $posts = self::$factory->post->create_many( 2 );
     615                $t = self::$factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );
    616616                wp_set_object_terms( $posts[0], $t, 'wptests_tax' );
    617617                wp_set_object_terms( $posts[1], $t, 'wptests_tax' );
  • trunk/tests/phpunit/tests/term/wpInsertTerm.php

    r34828 r35225  
    161161         */
    162162        public function test_wp_insert_term_duplicate_name() {
    163                 $term = $this->factory->tag->create_and_get( array( 'name' => 'Bozo' ) );
     163                $term = self::$factory->tag->create_and_get( array( 'name' => 'Bozo' ) );
    164164                $this->assertNotWPError( $term );
    165165                $this->assertTrue( empty( $term->errors ) );
    166166
    167167                // Test existing term name with unique slug
    168                 $term1 = $this->factory->tag->create( array( 'name' => 'Bozo', 'slug' => 'bozo1' ) );
     168                $term1 = self::$factory->tag->create( array( 'name' => 'Bozo', 'slug' => 'bozo1' ) );
    169169                $this->assertNotWPError( $term1 );
    170170
    171171                // Test an existing term name
    172                 $term2 = $this->factory->tag->create( array( 'name' => 'Bozo' ) );
     172                $term2 = self::$factory->tag->create( array( 'name' => 'Bozo' ) );
    173173                $this->assertTrue( is_wp_error( $term2 ) );
    174174                $this->assertNotEmpty( $term2->errors );
    175175
    176176                // Test named terms ending in special characters
    177                 $term3 = $this->factory->tag->create( array( 'name' => 'T$' ) );
    178                 $term4 = $this->factory->tag->create( array( 'name' => 'T$$' ) );
    179                 $term5 = $this->factory->tag->create( array( 'name' => 'T$$$' ) );
    180                 $term6 = $this->factory->tag->create( array( 'name' => 'T$$$$' ) );
    181                 $term7 = $this->factory->tag->create( array( 'name' => 'T$$$$' ) );
     177                $term3 = self::$factory->tag->create( array( 'name' => 'T$' ) );
     178                $term4 = self::$factory->tag->create( array( 'name' => 'T$$' ) );
     179                $term5 = self::$factory->tag->create( array( 'name' => 'T$$$' ) );
     180                $term6 = self::$factory->tag->create( array( 'name' => 'T$$$$' ) );
     181                $term7 = self::$factory->tag->create( array( 'name' => 'T$$$$' ) );
    182182                $this->assertTrue( is_wp_error( $term7 ) );
    183183                $this->assertNotEmpty( $term7->errors );
     
    188188
    189189                // Test named terms with only special characters
    190                 $term8 = $this->factory->tag->create( array( 'name' => '$' ) );
    191                 $term9 = $this->factory->tag->create( array( 'name' => '$$' ) );
    192                 $term10 = $this->factory->tag->create( array( 'name' => '$$$' ) );
    193                 $term11 = $this->factory->tag->create( array( 'name' => '$$$$' ) );
    194                 $term12 = $this->factory->tag->create( array( 'name' => '$$$$' ) );
     190                $term8 = self::$factory->tag->create( array( 'name' => '$' ) );
     191                $term9 = self::$factory->tag->create( array( 'name' => '$$' ) );
     192                $term10 = self::$factory->tag->create( array( 'name' => '$$$' ) );
     193                $term11 = self::$factory->tag->create( array( 'name' => '$$$$' ) );
     194                $term12 = self::$factory->tag->create( array( 'name' => '$$$$' ) );
    195195                $this->assertTrue( is_wp_error( $term12 ) );
    196196                $this->assertNotEmpty( $term12->errors );
     
    200200                $this->assertCount( 4, array_unique( wp_list_pluck( $terms, 'slug' ) ) );
    201201
    202                 $term13 = $this->factory->tag->create( array( 'name' => 'A' ) );
     202                $term13 = self::$factory->tag->create( array( 'name' => 'A' ) );
    203203                $this->assertNotWPError( $term13 );
    204                 $term14 = $this->factory->tag->create( array( 'name' => 'A' ) );
     204                $term14 = self::$factory->tag->create( array( 'name' => 'A' ) );
    205205                $this->assertTrue( is_wp_error( $term14 ) );
    206                 $term15 = $this->factory->tag->create( array( 'name' => 'A+', 'slug' => 'a' ) );
     206                $term15 = self::$factory->tag->create( array( 'name' => 'A+', 'slug' => 'a' ) );
    207207                $this->assertNotWPError( $term15 );
    208                 $term16 = $this->factory->tag->create( array( 'name' => 'A+' ) );
     208                $term16 = self::$factory->tag->create( array( 'name' => 'A+' ) );
    209209                $this->assertTrue( is_wp_error( $term16 ) );
    210                 $term17 = $this->factory->tag->create( array( 'name' => 'A++' ) );
     210                $term17 = self::$factory->tag->create( array( 'name' => 'A++' ) );
    211211                $this->assertNotWPError( $term17 );
    212                 $term18 = $this->factory->tag->create( array( 'name' => 'A-', 'slug' => 'a' ) );
     212                $term18 = self::$factory->tag->create( array( 'name' => 'A-', 'slug' => 'a' ) );
    213213                $this->assertNotWPError( $term18 );
    214                 $term19 = $this->factory->tag->create( array( 'name' => 'A-' ) );
     214                $term19 = self::$factory->tag->create( array( 'name' => 'A-' ) );
    215215                $this->assertTrue( is_wp_error( $term19 ) );
    216                 $term20 = $this->factory->tag->create( array( 'name' => 'A--' ) );
     216                $term20 = self::$factory->tag->create( array( 'name' => 'A--' ) );
    217217                $this->assertNotWPError( $term20 );
    218218        }
     
    223223        public function test_wp_insert_term_should_not_allow_duplicate_names_when_slug_is_a_duplicate_of_the_same_term_in_non_hierarchical_taxonomy() {
    224224                register_taxonomy( 'wptests_tax', 'post' );
    225                 $t1 = $this->factory->term->create( array(
     225                $t1 = self::$factory->term->create( array(
    226226                        'name' => 'Foo',
    227227                        'slug' => 'foo',
     
    242242        public function test_wp_insert_term_should_not_allow_duplicate_names_when_slug_is_a_duplicate_of_a_different_term_in_non_hierarchical_taxonomy() {
    243243                register_taxonomy( 'wptests_tax', 'post' );
    244                 $t1 = $this->factory->term->create( array(
    245                         'name' => 'Foo',
    246                         'slug' => 'foo',
    247                         'taxonomy' => 'wptests_tax',
    248                 ) );
    249 
    250                 $t2 = $this->factory->term->create( array(
     244                $t1 = self::$factory->term->create( array(
     245                        'name' => 'Foo',
     246                        'slug' => 'foo',
     247                        'taxonomy' => 'wptests_tax',
     248                ) );
     249
     250                $t2 = self::$factory->term->create( array(
    251251                        'name' => 'Bar',
    252252                        'slug' => 'bar',
     
    267267        public function test_wp_insert_term_should_allow_duplicate_names_when_a_unique_slug_has_been_provided_in_non_hierarchical_taxonomy() {
    268268                register_taxonomy( 'wptests_tax', 'post' );
    269                 $t1 = $this->factory->term->create( array(
     269                $t1 = self::$factory->term->create( array(
    270270                        'name' => 'Foo',
    271271                        'slug' => 'foo',
     
    289289        public function test_wp_insert_term_should_not_allow_duplicate_names_when_the_slug_is_not_provided_in_non_hierarchical_taxonomy() {
    290290                register_taxonomy( 'wptests_tax', 'post' );
    291                 $t1 = $this->factory->term->create( array(
     291                $t1 = self::$factory->term->create( array(
    292292                        'name' => 'Foo',
    293293                        'slug' => 'foo',
     
    306306        public function test_wp_insert_term_should_not_allow_duplicate_names_when_slug_is_a_duplicate_of_the_same_term_in_hierarchical_taxonomy() {
    307307                register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) );
    308                 $t1 = $this->factory->term->create( array(
     308                $t1 = self::$factory->term->create( array(
    309309                        'name' => 'Foo',
    310310                        'slug' => 'foo',
     
    325325        public function test_wp_insert_term_should_not_allow_duplicate_names_when_slug_is_a_duplicate_of_a_different_term_at_same_hierarchy_level_in_hierarchical_taxonomy() {
    326326                register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) );
    327                 $t1 = $this->factory->term->create( array(
    328                         'name' => 'Foo',
    329                         'slug' => 'foo',
    330                         'taxonomy' => 'wptests_tax',
    331                 ) );
    332 
    333                 $t2 = $this->factory->term->create( array(
     327                $t1 = self::$factory->term->create( array(
     328                        'name' => 'Foo',
     329                        'slug' => 'foo',
     330                        'taxonomy' => 'wptests_tax',
     331                ) );
     332
     333                $t2 = self::$factory->term->create( array(
    334334                        'name' => 'Bar',
    335335                        'slug' => 'bar',
     
    350350        public function test_wp_insert_term_should_allow_duplicate_names_when_slug_is_a_duplicate_of_a_term_at_different_hierarchy_level_in_hierarchical_taxonomy() {
    351351                register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) );
    352                 $t1 = $this->factory->term->create( array(
    353                         'name' => 'Foo',
    354                         'slug' => 'foo',
    355                         'taxonomy' => 'wptests_tax',
    356                 ) );
    357 
    358                 $t2 = $this->factory->term->create();
    359 
    360                 $t3 = $this->factory->term->create( array(
     352                $t1 = self::$factory->term->create( array(
     353                        'name' => 'Foo',
     354                        'slug' => 'foo',
     355                        'taxonomy' => 'wptests_tax',
     356                ) );
     357
     358                $t2 = self::$factory->term->create();
     359
     360                $t3 = self::$factory->term->create( array(
    361361                        'name' => 'Bar',
    362362                        'slug' => 'bar',
     
    382382        public function test_wp_insert_term_should_allow_duplicate_names_when_a_unique_slug_has_been_provided_in_hierarchical_taxonomy() {
    383383                register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) );
    384                 $t1 = $this->factory->term->create( array(
     384                $t1 = self::$factory->term->create( array(
    385385                        'name' => 'Foo',
    386386                        'slug' => 'foo',
     
    404404        public function test_wp_insert_term_should_not_allow_duplicate_names_when_the_slug_is_not_provided_in_hierarchical_taxonomy() {
    405405                register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) );
    406                 $t1 = $this->factory->term->create( array(
     406                $t1 = self::$factory->term->create( array(
    407407                        'name' => 'Foo',
    408408                        'slug' => 'foo',
     
    420420        public function test_wp_insert_term_duplicate_slug_same_taxonomy() {
    421421                register_taxonomy( 'wptests_tax', 'post' );
    422                 $t = $this->factory->term->create( array(
     422                $t = self::$factory->term->create( array(
    423423                        'name' => 'Foo',
    424424                        'slug' => 'foo',
     
    444444                register_taxonomy( 'wptests_tax', 'post' );
    445445                register_taxonomy( 'wptests_tax_2', 'post' );
    446                 $t = $this->factory->term->create( array(
     446                $t = self::$factory->term->create( array(
    447447                        'name' => 'Foo',
    448448                        'slug' => 'foo',
     
    474474                register_taxonomy( 'wptests_tax', 'post' );
    475475                register_taxonomy( 'wptests_tax_2', 'post' );
    476                 $t = $this->factory->term->create( array(
     476                $t = self::$factory->term->create( array(
    477477                        'name' => 'Foo',
    478478                        'slug' => 'foo',
     
    502502        public function test_wp_insert_term_alias_of_no_term_group() {
    503503                register_taxonomy( 'wptests_tax', 'post' );
    504                 $t1 = $this->factory->term->create( array(
     504                $t1 = self::$factory->term->create( array(
    505505                        'taxonomy' => 'wptests_tax',
    506506                ) );
     
    524524        public function test_wp_insert_term_alias_of_existing_term_group() {
    525525                register_taxonomy( 'wptests_tax', 'post' );
    526                 $t1 = $this->factory->term->create( array(
     526                $t1 = self::$factory->term->create( array(
    527527                        'taxonomy' => 'wptests_tax',
    528528                ) );
    529529                $term_1 = get_term( $t1, 'wptests_tax' );
    530530
    531                 $t2 = $this->factory->term->create( array(
     531                $t2 = self::$factory->term->create( array(
    532532                        'taxonomy' => 'wptests_tax',
    533533                        'alias_of' => $term_1->slug,
     
    592592                ) );
    593593
    594                 $t = $this->factory->term->create( array(
     594                $t = self::$factory->term->create( array(
    595595                        'taxonomy' => 'wptests_tax',
    596596                ) );
     
    624624                register_taxonomy( 'wptests_tax', 'post' );
    625625
    626                 $t1 = $this->factory->term->create( array(
     626                $t1 = self::$factory->term->create( array(
    627627                        'name' => 'Foó',
    628628                        'taxonomy' => 'wptests_tax',
    629629                ) );
    630                 $t2 = $this->factory->term->create( array(
     630                $t2 = self::$factory->term->create( array(
    631631                        'name' => 'Foo',
    632632                        'taxonomy' => 'wptests_tax',
  • trunk/tests/phpunit/tests/term/wpUniqueTermSlug.php

    r32507 r35225  
    1212
    1313        public function test_unique_slug_should_be_unchanged() {
    14                 $term = $this->factory->term->create_and_get( array(
     14                $term = self::$factory->term->create_and_get( array(
    1515                        'taxonomy' => 'wptests_tax1',
    1616                        'name' => 'foo',
     
    2323
    2424        public function test_nonunique_slug_in_different_taxonomy_should_be_unchanged() {
    25                 $term1 = $this->factory->term->create( array(
     25                $term1 = self::$factory->term->create( array(
    2626                        'taxonomy' => 'wptests_tax2',
    2727                        'name' => 'bar',
     
    2929                ) );
    3030
    31                 $term2 = $this->factory->term->create( array(
     31                $term2 = self::$factory->term->create( array(
    3232                        'taxonomy' => 'wptests_tax1',
    3333                        'name' => 'foo',
     
    4141
    4242        public function test_nonunique_slug_in_same_nonhierarchical_taxonomy_should_be_changed() {
    43                 $term1 = $this->factory->term->create( array(
     43                $term1 = self::$factory->term->create( array(
    4444                        'taxonomy' => 'wptests_tax1',
    4545                        'name' => 'bar',
     
    4747                ) );
    4848
    49                 $term2 = $this->factory->term->create( array(
     49                $term2 = self::$factory->term->create( array(
    5050                        'taxonomy' => 'wptests_tax1',
    5151                        'name' => 'foo',
     
    5959
    6060        public function test_nonunique_slug_in_same_hierarchical_taxonomy_with_same_parent_should_be_suffixed_with_parent_slug() {
    61                 $parent = $this->factory->term->create( array(
     61                $parent = self::$factory->term->create( array(
    6262                        'taxonomy' => 'wptests_tax2',
    6363                        'slug' => 'parent-term',
    6464                ) );
    6565
    66                 $term1 = $this->factory->term->create( array(
     66                $term1 = self::$factory->term->create( array(
    6767                        'taxonomy' => 'wptests_tax2',
    6868                        'name' => 'bar',
     
    7171                ) );
    7272
    73                 $term2 = $this->factory->term->create( array(
     73                $term2 = self::$factory->term->create( array(
    7474                        'taxonomy' => 'wptests_tax2',
    7575                        'name' => 'foo',
     
    8484
    8585        public function test_nonunique_slug_in_same_hierarchical_taxonomy_at_different_level_of_hierarchy_should_be_suffixed_with_number() {
    86                 $parent = $this->factory->term->create( array(
     86                $parent = self::$factory->term->create( array(
    8787                        'taxonomy' => 'wptests_tax2',
    8888                        'slug' => 'parent-term',
    8989                ) );
    9090
    91                 $term1 = $this->factory->term->create( array(
     91                $term1 = self::$factory->term->create( array(
    9292                        'taxonomy' => 'wptests_tax2',
    9393                        'name' => 'bar',
     
    9696                ) );
    9797
    98                 $term2 = $this->factory->term->create( array(
     98                $term2 = self::$factory->term->create( array(
    9999                        'taxonomy' => 'wptests_tax2',
    100100                        'name' => 'foo',
  • trunk/tests/phpunit/tests/term/wpUpdateTerm.php

    r34646 r35225  
    2121        public function test_wp_update_term_unslash_name() {
    2222                register_taxonomy( 'wptests_tax', 'post' );
    23                 $t = $this->factory->term->create( array(
     23                $t = self::$factory->term->create( array(
    2424                        'taxonomy' => 'wptests_tax',
    2525                ) );
     
    3737        public function test_wp_update_term_unslash_description() {
    3838                register_taxonomy( 'wptests_tax', 'post' );
    39                 $t = $this->factory->term->create( array(
     39                $t = self::$factory->term->create( array(
    4040                        'taxonomy' => 'wptests_tax',
    4141                ) );
     
    5353        public function test_wp_update_term_name_empty_string() {
    5454                register_taxonomy( 'wptests_tax', 'post' );
    55                 $t = $this->factory->term->create( array(
     55                $t = self::$factory->term->create( array(
    5656                        'taxonomy' => 'wptests_tax',
    5757                ) );
     
    7777                $this->assertNull( term_exists( $fake_term_id, 'wptests_tax' ) );
    7878
    79                 $t = $this->factory->term->create( array(
     79                $t = self::$factory->term->create( array(
    8080                        'taxonomy' => 'wptests_tax',
    8181                ) );
     
    9595        public function test_wp_update_term_slug_empty_string_while_not_updating_name() {
    9696                register_taxonomy( 'wptests_tax', 'post' );
    97                 $t = $this->factory->term->create( array(
     97                $t = self::$factory->term->create( array(
    9898                        'taxonomy' => 'wptests_tax',
    9999                        'name' => 'Foo Bar',
     
    111111        public function test_wp_update_term_slug_empty_string_while_updating_name() {
    112112                register_taxonomy( 'wptests_tax', 'post' );
    113                 $t = $this->factory->term->create( array(
     113                $t = self::$factory->term->create( array(
    114114                        'taxonomy' => 'wptests_tax',
    115115                ) );
     
    127127        public function test_wp_update_term_slug_set_slug() {
    128128                register_taxonomy( 'wptests_tax', 'post' );
    129                 $t = $this->factory->term->create( array(
     129                $t = self::$factory->term->create( array(
    130130                        'taxonomy' => 'wptests_tax',
    131131                ) );
     
    146146                register_taxonomy( 'wptests_tax', 'post' );
    147147
    148                 $t1 = $this->factory->term->create( array(
     148                $t1 = self::$factory->term->create( array(
    149149                        'name' => 'Foo',
    150150                        'slug' => 'foo',
     
    152152                ) );
    153153
    154                 $t2 = $this->factory->term->create( array(
     154                $t2 = self::$factory->term->create( array(
    155155                        'name' => 'Bar',
    156156                        'slug' => 'bar',
     
    173173                register_taxonomy( 'wptests_tax_2', 'post' );
    174174
    175                 $t1 = $this->factory->term->create( array(
     175                $t1 = self::$factory->term->create( array(
    176176                        'name' => 'Foo',
    177177                        'slug' => 'foo',
     
    179179                ) );
    180180
    181                 $t2 = $this->factory->term->create( array(
     181                $t2 = self::$factory->term->create( array(
    182182                        'name' => 'Foo',
    183183                        'slug' => 'bar',
     
    203203                register_taxonomy( 'wptests_tax_2', 'post' );
    204204
    205                 $t1 = $this->factory->term->create( array(
     205                $t1 = self::$factory->term->create( array(
    206206                        'name' => 'Foo',
    207207                        'slug' => 'foo',
     
    209209                ) );
    210210
    211                 $t2 = $this->factory->term->create( array(
     211                $t2 = self::$factory->term->create( array(
    212212                        'name' => 'Bar',
    213213                        'slug' => 'bar',
     
    233233                ) );
    234234
    235                 $t1 = $this->factory->term->create( array(
     235                $t1 = self::$factory->term->create( array(
    236236                        'name' => 'Foo',
    237237                        'slug' => 'foo',
     
    239239                ) );
    240240
    241                 $t2 = $this->factory->term->create( array(
     241                $t2 = self::$factory->term->create( array(
    242242                        'name' => 'Bar',
    243243                        'slug' => 'bar',
     
    246246                ) );
    247247
    248                 $t3 = $this->factory->term->create( array(
     248                $t3 = self::$factory->term->create( array(
    249249                        'name' => 'Bar Child',
    250250                        'slug' => 'bar-child',
     
    283283                );
    284284
    285                 $posts = $this->factory->post->create_many( 2 );
     285                $posts = self::$factory->post->create_many( 2 );
    286286                wp_set_object_terms( $posts[0], array( 'Foo' ), 'wptests_tax' );
    287287                wp_set_object_terms( $posts[1], array( 'Foo' ), 'wptests_tax_2' );
     
    303303        public function test_wp_update_term_alias_of_no_term_group() {
    304304                register_taxonomy( 'wptests_tax', 'post' );
    305                 $t1 = $this->factory->term->create( array(
     305                $t1 = self::$factory->term->create( array(
    306306                        'taxonomy' => 'wptests_tax',
    307307                ) );
     
    324324        public function test_wp_update_term_alias_of_existing_term_group() {
    325325                register_taxonomy( 'wptests_tax', 'post' );
    326                 $t1 = $this->factory->term->create( array(
     326                $t1 = self::$factory->term->create( array(
    327327                        'taxonomy' => 'wptests_tax',
    328328                ) );
    329329                $term_1 = get_term( $t1, 'wptests_tax' );
    330330
    331                 $t2 = $this->factory->term->create( array(
     331                $t2 = self::$factory->term->create( array(
    332332                        'taxonomy' => 'wptests_tax',
    333333                        'alias_of' => $term_1->slug,
     
    360360        public function test_wp_update_term_slug_same_as_old_slug() {
    361361                register_taxonomy( 'wptests_tax', 'post' );
    362                 $t = $this->factory->term->create( array(
     362                $t = self::$factory->term->create( array(
    363363                        'taxonomy' => 'wptests_tax',
    364364                        'slug' => 'foo',
     
    378378        public function test_wp_update_term_duplicate_slug_generated_due_to_empty_slug_param() {
    379379                register_taxonomy( 'wptests_tax', 'post' );
    380                 $t1 = $this->factory->term->create( array(
     380                $t1 = self::$factory->term->create( array(
    381381                        'taxonomy' => 'wptests_tax',
    382382                        'slug' => 'foo-bar',
    383383                ) );
    384                 $t2 = $this->factory->term->create( array(
     384                $t2 = self::$factory->term->create( array(
    385385                        'taxonomy' => 'wptests_tax',
    386386                        'name' => 'not foo bar',
     
    403403                        'hierarchical' => true,
    404404                ) );
    405                 $p = $this->factory->term->create( array(
    406                         'taxonomy' => 'wptests_tax',
    407                 ) );
    408                 $t1 = $this->factory->term->create( array(
     405                $p = self::$factory->term->create( array(
     406                        'taxonomy' => 'wptests_tax',
     407                ) );
     408                $t1 = self::$factory->term->create( array(
    409409                        'taxonomy' => 'wptests_tax',
    410410                        'slug' => 'foo-bar',
    411411                ) );
    412                 $t2 = $this->factory->term->create( array(
     412                $t2 = self::$factory->term->create( array(
    413413                        'taxonomy' => 'wptests_tax',
    414414                ) );
     
    429429        public function test_wp_update_term_duplicate_slug_failure() {
    430430                register_taxonomy( 'wptests_tax', 'post' );
    431                 $t1 = $this->factory->term->create( array(
     431                $t1 = self::$factory->term->create( array(
    432432                        'taxonomy' => 'wptests_tax',
    433433                        'slug' => 'foo-bar',
    434434                ) );
    435                 $t2 = $this->factory->term->create( array(
     435                $t2 = self::$factory->term->create( array(
    436436                        'taxonomy' => 'wptests_tax',
    437437                        'slug' => 'my-old-slug',
     
    452452        public function test_wp_update_term_should_return_term_id_and_term_taxonomy_id() {
    453453                register_taxonomy( 'wptests_tax', 'post' );
    454                 $t = $this->factory->term->create( array(
     454                $t = self::$factory->term->create( array(
    455455                        'taxonomy' => 'wptests_tax',
    456456                ) );
     
    478478        public function test_wp_update_term_should_return_int_values_for_term_id_and_term_taxonomy_id() {
    479479                register_taxonomy( 'wptests_tax', 'post' );
    480                 $t = $this->factory->term->create( array(
     480                $t = self::$factory->term->create( array(
    481481                        'taxonomy' => 'wptests_tax',
    482482                ) );
     
    492492                register_taxonomy( 'wptests_tax_for_post', 'post' );
    493493                register_taxonomy( 'wptests_tax_for_page', 'page' );
    494                 $post = $this->factory->post->create();
    495                 $page = $this->factory->post->create( array(
     494                $post = self::$factory->post->create();
     495                $page = self::$factory->post->create( array(
    496496                        'post_type' => 'page',
    497497                ) );
    498498
    499                 $t_for_post = $this->factory->term->create( array(
     499                $t_for_post = self::$factory->term->create( array(
    500500                        'taxonomy' => 'wptests_tax_for_post',
    501501                ) );
    502                 $t_for_page = $this->factory->term->create( array(
     502                $t_for_page = self::$factory->term->create( array(
    503503                        'taxonomy' => 'wptests_tax_for_page',
    504504                ) );
     
    528528                ) );
    529529
    530                 $t1 = $this->factory->term->create( array(
    531                         'taxonomy' => 'wptests_tax',
    532                 ) );
    533                 $t2 = $this->factory->term->create( array(
     530                $t1 = self::$factory->term->create( array(
     531                        'taxonomy' => 'wptests_tax',
     532                ) );
     533                $t2 = self::$factory->term->create( array(
    534534                        'taxonomy' => 'wptests_tax',
    535535                ) );
     
    568568                ) );
    569569
    570                 $t1 = $this->factory->term->create( array(
     570                $t1 = self::$factory->term->create( array(
    571571                        'taxonomy' => 'wptests_tax',
    572572                        'slug' => 'parent-term',
    573573                ) );
    574574
    575                 $t2 = $this->factory->term->create( array(
     575                $t2 = self::$factory->term->create( array(
    576576                        'taxonomy' => 'wptests_tax',
    577577                        'slug' => 'foo',
     
    600600                ) );
    601601
    602                 $t1 = $this->factory->term->create( array(
     602                $t1 = self::$factory->term->create( array(
    603603                        'taxonomy' => 'wptests_tax',
    604604                        'slug' => 'parent-term',
     
    606606
    607607                // Same slug but in a different tax.
    608                 $t2 = $this->factory->term->create( array(
     608                $t2 = self::$factory->term->create( array(
    609609                        'taxonomy' => 'wptests_tax_2',
    610610                        'slug' => 'foo',
    611611                ) );
    612612
    613                 $t3 = $this->factory->term->create( array(
     613                $t3 = self::$factory->term->create( array(
    614614                        'taxonomy' => 'wptests_tax',
    615615                        'slug' => 'foo',
     
    631631         */
    632632        public function test_wp_update_term_with_null_get_term() {
    633                 $t = $this->factory->term->create( array( 'taxonomy' => 'category' ) );
     633                $t = self::$factory->term->create( array( 'taxonomy' => 'category' ) );
    634634                $found = wp_update_term( $t, 'post_tag', array( 'slug' => 'foo' ) );
    635635
  • trunk/tests/phpunit/tests/url.php

    r34703 r35225  
    273273        public function test_get_adjacent_post() {
    274274                $now = time();
    275                 $post_id = $this->factory->post->create( array( 'post_date' => date( 'Y-m-d H:i:s', $now - 1 ) ) );
    276                 $post_id2 = $this->factory->post->create( array( 'post_date' => date( 'Y-m-d H:i:s', $now ) ) );
     275                $post_id = self::$factory->post->create( array( 'post_date' => date( 'Y-m-d H:i:s', $now - 1 ) ) );
     276                $post_id2 = self::$factory->post->create( array( 'post_date' => date( 'Y-m-d H:i:s', $now ) ) );
    277277
    278278                if ( ! isset( $GLOBALS['post'] ) )
     
    306306         */
    307307        public function test_get_adjacent_post_should_return_private_posts_belonging_to_the_current_user() {
    308                 $u = $this->factory->user->create( array( 'role' => 'author' ) );
     308                $u = self::$factory->user->create( array( 'role' => 'author' ) );
    309309                $old_uid = get_current_user_id();
    310310                wp_set_current_user( $u );
    311311
    312312                $now = time();
    313                 $p1 = $this->factory->post->create( array( 'post_author' => $u, 'post_status' => 'private', 'post_date' => date( 'Y-m-d H:i:s', $now - 1 ) ) );
    314                 $p2 = $this->factory->post->create( array( 'post_author' => $u, 'post_date' => date( 'Y-m-d H:i:s', $now ) ) );
     313                $p1 = self::$factory->post->create( array( 'post_author' => $u, 'post_status' => 'private', 'post_date' => date( 'Y-m-d H:i:s', $now - 1 ) ) );
     314                $p2 = self::$factory->post->create( array( 'post_author' => $u, 'post_date' => date( 'Y-m-d H:i:s', $now ) ) );
    315315
    316316                if ( ! isset( $GLOBALS['post'] ) ) {
     
    332332         */
    333333        public function test_get_adjacent_post_should_return_private_posts_belonging_to_other_users_if_the_current_user_can_read_private_posts() {
    334                 $u1 = $this->factory->user->create( array( 'role' => 'author' ) );
    335                 $u2 = $this->factory->user->create( array( 'role' => 'administrator' ) );
     334                $u1 = self::$factory->user->create( array( 'role' => 'author' ) );
     335                $u2 = self::$factory->user->create( array( 'role' => 'administrator' ) );
    336336                $old_uid = get_current_user_id();
    337337                wp_set_current_user( $u2 );
    338338
    339339                $now = time();
    340                 $p1 = $this->factory->post->create( array( 'post_author' => $u1, 'post_status' => 'private', 'post_date' => date( 'Y-m-d H:i:s', $now - 1 ) ) );
    341                 $p2 = $this->factory->post->create( array( 'post_author' => $u1, 'post_date' => date( 'Y-m-d H:i:s', $now ) ) );
     340                $p1 = self::$factory->post->create( array( 'post_author' => $u1, 'post_status' => 'private', 'post_date' => date( 'Y-m-d H:i:s', $now - 1 ) ) );
     341                $p2 = self::$factory->post->create( array( 'post_author' => $u1, 'post_date' => date( 'Y-m-d H:i:s', $now ) ) );
    342342
    343343                if ( ! isset( $GLOBALS['post'] ) ) {
     
    359359         */
    360360        public function test_get_adjacent_post_should_not_return_private_posts_belonging_to_other_users_if_the_current_user_cannot_read_private_posts() {
    361                 $u1 = $this->factory->user->create( array( 'role' => 'author' ) );
    362                 $u2 = $this->factory->user->create( array( 'role' => 'author' ) );
     361                $u1 = self::$factory->user->create( array( 'role' => 'author' ) );
     362                $u2 = self::$factory->user->create( array( 'role' => 'author' ) );
    363363                $old_uid = get_current_user_id();
    364364                wp_set_current_user( $u2 );
    365365
    366366                $now = time();
    367                 $p1 = $this->factory->post->create( array( 'post_author' => $u1, 'post_date' => date( 'Y-m-d H:i:s', $now - 2 ) ) );
    368                 $p2 = $this->factory->post->create( array( 'post_author' => $u1, 'post_status' => 'private', 'post_date' => date( 'Y-m-d H:i:s', $now - 1 ) ) );
    369                 $p3 = $this->factory->post->create( array( 'post_author' => $u1, 'post_date' => date( 'Y-m-d H:i:s', $now ) ) );
     367                $p1 = self::$factory->post->create( array( 'post_author' => $u1, 'post_date' => date( 'Y-m-d H:i:s', $now - 2 ) ) );
     368                $p2 = self::$factory->post->create( array( 'post_author' => $u1, 'post_status' => 'private', 'post_date' => date( 'Y-m-d H:i:s', $now - 1 ) ) );
     369                $p3 = self::$factory->post->create( array( 'post_author' => $u1, 'post_date' => date( 'Y-m-d H:i:s', $now ) ) );
    370370
    371371                if ( ! isset( $GLOBALS['post'] ) ) {
  • trunk/tests/phpunit/tests/user.php

    r35224 r35225  
    4444                $nusers = array();
    4545                foreach ( array('administrator', 'editor', 'author', 'contributor', 'subscriber' ) as $role ) {
    46                         $id = self::$static_factory->user->create( array( 'role' => $role ) );
     46                        $id = self::$factory->user->create( array( 'role' => $role ) );
    4747                        $nusers[ $id ] = $id;
    4848                }
     
    245245
    246246                foreach ( $roles as $role => $level ) {
    247                         $user_id = self::$static_factory->user->create( array( 'role' => $role ) );
     247                        $user_id = self::$factory->user->create( array( 'role' => $role ) );
    248248                        $user = new WP_User( $user_id );
    249249
     
    293293
    294294        function test_get() {
    295                 $user_id = self::$static_factory->user->create( array(
     295                $user_id = self::$factory->user->create( array(
    296296                        'role' => 'author',
    297297                        'user_login' => 'test_wp_user_get',
     
    311311
    312312        function test_has_prop() {
    313                 $user_id = self::$static_factory->user->create( array(
     313                $user_id = self::$factory->user->create( array(
    314314                        'role' => 'author',
    315315                        'user_login' => 'test_wp_user_has_prop',
     
    328328
    329329        function test_update_user() {
    330                 $user_id = self::$static_factory->user->create( array(
     330                $user_id = self::$factory->user->create( array(
    331331                        'role' => 'author',
    332332                        'user_login' => 'test_wp_update_user',
     
    384384                global $userdata, $wpdb;
    385385
    386                 $user_id = self::$static_factory->user->create( array( 'role' => 'subscriber' ) );
     386                $user_id = self::$factory->user->create( array( 'role' => 'subscriber' ) );
    387387                wp_set_current_user( $user_id );
    388388
     
    498498         */
    499499        function test_count_many_users_posts() {
    500                 $user_id_a = self::$static_factory->user->create( array( 'role' => 'author' ) );
    501                 $user_id_b = self::$static_factory->user->create( array( 'role' => 'author' ) );
    502                 $post_id_a = $this->factory->post->create( array( 'post_author' => $user_id_a ) );
    503                 $post_id_b = $this->factory->post->create( array( 'post_author' => $user_id_b ) );
    504                 $post_id_c = $this->factory->post->create( array( 'post_author' => $user_id_b, 'post_status' => 'private' ) );
     500                $user_id_a = self::$factory->user->create( array( 'role' => 'author' ) );
     501                $user_id_b = self::$factory->user->create( array( 'role' => 'author' ) );
     502                $post_id_a = self::$factory->post->create( array( 'post_author' => $user_id_a ) );
     503                $post_id_b = self::$factory->post->create( array( 'post_author' => $user_id_b ) );
     504                $post_id_c = self::$factory->post->create( array( 'post_author' => $user_id_b, 'post_status' => 'private' ) );
    505505
    506506                wp_set_current_user( $user_id_a );
     
    772772         */
    773773        public function test_wp_insert_user_should_not_truncate_to_a_duplicate_user_nicename() {
    774                 $u1 = self::$static_factory->user->create( array(
     774                $u1 = self::$factory->user->create( array(
    775775                        'user_nicename' => str_repeat( 'a', 50 ),
    776776                ) );
     
    793793         */
    794794        public function test_wp_insert_user_should_not_truncate_to_a_duplicate_user_nicename_when_suffix_has_more_than_one_character() {
    795                 $users = self::$static_factory->user->create_many( 4, array(
     795                $users = self::$factory->user->create_many( 4, array(
    796796                        'user_nicename' => str_repeat( 'a', 50 ),
    797797                ) );
     
    877877        function test_email_case() {
    878878                // Create a test user with a lower-case email address.
    879                 $user_id = self::$static_factory->user->create( array(
     879                $user_id = self::$factory->user->create( array(
    880880                        'user_email' => 'test@test.com',
    881881                ) );
     
    896896        function test_email_change() {
    897897                // Create a test user.
    898                 $user_id = self::$static_factory->user->create( array(
     898                $user_id = self::$factory->user->create( array(
    899899                        'user_email' => 'test@test.com',
    900900                ) );
     
    984984         */
    985985        function test_wp_new_user_notification_old_signature_throws_deprecated_warning() {
    986                 $user = self::$static_factory->user->create( array(
     986                $user = self::$factory->user->create( array(
    987987                        'role'       => 'author',
    988988                        'user_login' => 'test_wp_new_user_notification',
  • trunk/tests/phpunit/tests/user/author.php

    r34810 r35225  
    1616                parent::setUp();
    1717
    18                 $this->author_id = $this->factory->user->create( array(
     18                $this->author_id = self::$factory->user->create( array(
    1919                        'role' => 'author',
    2020                        'user_login' => 'test_author',
     
    3232
    3333                // insert a post and make sure the ID is ok
    34                 $this->post_id = $this->factory->post->create( $post );
     34                $this->post_id = self::$factory->post->create( $post );
    3535
    3636                setup_postdata( get_post( $this->post_id ) );
     
    9191                register_post_type( 'wptests_pt' );
    9292
    93                 $cpt_ids = $this->factory->post->create_many( 2, array(
     93                $cpt_ids = self::$factory->post->create_many( 2, array(
    9494                        'post_author' => $this->author_id,
    9595                        'post_type'   => 'wptests_pt',
     
    106106         */
    107107        public function test_get_the_author_posts_link_no_permalinks() {
    108                 $author = $this->factory->user->create_and_get( array(
     108                $author = self::$factory->user->create_and_get( array(
    109109                        'display_name'  => 'Foo',
    110110                        'user_nicename' => 'bar'
     
    130130                $this->set_permalink_structure( '/%postname%/' );
    131131
    132                 $author = $this->factory->user->create_and_get( array(
     132                $author = self::$factory->user->create_and_get( array(
    133133                        'display_name'  => 'Foo',
    134134                        'user_nicename' => 'bar'
  • trunk/tests/phpunit/tests/user/capabilities.php

    r34828 r35225  
    223223        function test_all_roles_and_caps() {
    224224                $users = array(
    225                         'administrator' => $this->factory->user->create_and_get( array( 'role' => 'administrator' ) ),
    226                         'editor'        => $this->factory->user->create_and_get( array( 'role' => 'editor' ) ),
    227                         'author'        => $this->factory->user->create_and_get( array( 'role' => 'author' ) ),
    228                         'contributor'   => $this->factory->user->create_and_get( array( 'role' => 'contributor' ) ),
    229                         'subscriber'    => $this->factory->user->create_and_get( array( 'role' => 'subscriber' ) ),
     225                        'administrator' => self::$factory->user->create_and_get( array( 'role' => 'administrator' ) ),
     226                        'editor'        => self::$factory->user->create_and_get( array( 'role' => 'editor' ) ),
     227                        'author'        => self::$factory->user->create_and_get( array( 'role' => 'author' ) ),
     228                        'contributor'   => self::$factory->user->create_and_get( array( 'role' => 'contributor' ) ),
     229                        'subscriber'    => self::$factory->user->create_and_get( array( 'role' => 'subscriber' ) ),
    230230                );
    231231                $caps = $this->getCapsAndRoles();
     
    259259        function test_link_manager_caps() {
    260260                $users = array(
    261                         'administrator' => $this->factory->user->create_and_get( array( 'role' => 'administrator' ) ),
    262                         'editor'        => $this->factory->user->create_and_get( array( 'role' => 'editor' ) ),
    263                         'author'        => $this->factory->user->create_and_get( array( 'role' => 'author' ) ),
    264                         'contributor'   => $this->factory->user->create_and_get( array( 'role' => 'contributor' ) ),
    265                         'subscriber'    => $this->factory->user->create_and_get( array( 'role' => 'subscriber' ) ),
     261                        'administrator' => self::$factory->user->create_and_get( array( 'role' => 'administrator' ) ),
     262                        'editor'        => self::$factory->user->create_and_get( array( 'role' => 'editor' ) ),
     263                        'author'        => self::$factory->user->create_and_get( array( 'role' => 'author' ) ),
     264                        'contributor'   => self::$factory->user->create_and_get( array( 'role' => 'contributor' ) ),
     265                        'subscriber'    => self::$factory->user->create_and_get( array( 'role' => 'subscriber' ) ),
    266266                );
    267267                $caps = array(
     
    306306                $caps = $this->getCapsAndRoles();
    307307
    308                 $user = $this->factory->user->create_and_get( array( 'role' => 'administrator' ) );
     308                $user = self::$factory->user->create_and_get( array( 'role' => 'administrator' ) );
    309309                grant_super_admin( $user->ID );
    310310
     
    322322        // a role that doesn't exist
    323323        function test_bogus_role() {
    324                 $user = $this->factory->user->create_and_get( array( 'role' => 'invalid_role' ) );
     324                $user = self::$factory->user->create_and_get( array( 'role' => 'invalid_role' ) );
    325325
    326326                // make sure the user is valid
     
    340340        // a user with multiple roles
    341341        function test_user_subscriber_contributor() {
    342                 $user = $this->factory->user->create_and_get( array( 'role' => 'subscriber' ) );
     342                $user = self::$factory->user->create_and_get( array( 'role' => 'subscriber' ) );
    343343
    344344                // make sure the user is valid
     
    373373                $this->assertTrue( $wp_roles->is_role( $role_name ) );
    374374
    375                 $user = $this->factory->user->create_and_get( array( 'role' => $role_name ) );
     375                $user = self::$factory->user->create_and_get( array( 'role' => $role_name ) );
    376376
    377377                // make sure the user is valid
     
    410410                $this->assertTrue( $wp_roles->is_role( $role_name ) );
    411411
    412                 $user = $this->factory->user->create_and_get( array( 'role' => $role_name ) );
     412                $user = self::$factory->user->create_and_get( array( 'role' => $role_name ) );
    413413
    414414                // make sure the user is valid
     
    447447
    448448                // assign a user to that role
    449                 $id = $this->factory->user->create( array( 'role' => $role_name ) );
     449                $id = self::$factory->user->create( array( 'role' => $role_name ) );
    450450
    451451                // now add a cap to the role
     
    485485
    486486                // assign a user to that role
    487                 $id = $this->factory->user->create( array( 'role' => $role_name ) );
     487                $id = self::$factory->user->create( array( 'role' => $role_name ) );
    488488
    489489                // now remove a cap from the role
     
    514514
    515515                // there are two contributors
    516                 $id_1 = $this->factory->user->create( array( 'role' => 'contributor' ) );
    517                 $id_2 = $this->factory->user->create( array( 'role' => 'contributor' ) );
     516                $id_1 = self::$factory->user->create( array( 'role' => 'contributor' ) );
     517                $id_2 = self::$factory->user->create( array( 'role' => 'contributor' ) );
    518518
    519519                // user 1 has an extra capability
     
    551551
    552552                // there are two contributors
    553                 $id_1 = $this->factory->user->create( array( 'role' => 'contributor' ) );
    554                 $id_2 = $this->factory->user->create( array( 'role' => 'contributor' ) );
     553                $id_1 = self::$factory->user->create( array( 'role' => 'contributor' ) );
     554                $id_2 = self::$factory->user->create( array( 'role' => 'contributor' ) );
    555555
    556556                // user 1 has an extra capability
     
    582582
    583583                // user starts as an author
    584                 $id = $this->factory->user->create( array( 'role' => 'author' ) );
     584                $id = self::$factory->user->create( array( 'role' => 'author' ) );
    585585                $user = new WP_User($id);
    586586                $this->assertTrue($user->exists(), "Problem getting user $id");
     
    605605        function test_user_remove_all_caps() {
    606606                // user starts as an author
    607                 $id = $this->factory->user->create( array( 'role' => 'author' ) );
     607                $id = self::$factory->user->create( array( 'role' => 'author' ) );
    608608                $user = new WP_User($id);
    609609                $this->assertTrue($user->exists(), "Problem getting user $id");
     
    647647
    648648                // Make our author
    649                 $author = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
     649                $author = new WP_User( self::$factory->user->create( array( 'role' => 'author' ) ) );
    650650
    651651                // make a post
    652                 $post = $this->factory->post->create( array( 'post_author' => $author->ID, 'post_type' => 'post' ) );
     652                $post = self::$factory->post->create( array( 'post_author' => $author->ID, 'post_type' => 'post' ) );
    653653
    654654                // the author of the post
     
    656656
    657657                // add some other users
    658                 $admin = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
    659                 $author_2 = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
    660                 $editor = new WP_User( $this->factory->user->create( array( 'role' => 'editor' ) ) );
    661                 $contributor = new WP_User( $this->factory->user->create( array( 'role' => 'contributor' ) ) );
     658                $admin = new WP_User( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
     659                $author_2 = new WP_User( self::$factory->user->create( array( 'role' => 'author' ) ) );
     660                $editor = new WP_User( self::$factory->user->create( array( 'role' => 'editor' ) ) );
     661                $contributor = new WP_User( self::$factory->user->create( array( 'role' => 'contributor' ) ) );
    662662
    663663                // administrators, editors and the post owner can edit it
     
    733733        function test_authorless_post( $status ) {
    734734                // Make a post without an author
    735                 $post = $this->factory->post->create( array( 'post_author' => 0, 'post_type' => 'post', 'post_status' => $status ) );
     735                $post = self::$factory->post->create( array( 'post_author' => 0, 'post_type' => 'post', 'post_status' => $status ) );
    736736
    737737                // Add an editor and contributor
    738                 $editor = $this->factory->user->create_and_get( array( 'role' => 'editor' ) );
    739                 $contributor = $this->factory->user->create_and_get( array( 'role' => 'contributor' ) );
     738                $editor = self::$factory->user->create_and_get( array( 'role' => 'editor' ) );
     739                $contributor = self::$factory->user->create_and_get( array( 'role' => 'contributor' ) );
    740740
    741741                // editor can edit, view, and trash
     
    754754         */
    755755        function test_create_posts_caps() {
    756                 $author = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
    757                 $admin = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
    758                 $author_2 = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
    759                 $editor = new WP_User( $this->factory->user->create( array( 'role' => 'editor' ) ) );
    760                 $contributor = new WP_User( $this->factory->user->create( array( 'role' => 'contributor' ) ) );
     756                $author = new WP_User( self::$factory->user->create( array( 'role' => 'author' ) ) );
     757                $admin = new WP_User( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
     758                $author_2 = new WP_User( self::$factory->user->create( array( 'role' => 'author' ) ) );
     759                $editor = new WP_User( self::$factory->user->create( array( 'role' => 'editor' ) ) );
     760                $contributor = new WP_User( self::$factory->user->create( array( 'role' => 'contributor' ) ) );
    761761
    762762                // create_posts isn't a real cap.
     
    819819
    820820                // Make our author
    821                 $author = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
     821                $author = new WP_User( self::$factory->user->create( array( 'role' => 'author' ) ) );
    822822
    823823                // make a page
    824                 $page = $this->factory->post->create( array( 'post_author' => $author->ID, 'post_type' => 'page' ) );
     824                $page = self::$factory->post->create( array( 'post_author' => $author->ID, 'post_type' => 'page' ) );
    825825
    826826                // the author of the page
     
    828828
    829829                // add some other users
    830                 $admin = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
    831                 $author_2 = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
    832                 $editor = new WP_User( $this->factory->user->create( array( 'role' => 'editor' ) ) );
    833                 $contributor = new WP_User( $this->factory->user->create( array( 'role' => 'contributor' ) ) );
     830                $admin = new WP_User( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
     831                $author_2 = new WP_User( self::$factory->user->create( array( 'role' => 'author' ) ) );
     832                $editor = new WP_User( self::$factory->user->create( array( 'role' => 'editor' ) ) );
     833                $contributor = new WP_User( self::$factory->user->create( array( 'role' => 'contributor' ) ) );
    834834
    835835                // administrators, editors and the post owner can edit it
     
    854854         */
    855855        function test_negative_caps() {
    856                 $author = new WP_User( $this->factory->user->create( array( 'role' => 'author' ) ) );
     856                $author = new WP_User( self::$factory->user->create( array( 'role' => 'author' ) ) );
    857857                $author->add_cap( 'foo', false );
    858858                $this->assertTrue ( isset( $author->caps['foo'] ) );
     
    865865         */
    866866        function test_set_role_same_role() {
    867                 $user = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     867                $user = new WP_User( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    868868                $caps = $user->caps;
    869869                $this->assertNotEmpty( $user->caps );
     
    876876                global $wpdb;
    877877
    878                 $user = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     878                $user = new WP_User( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    879879                $old_uid = get_current_user_id();
    880880                wp_set_current_user( $user->ID );
     
    891891                $wpdb->suppress_errors( $suppress );
    892892
    893                 $blog_id = $this->factory->blog->create( array( 'user_id' => $user->ID ) );
     893                $blog_id = self::$factory->blog->create( array( 'user_id' => $user->ID ) );
    894894                $this->assertTrue( current_user_can_for_blog( $blog_id, 'edit_posts' ) );
    895895                $this->assertFalse( current_user_can_for_blog( $blog_id, 'foo_the_bar' ) );
     
    905905
    906906                $orig_blog_id = get_current_blog_id();
    907                 $blog_id = $this->factory->blog->create();
     907                $blog_id = self::$factory->blog->create();
    908908
    909909                $this->_nullify_current_user();
     
    933933         */
    934934        function test_current_user_edit_caps() {
    935                 $user = new WP_User( $this->factory->user->create( array( 'role' => 'contributor' ) ) );
     935                $user = new WP_User( self::$factory->user->create( array( 'role' => 'contributor' ) ) );
    936936                wp_set_current_user( $user->ID );
    937937
     
    946946
    947947        function test_subscriber_cant_edit_posts() {
    948                 $user = new WP_User( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
     948                $user = new WP_User( self::$factory->user->create( array( 'role' => 'subscriber' ) ) );
    949949                wp_set_current_user( $user->ID );
    950950
    951                 $post = $this->factory->post->create( array( 'post_author' => 1 ) );
     951                $post = self::$factory->post->create( array( 'post_author' => 1 ) );
    952952
    953953                $this->assertFalse( current_user_can( 'edit_post', $post ) );
     
    961961                }
    962962
    963                 $user = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
    964                 $other_user = new WP_User( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
     963                $user = new WP_User( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
     964                $other_user = new WP_User( self::$factory->user->create( array( 'role' => 'subscriber' ) ) );
    965965
    966966                wp_set_current_user( $user->ID );
     
    975975                }
    976976
    977                 $user = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     977                $user = new WP_User( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    978978
    979979                wp_set_current_user( $user->ID );
     
    988988                }
    989989
    990                 $user = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     990                $user = new WP_User( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    991991                $user->add_cap( 'manage_network_users' );
    992                 $other_user = new WP_User( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
     992                $other_user = new WP_User( self::$factory->user->create( array( 'role' => 'subscriber' ) ) );
    993993
    994994                wp_set_current_user( $user->ID );
     
    10031003                }
    10041004
    1005                 $user = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     1005                $user = new WP_User( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    10061006                $user->add_cap( 'manage_network_users' );
    1007                 $super_admin = new WP_User( $this->factory->user->create( array( 'role' => 'subscriber' ) ) );
     1007                $super_admin = new WP_User( self::$factory->user->create( array( 'role' => 'subscriber' ) ) );
    10081008                grant_super_admin( $super_admin->ID );
    10091009
     
    10181018        function test_require_edit_others_posts_if_post_type_doesnt_exist() {
    10191019                register_post_type( 'existed' );
    1020                 $post_id = $this->factory->post->create( array( 'post_type' => 'existed' ) );
     1020                $post_id = self::$factory->post->create( array( 'post_type' => 'existed' ) );
    10211021                _unregister_post_type( 'existed' );
    10221022
    1023                 $subscriber_id = $this->factory->user->create( array( 'role' => 'subscriber' ) );
    1024                 $editor_id = $this->factory->user->create( array( 'role' => 'editor' ) );
     1023                $subscriber_id = self::$factory->user->create( array( 'role' => 'subscriber' ) );
     1024                $editor_id = self::$factory->user->create( array( 'role' => 'editor' ) );
    10251025
    10261026                $this->setExpectedIncorrectUsage( 'map_meta_cap' );
     
    10471047                $cpt = get_post_type_object( 'page_capability' );
    10481048
    1049                 $admin       = $this->factory->user->create_and_get( array( 'role' => 'administrator' ) );
    1050                 $editor      = $this->factory->user->create_and_get( array( 'role' => 'editor' ) );
    1051                 $author      = $this->factory->user->create_and_get( array( 'role' => 'author' ) );
    1052                 $contributor = $this->factory->user->create_and_get( array( 'role' => 'contributor' ) );
     1049                $admin       = self::$factory->user->create_and_get( array( 'role' => 'administrator' ) );
     1050                $editor      = self::$factory->user->create_and_get( array( 'role' => 'editor' ) );
     1051                $author      = self::$factory->user->create_and_get( array( 'role' => 'author' ) );
     1052                $contributor = self::$factory->user->create_and_get( array( 'role' => 'contributor' ) );
    10531053
    10541054                $this->assertEquals( 'edit_pages', $cpt->cap->edit_posts );
     
    10581058                $this->assertFalse( user_can( $contributor->ID, $cpt->cap->edit_posts ) );
    10591059
    1060                 $admin_post = $this->factory->post->create_and_get( array(
     1060                $admin_post = self::$factory->post->create_and_get( array(
    10611061                        'post_author' => $admin->ID,
    10621062                        'post_type'   => 'page_capability',
     
    10681068                $this->assertFalse( user_can( $contributor->ID, 'edit_post', $admin_post->ID ) );
    10691069
    1070                 $author_post = $this->factory->post->create_and_get( array(
     1070                $author_post = self::$factory->post->create_and_get( array(
    10711071                        'post_author' => $author->ID,
    10721072                        'post_type'   => 'page_capability',
  • trunk/tests/phpunit/tests/user/countUsers.php

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

    r29934 r35225  
    1010         */
    1111        public function test_user_registered() {
    12                 $u1 = $this->factory->user->create( array(
     12                $u1 = self::$factory->user->create( array(
    1313                        'user_registered' => '2012-02-14 05:05:05',
    1414                ) );
    15                 $u2 = $this->factory->user->create( array(
     15                $u2 = self::$factory->user->create( array(
    1616                        'user_registered' => '2013-02-14 05:05:05',
    1717                ) );
     
    3232         */
    3333        public function test_user_registered_relation_or() {
    34                 $u1 = $this->factory->user->create( array(
     34                $u1 = self::$factory->user->create( array(
    3535                        'user_registered' => '2012-02-14 05:05:05',
    3636                ) );
    37                 $u2 = $this->factory->user->create( array(
     37                $u2 = self::$factory->user->create( array(
    3838                        'user_registered' => '2013-02-14 05:05:05',
    3939                ) );
    40                 $u3 = $this->factory->user->create( array(
     40                $u3 = self::$factory->user->create( array(
    4141                        'user_registered' => '2014-02-14 05:05:05',
    4242                ) );
  • trunk/tests/phpunit/tests/user/listAuthors.php

    r35224 r35225  
    7272
    7373        function test_wp_list_authors_exclude_admin() {
    74                 $this->factory->post->create( array( 'post_type' => 'post', 'post_author' => 1 ) );
     74                self::$factory->post->create( array( 'post_type' => 'post', 'post_author' => 1 ) );
    7575                $expected['exclude_admin'] = '<li><a href="' . get_author_posts_url( 1 ) . '" title="Posts by admin">admin</a></li><li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li><li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li><li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>';
    7676                $this->AssertEquals( $expected['exclude_admin'], wp_list_authors( array( 'echo' => false, 'exclude_admin' => 0 ) ) );
  • trunk/tests/phpunit/tests/user/mapMetaCap.php

    r34113 r35225  
    1313                $this->user_ids = array();
    1414
    15                 $this->user_id   = $this->factory->user->create( array( 'role' => 'administrator' ) );
    16                 $this->author_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
     15                $this->user_id   = self::$factory->user->create( array( 'role' => 'administrator' ) );
     16                $this->author_id = self::$factory->user->create( array( 'role' => 'administrator' ) );
    1717
    1818                if ( isset( $GLOBALS['super_admins'] ) )
     
    249249         */
    250250        function test_authorless_posts_capabilties() {
    251                 $post_id = $this->factory->post->create( array( 'post_author' => 0, 'post_type' => 'post', 'post_status' => 'publish' ) );
    252                 $editor = $this->factory->user->create( array( 'role' => 'editor' ) );
     251                $post_id = self::$factory->post->create( array( 'post_author' => 0, 'post_type' => 'post', 'post_status' => 'publish' ) );
     252                $editor = self::$factory->user->create( array( 'role' => 'editor' ) );
    253253
    254254                $this->assertEquals( array( 'edit_others_posts', 'edit_published_posts' ), map_meta_cap( 'edit_post', $editor, $post_id ) );
  • trunk/tests/phpunit/tests/user/multisite.php

    r34172 r35225  
    2626
    2727        function test_remove_user_from_blog() {
    28                 $user1 = $this->factory->user->create_and_get();
    29                 $user2 = $this->factory->user->create_and_get();
    30 
    31                 $post_id = $this->factory->post->create( array( 'post_author' => $user1->ID ) );
     28                $user1 = self::$factory->user->create_and_get();
     29                $user2 = self::$factory->user->create_and_get();
     30
     31                $post_id = self::$factory->post->create( array( 'post_author' => $user1->ID ) );
    3232
    3333                remove_user_from_blog( $user1->ID, 1, $user2->ID );
     
    4343         */
    4444        function test_get_blogs_of_user() {
    45                 $user1_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
     45                $user1_id = self::$factory->user->create( array( 'role' => 'administrator' ) );
    4646
    4747                // Maintain a list of 6 total sites and include the primary network site.
    48                 $blog_ids = $this->factory->blog->create_many( 5, array( 'user_id' => $user1_id ) );
     48                $blog_ids = self::$factory->blog->create_many( 5, array( 'user_id' => $user1_id ) );
    4949                $blog_ids = array_merge( array( 1 ), $blog_ids );
    5050
     
    115115                global $wpdb;
    116116
    117                 $user1_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
     117                $user1_id = self::$factory->user->create( array( 'role' => 'administrator' ) );
    118118
    119119                $old_current = get_current_user_id();
     
    125125                $blog_ids = array();
    126126
    127                 $blog_ids = $this->factory->blog->create_many( 5 );
     127                $blog_ids = self::$factory->blog->create_many( 5 );
    128128                foreach ( $blog_ids as $blog_id ) {
    129129                        $this->assertInternalType( 'int', $blog_id );
     
    139139                global $wpdb;
    140140
    141                 $user1_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
    142                 $user2_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
     141                $user1_id = self::$factory->user->create( array( 'role' => 'administrator' ) );
     142                $user2_id = self::$factory->user->create( array( 'role' => 'administrator' ) );
    143143
    144144                $old_current = get_current_user_id();
     
    157157                $this->assertTrue( is_user_member_of_blog( $user1_id, $wpdb->blogid ) );
    158158
    159                 $blog_ids = $this->factory->blog->create_many( 5 );
     159                $blog_ids = self::$factory->blog->create_many( 5 );
    160160                foreach ( $blog_ids as $blog_id ) {
    161161                        $this->assertInternalType( 'int', $blog_id );
     
    198198         */
    199199        function test_is_user_spammy() {
    200                 $user_id = $this->factory->user->create( array(
     200                $user_id = self::$factory->user->create( array(
    201201                        'role' => 'author',
    202202                        'user_login' => 'testuser1',
     
    204204
    205205                $spam_username = (string) $user_id;
    206                 $spam_user_id = $this->factory->user->create( array(
     206                $spam_user_id = self::$factory->user->create( array(
    207207                        'role' => 'author',
    208208                        'user_login' => $spam_username,
     
    220220                global $wp_rewrite;
    221221
    222                 $this->factory->blog->create();
    223                 $user_id = $this->factory->user->create();
    224                 $this->factory->blog->create( array( 'user_id' => $user_id ) );
     222                self::$factory->blog->create();
     223                $user_id = self::$factory->user->create();
     224                self::$factory->blog->create( array( 'user_id' => $user_id ) );
    225225
    226226                $blogs = get_blogs_of_user( $user_id );
     
    262262                }
    263263
    264                 $user_id = $this->factory->user->create();
     264                $user_id = self::$factory->user->create();
    265265                grant_super_admin( $user_id );
    266266                revoke_super_admin( $user_id );
     
    279279                }
    280280
    281                 $user_id = $this->factory->user->create();
     281                $user_id = self::$factory->user->create();
    282282                grant_super_admin( $user_id );
    283283                revoke_super_admin( $user_id );
     
    298298                }
    299299
    300                 $user_id = $this->factory->user->create();
     300                $user_id = self::$factory->user->create();
    301301                grant_super_admin( $user_id );
    302302
     
    317317                }
    318318
    319                 $user_id = $this->factory->user->create();
     319                $user_id = self::$factory->user->create();
    320320
    321321                $this->assertFalse( is_super_admin( $user_id ) );
     
    330330
    331331                // Try with two users.
    332                 $second_user = $this->factory->user->create();
     332                $second_user = self::$factory->user->create();
    333333                $this->assertTrue( grant_super_admin( $user_id ) );
    334334                $this->assertTrue( grant_super_admin( $second_user ) );
     
    344344
    345345        public function test_numeric_string_user_id() {
    346                 $u = $this->factory->user->create();
     346                $u = self::$factory->user->create();
    347347
    348348                $u_string = (string) $u;
     
    362362         */
    363363        public function test_should_return_false_for_object_user_id() {
    364                 $u_obj = $this->factory->user->create_and_get();
     364                $u_obj = self::$factory->user->create_and_get();
    365365                $this->assertFalse( wpmu_delete_user( $u_obj ) );
    366366                $this->assertEquals( $u_obj->ID, username_exists( $u_obj->user_login ) );
  • trunk/tests/phpunit/tests/user/query.php

    r35224 r35225  
    246246         */
    247247        public function test_orderby_clause_key_as_secondary_sort() {
    248                 $u1 = self::$static_factory->user->create( array(
     248                $u1 = self::$factory->user->create( array(
    249249                        'user_registered' => '2015-01-28 03:00:00',
    250250                ) );
    251                 $u2 = self::$static_factory->user->create( array(
     251                $u2 = self::$factory->user->create( array(
    252252                        'user_registered' => '2015-01-28 05:00:00',
    253253                ) );
    254                 $u3 = self::$static_factory->user->create( array(
     254                $u3 = self::$factory->user->create( array(
    255255                        'user_registered' => '2015-01-28 03:00:00',
    256256                ) );
     
    599599                }
    600600
    601                 $b = $this->factory->blog->create();
     601                $b = self::$factory->blog->create();
    602602
    603603                add_user_to_blog( $b, self::$author_ids[0], 'author' );
     
    625625                }
    626626
    627                 $b = $this->factory->blog->create();
     627                $b = self::$factory->blog->create();
    628628                add_user_to_blog( $b, self::$author_ids[0], 'author' );
    629629
     
    650650                }
    651651
    652                 $b = $this->factory->blog->create();
     652                $b = self::$factory->blog->create();
    653653
    654654                add_user_to_blog( $b, self::$author_ids[0], 'subscriber' );
     
    676676                }
    677677
    678                 $b = $this->factory->blog->create();
     678                $b = self::$factory->blog->create();
    679679
    680680                add_user_to_blog( $b, self::$author_ids[0], 'subscriber' );
     
    708708                register_post_type( 'wptests_pt_private', array( 'public' => false ) );
    709709
    710                 $this->factory->post->create( array( 'post_author' => self::$author_ids[0], 'post_status' => 'publish', 'post_type' => 'wptests_pt_public' ) );
    711                 $this->factory->post->create( array( 'post_author' => self::$author_ids[1], 'post_status' => 'publish', 'post_type' => 'wptests_pt_private' ) );
     710                self::$factory->post->create( array( 'post_author' => self::$author_ids[0], 'post_status' => 'publish', 'post_type' => 'wptests_pt_public' ) );
     711                self::$factory->post->create( array( 'post_author' => self::$author_ids[1], 'post_status' => 'publish', 'post_type' => 'wptests_pt_private' ) );
    712712
    713713                $q = new WP_User_Query( array(
     
    728728                register_post_type( 'wptests_pt_private', array( 'public' => false ) );
    729729
    730                 $this->factory->post->create( array( 'post_author' => self::$author_ids[0], 'post_status' => 'publish', 'post_type' => 'wptests_pt_public' ) );
    731                 $this->factory->post->create( array( 'post_author' => self::$author_ids[1], 'post_status' => 'publish', 'post_type' => 'wptests_pt_private' ) );
    732                 $this->factory->post->create( array( 'post_author' => self::$author_ids[2], 'post_status' => 'publish', 'post_type' => 'post' ) );
     730                self::$factory->post->create( array( 'post_author' => self::$author_ids[0], 'post_status' => 'publish', 'post_type' => 'wptests_pt_public' ) );
     731                self::$factory->post->create( array( 'post_author' => self::$author_ids[1], 'post_status' => 'publish', 'post_type' => 'wptests_pt_private' ) );
     732                self::$factory->post->create( array( 'post_author' => self::$author_ids[2], 'post_status' => 'publish', 'post_type' => 'post' ) );
    733733
    734734                $q = new WP_User_Query( array(
     
    749749                register_post_type( 'wptests_pt_private', array( 'public' => false ) );
    750750
    751                 $this->factory->post->create( array( 'post_author' => self::$author_ids[0], 'post_status' => 'draft', 'post_type' => 'wptests_pt_public' ) );
    752                 $this->factory->post->create( array( 'post_author' => self::$author_ids[1], 'post_status' => 'inherit', 'post_type' => 'wptests_pt_private' ) );
    753                 $this->factory->post->create( array( 'post_author' => self::$author_ids[2], 'post_status' => 'publish', 'post_type' => 'post' ) );
     751                self::$factory->post->create( array( 'post_author' => self::$author_ids[0], 'post_status' => 'draft', 'post_type' => 'wptests_pt_public' ) );
     752                self::$factory->post->create( array( 'post_author' => self::$author_ids[1], 'post_status' => 'inherit', 'post_type' => 'wptests_pt_private' ) );
     753                self::$factory->post->create( array( 'post_author' => self::$author_ids[2], 'post_status' => 'publish', 'post_type' => 'post' ) );
    754754
    755755                $q = new WP_User_Query( array(
     
    771771                }
    772772
    773                 $blogs = $this->factory->blog->create_many( 2 );
     773                $blogs = self::$factory->blog->create_many( 2 );
    774774
    775775                add_user_to_blog( $blogs[0], self::$author_ids[0], 'author' );
     
    779779
    780780                switch_to_blog( $blogs[0] );
    781                 $this->factory->post->create( array( 'post_author' => self::$author_ids[0], 'post_status' => 'publish', 'post_type' => 'post' ) );
     781                self::$factory->post->create( array( 'post_author' => self::$author_ids[0], 'post_status' => 'publish', 'post_type' => 'post' ) );
    782782                restore_current_blog();
    783783
    784784                switch_to_blog( $blogs[1] );
    785                 $this->factory->post->create( array( 'post_author' => self::$author_ids[1], 'post_status' => 'publish', 'post_type' => 'post' ) );
     785                self::$factory->post->create( array( 'post_author' => self::$author_ids[1], 'post_status' => 'publish', 'post_type' => 'post' ) );
    786786                restore_current_blog();
    787787
     
    932932         */
    933933        public function test_get_single_role_by_string_which_is_similar() {
    934                 $another_editor = $this->factory->user->create( array(
     934                $another_editor = self::$factory->user->create( array(
    935935                        'role' => 'another-editor',
    936936                ) );
     
    11491149                }
    11501150
    1151                 $sites = self::$static_factory->blog->create_many( 2 );
     1151                $sites = self::$factory->blog->create_many( 2 );
    11521152
    11531153                add_user_to_blog( $sites[0], self::$author_ids[0], 'author' );
  • trunk/tests/phpunit/tests/user/session.php

    r29635 r35225  
    1111                parent::setUp();
    1212                remove_all_filters( 'session_token_manager' );
    13                 $user_id = $this->factory->user->create();
     13                $user_id = self::$factory->user->create();
    1414                $this->manager = WP_Session_Tokens::get_instance( $user_id );
    1515                $this->assertInstanceOf( 'WP_Session_Tokens', $this->manager );
  • trunk/tests/phpunit/tests/user/slashes.php

    r31065 r35225  
    99        function setUp() {
    1010                parent::setUp();
    11                 $this->author_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
     11                $this->author_id = self::$factory->user->create( array( 'role' => 'administrator' ) );
    1212                $this->old_current_user = get_current_user_id();
    1313                wp_set_current_user( $this->author_id );
     
    8484         */
    8585        function test_edit_user() {
    86                 $id = $this->factory->user->create();
     86                $id = self::$factory->user->create();
    8787
    8888                $_POST = $_GET = $_REQUEST = array();
     
    174174         */
    175175        function test_wp_update_user() {
    176                 $id = $this->factory->user->create();
     176                $id = self::$factory->user->create();
    177177                $id = wp_update_user(array(
    178178                        'ID' => $id,
  • trunk/tests/phpunit/tests/user/updateUserCaches.php

    r34919 r35225  
    88                global $wpdb;
    99
    10                 $u = $this->factory->user->create();
     10                $u = self::$factory->user->create();
    1111                $raw_userdata = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE ID = %d", $u ) );
    1212
     
    5858                global $wpdb;
    5959
    60                 $u = $this->factory->user->create();
     60                $u = self::$factory->user->create();
    6161                $raw_userdata = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE ID = %d", $u ) );
    6262                $user_object = new WP_User( $u );
  • trunk/tests/phpunit/tests/user/wpDeleteUser.php

    r35224 r35225  
    1515                $this->assertEquals( array(), get_blogs_of_user( 0 ) );
    1616
    17                 $user_id = $this->factory->user->create( array( 'role' => 'subscriber' ) );
     17                $user_id = self::$factory->user->create( array( 'role' => 'subscriber' ) );
    1818                $blogs = get_blogs_of_user( $user_id );
    1919                $this->assertEquals( array( 1 ), array_keys( $blogs ) );
     
    3535                $old_current = get_current_user_id();
    3636
    37                 $user_id = $this->factory->user->create( array( 'role' => 'subscriber' ) );
     37                $user_id = self::$factory->user->create( array( 'role' => 'subscriber' ) );
    3838                wp_set_current_user( $user_id );
    3939
     
    5555
    5656        function test_delete_user() {
    57                 $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
     57                $user_id = self::$factory->user->create( array( 'role' => 'author' ) );
    5858                $user = new WP_User( $user_id );
    5959
     
    112112         */
    113113        function test_wp_delete_user_reassignment_clears_post_caches() {
    114                 $user_id   = $this->factory->user->create();
    115                 $reassign  = $this->factory->user->create();
    116                 $post_id   = $this->factory->post->create( array( 'post_author' => $user_id ) );
     114                $user_id   = self::$factory->user->create();
     115                $reassign  = self::$factory->user->create();
     116                $post_id   = self::$factory->post->create( array( 'post_author' => $user_id ) );
    117117
    118118                get_post( $post_id ); // Ensure this post is in the cache.
     
    129129                }
    130130
    131                 $u = $this->factory->user->create();
     131                $u = self::$factory->user->create();
    132132
    133133                $u_string = (string) $u;
     
    151151                }
    152152
    153                 $u_obj = $this->factory->user->create_and_get();
     153                $u_obj = self::$factory->user->create_and_get();
    154154                $this->assertFalse( wp_delete_user( $u_obj ) );
    155155                $this->assertEquals( $u_obj->ID, username_exists( $u_obj->user_login ) );
  • trunk/tests/phpunit/tests/user/wpGetUsersWithNoRole.php

    r34965 r35225  
    1616
    1717                // Setup users
    18                 $admin = $this->factory->user->create( array(
     18                $admin = self::$factory->user->create( array(
    1919                        'role' => 'administrator',
    2020                ) );
    21                 $editor = $this->factory->user->create( array(
     21                $editor = self::$factory->user->create( array(
    2222                        'role' => 'editor',
    2323                ) );
    24                 $nobody = $this->factory->user->create( array(
     24                $nobody = self::$factory->user->create( array(
    2525                        'role' => '',
    2626                ) );
    27                 $nobody_else = $this->factory->user->create( array(
     27                $nobody_else = self::$factory->user->create( array(
    2828                        'role' => '',
    2929                ) );
     
    5050
    5151                // Setup users
    52                 $admin = $this->factory->user->create( array(
     52                $admin = self::$factory->user->create( array(
    5353                        'role' => 'administrator',
    5454                ) );
    55                 $editor = $this->factory->user->create( array(
     55                $editor = self::$factory->user->create( array(
    5656                        'role' => 'editor',
    5757                ) );
    58                 $nobody = $this->factory->user->create( array(
     58                $nobody = self::$factory->user->create( array(
    5959                        'role' => '',
    6060                ) );
    6161
    6262                // Setup blogs
    63                 $blog_1 = (int) $this->factory->blog->create( array(
     63                $blog_1 = (int) self::$factory->blog->create( array(
    6464                        'user_id' => $editor,
    6565                ) );
  • trunk/tests/phpunit/tests/user/wpSetCurrentUser.php

    r34947 r35225  
    66class Tests_User_WpSetCurrentUser extends WP_UnitTestCase {
    77        public function test_set_by_id() {
    8                 $u = $this->factory->user->create();
     8                $u = self::$factory->user->create();
    99
    1010                $user = wp_set_current_user( $u );
     
    1616
    1717        public function test_name_should_be_ignored_if_id_is_not_null() {
    18                 $u = $this->factory->user->create();
     18                $u = self::$factory->user->create();
    1919
    2020                $user = wp_set_current_user( $u, 'foo' );
     
    2626
    2727        public function test_should_set_by_name_if_id_is_null_and_current_user_is_nonempty() {
    28                 $u1 = $this->factory->user->create();
     28                $u1 = self::$factory->user->create();
    2929                wp_set_current_user( $u1 );
    3030                $this->assertSame( $u1, get_current_user_id() );
    3131
    32                 $u2 = $this->factory->user->create( array(
     32                $u2 = self::$factory->user->create( array(
    3333                        'user_login' => 'foo',
    3434                ) );
     
    5050                $this->assertSame( 0, get_current_user_id() );
    5151
    52                 $u = $this->factory->user->create( array(
     52                $u = self::$factory->user->create( array(
    5353                        'user_login' => 'foo',
    5454                ) );
  • trunk/tests/phpunit/tests/widgets.php

    r35113 r35225  
    439439                $this->assertFalse( $widget->is_preview() );
    440440
    441                 wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) );
     441                wp_set_current_user( self::$factory->user->create( array( 'role' => 'administrator' ) ) );
    442442                require_once ABSPATH . WPINC . '/class-wp-customize-manager.php';
    443443                $wp_customize = new WP_Customize_Manager();
     
    619619                );
    620620                $actual = ob_get_clean();
    621                
     621
    622622                unregister_widget( 'WP_Widget_Text' );
    623623
  • trunk/tests/phpunit/tests/xmlrpc/mt/getRecentPostTitles.php

    r25002 r35225  
    2323                $this->make_user_by_role( 'author' );
    2424                $editor = $this->make_user_by_role( 'editor' );
    25                 $this->factory->post->create( array( 'post_author' => $editor ) );
     25                self::$factory->post->create( array( 'post_author' => $editor ) );
    2626
    2727                $result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
     
    3333                $this->make_user_by_role( 'author' );
    3434
    35                 $this->factory->post->create();
     35                self::$factory->post->create();
    3636
    3737                $results = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
  • trunk/tests/phpunit/tests/xmlrpc/mw/editPost.php

    r34855 r35225  
    127127                // create attachment
    128128                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
    129                 $attachment_id = $this->factory->attachment->create_upload_object( $filename, $post_id );
     129                $attachment_id = self::$factory->attachment->create_upload_object( $filename, $post_id );
    130130
    131131                // add post thumbnail to post that does not have one
     
    142142
    143143                // create another attachment
    144                 $attachment2_id = $this->factory->attachment->create_upload_object( $filename, $post_id );
     144                $attachment2_id = self::$factory->attachment->create_upload_object( $filename, $post_id );
    145145
    146146                // change the post's post_thumbnail
     
    229229                $editor_id = $this->make_user_by_role( 'editor' );
    230230
    231                 $post_id = $this->factory->post->create( array(
     231                $post_id = self::$factory->post->create( array(
    232232                        'post_author' => $editor_id
    233233                ) );
     
    252252                $editor_id = $this->make_user_by_role( 'editor' );
    253253
    254                 $post_id = $this->factory->post->create( array(
     254                $post_id = self::$factory->post->create( array(
    255255                        'post_title' => 'Title',
    256256                        'post_author' => $editor_id,
  • trunk/tests/phpunit/tests/xmlrpc/mw/getPost.php

    r34855 r35225  
    9696                // create attachment
    9797                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
    98                 $attachment_id = $this->factory->attachment->create_upload_object( $filename );
     98                $attachment_id = self::$factory->attachment->create_upload_object( $filename );
    9999
    100100                set_post_thumbnail( $this->post_id, $attachment_id );
  • trunk/tests/phpunit/tests/xmlrpc/mw/getRecentPosts.php

    r34855 r35225  
    101101                // create attachment
    102102                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
    103                 $attachment_id = $this->factory->attachment->create_upload_object( $filename, $this->post_id );
     103                $attachment_id = self::$factory->attachment->create_upload_object( $filename, $this->post_id );
    104104                set_post_thumbnail( $this->post_id, $attachment_id );
    105105
  • trunk/tests/phpunit/tests/xmlrpc/mw/newPost.php

    r34855 r35225  
    118118                // create attachment
    119119                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
    120                 $attachment_id = $this->factory->attachment->create_upload_object( $filename );
     120                $attachment_id = self::$factory->attachment->create_upload_object( $filename );
    121121
    122122                $post = array( 'title' => 'Post Thumbnail Test', 'wp_post_thumbnail' => $attachment_id );
  • trunk/tests/phpunit/tests/xmlrpc/wp/deletePost.php

    r25002 r35225  
    2222        function test_incapable_user() {
    2323                $this->make_user_by_role( 'subscriber' );
    24                 $post_id = $this->factory->post->create();
     24                $post_id = self::$factory->post->create();
    2525
    2626                $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'subscriber', 'subscriber', $post_id ) );
     
    3131        function test_post_deleted() {
    3232                $this->make_user_by_role( 'editor' );
    33                 $post_id = $this->factory->post->create();
     33                $post_id = self::$factory->post->create();
    3434
    3535                $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'editor', 'editor', $post_id ) );
  • trunk/tests/phpunit/tests/xmlrpc/wp/editComment.php

    r34681 r35225  
    88        function test_author_can_edit_own_comment() {
    99                $author_id = $this->make_user_by_role( 'author' );
    10                 $post_id = $this->factory->post->create( array(
     10                $post_id = self::$factory->post->create( array(
    1111                        'post_title' => 'Post test by author',
    1212                        'post_author' => $author_id
     
    3030                $this->make_user_by_role( 'author' );
    3131                $editor_id = $this->make_user_by_role( 'editor' );
    32                 $post_id = $this->factory->post->create( array(
     32                $post_id = self::$factory->post->create( array(
    3333                        'post_title' => 'Post test by editor',
    3434                        'post_author' => $editor_id
     
    5050        function test_trash_comment() {
    5151                $this->make_user_by_role( 'administrator' );
    52                 $post_id = $this->factory->post->create();
     52                $post_id = self::$factory->post->create();
    5353
    5454                $comment_data = array(
     
    7979
    8080                $this->make_user_by_role( 'administrator' );
    81                 $post_id = $this->factory->post->create();
     81                $post_id = self::$factory->post->create();
    8282
    8383                $comment_data = array(
  • trunk/tests/phpunit/tests/xmlrpc/wp/editPost.php

    r34855 r35225  
    127127                // create attachment
    128128                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
    129                 $attachment_id = $this->factory->attachment->create_upload_object( $filename, $post_id );
     129                $attachment_id = self::$factory->attachment->create_upload_object( $filename, $post_id );
    130130
    131131                // add post thumbnail to post that does not have one
     
    149149
    150150                // create another attachment
    151                 $attachment2_id = $this->factory->attachment->create_upload_object( $filename, $post_id );
     151                $attachment2_id = self::$factory->attachment->create_upload_object( $filename, $post_id );
    152152
    153153                // change the post's post_thumbnail
     
    209209                $editor_id = $this->make_user_by_role( 'editor' );
    210210
    211                 $post_id = $this->factory->post->create( array( 'post_author' => $editor_id ) );
     211                $post_id = self::$factory->post->create( array( 'post_author' => $editor_id ) );
    212212                stick_post( $post_id );
    213213
     
    221221                // when transitioning to private status or adding a post password, post should be un-stuck
    222222                $editor_id = $this->make_user_by_role( 'editor' );
    223                 $post_id = $this->factory->post->create( array( 'post_author' => $editor_id ) );
     223                $post_id = self::$factory->post->create( array( 'post_author' => $editor_id ) );
    224224                stick_post( $post_id );
    225225
     
    235235                $yesterday = strtotime( '-1 day' );
    236236
    237                 $post_id = $this->factory->post->create( array(
     237                $post_id = self::$factory->post->create( array(
    238238                        'post_title'   => 'Post Revision Test',
    239239                        'post_content' => 'Not edited',
     
    264264                $editor_id = $this->make_user_by_role( 'editor' );
    265265
    266                 $post_id = $this->factory->post->create( array(
     266                $post_id = self::$factory->post->create( array(
    267267                        'post_title'   => 'Post Revision Test',
    268268                        'post_content' => 'Not edited',
     
    283283                $editor_id = $this->make_user_by_role( 'editor' );
    284284
    285                 $post_id = $this->factory->post->create( array(
     285                $post_id = self::$factory->post->create( array(
    286286                        'post_title'   => 'Post Revision Test',
    287287                        'post_content' => 'Not edited',
     
    303303                $editor_id = $this->make_user_by_role( 'editor' );
    304304
    305                 $post_id = $this->factory->post->create( array( 'post_author'  => $editor_id ) );
    306                 $term_id = $this->factory->category->create();
    307                 $this->factory->term->add_post_terms( $post_id, $term_id, 'category', true );
     305                $post_id = self::$factory->post->create( array( 'post_author'  => $editor_id ) );
     306                $term_id = self::$factory->category->create();
     307                self::$factory->term->add_post_terms( $post_id, $term_id, 'category', true );
    308308                $term_ids = wp_list_pluck( get_the_category( $post_id ), 'term_id' );
    309309                $this->assertContains( $term_id, $term_ids );
     
    323323                $editor_id = $this->make_user_by_role( 'editor' );
    324324
    325                 $post_id = $this->factory->post->create( array( 'post_author'  => $editor_id ) );
    326                 $term_id = $this->factory->category->create();
    327                 $this->factory->term->add_post_terms( $post_id, $term_id, 'category', true );
     325                $post_id = self::$factory->post->create( array( 'post_author'  => $editor_id ) );
     326                $term_id = self::$factory->category->create();
     327                self::$factory->term->add_post_terms( $post_id, $term_id, 'category', true );
    328328                $term_ids = wp_list_pluck( get_the_category( $post_id ), 'term_id' );
    329329                $this->assertContains( $term_id, $term_ids );
     
    366366
    367367                // Add a dummy post
    368                 $post_id = $this->factory->post->create( array(
     368                $post_id = self::$factory->post->create( array(
    369369                        'post_title'   => 'Post Enclosure Test',
    370370                        'post_content' => 'Fake content',
  • trunk/tests/phpunit/tests/xmlrpc/wp/getComment.php

    r25002 r35225  
    1414                parent::setUp();
    1515
    16                 $this->post_id = $this->factory->post->create();
     16                $this->post_id = self::$factory->post->create();
    1717
    1818                $this->parent_comment_data = array(
  • trunk/tests/phpunit/tests/xmlrpc/wp/getComments.php

    r35154 r35225  
    2222
    2323        function test_capable_user() {
    24                 $this->post_id = $this->factory->post->create();
    25                 $this->factory->comment->create_post_comments( $this->post_id, 2 );
     24                $this->post_id = self::$factory->post->create();
     25                self::$factory->comment->create_post_comments( $this->post_id, 2 );
    2626
    2727                $this->make_user_by_role( 'editor' );
     
    3737
    3838        function test_post_filter() {
    39                 $this->post_id = $this->factory->post->create();
    40                 $this->factory->comment->create_post_comments( $this->post_id, 2 );
     39                $this->post_id = self::$factory->post->create();
     40                self::$factory->comment->create_post_comments( $this->post_id, 2 );
    4141
    4242                $this->make_user_by_role( 'editor' );
     
    5353
    5454        function test_number_filter() {
    55                 $this->post_id = $this->factory->post->create();
    56                 $this->factory->comment->create_post_comments( $this->post_id, 11 );
     55                $this->post_id = self::$factory->post->create();
     56                self::$factory->comment->create_post_comments( $this->post_id, 11 );
    5757
    5858                $this->make_user_by_role( 'editor' );
     
    7777                $this->make_user_by_role( 'contributor' );
    7878                $author_id = $this->make_user_by_role( 'author' );
    79                 $author_post_id = $this->factory->post->create( array(
     79                $author_post_id = self::$factory->post->create( array(
    8080                        'post_title' => 'Author',
    8181                        'post_author' => $author_id,
     
    8383                ) );
    8484
    85                 $this->factory->comment->create( array(
     85                self::$factory->comment->create( array(
    8686                        'comment_post_ID' => $author_post_id,
    8787                        'comment_author' => "Commenter 1",
     
    9191
    9292                $editor_id = $this->make_user_by_role( 'editor' );
    93                 $editor_post_id = $this->factory->post->create( array(
     93                $editor_post_id = self::$factory->post->create( array(
    9494                        'post_title' => 'Editor',
    9595                        'post_author' => $editor_id,
     
    9797                ) );
    9898
    99                 $this->factory->comment->create( array(
     99                self::$factory->comment->create( array(
    100100                        'comment_post_ID' => $editor_post_id,
    101101                        'comment_author' => 'Commenter 2',
     
    111111        function test_author_capabilities() {
    112112                $author_id = $this->make_user_by_role( 'author' );
    113                 $author_post_id = $this->factory->post->create( array(
     113                $author_post_id = self::$factory->post->create( array(
    114114                        'post_title' => 'Author',
    115115                        'post_author' => $author_id,
     
    117117                ) );
    118118
    119                 $this->factory->comment->create( array(
     119                self::$factory->comment->create( array(
    120120                        'comment_post_ID' => $author_post_id,
    121121                        'comment_author' => 'Commenter 1',
     
    125125
    126126                $editor_id = $this->make_user_by_role( 'editor' );
    127                 $editor_post_id = $this->factory->post->create( array(
     127                $editor_post_id = self::$factory->post->create( array(
    128128                        'post_title' => 'Editor',
    129129                        'post_author' => $editor_id,
     
    131131                ) );
    132132
    133                 $this->factory->comment->create( array(
     133                self::$factory->comment->create( array(
    134134                        'comment_post_ID' => $editor_post_id,
    135135                        'comment_author' => 'Commenter 2',
     
    167167        function test_editor_capabilities() {
    168168                $author_id = $this->make_user_by_role( 'author' );
    169                 $author_post_id = $this->factory->post->create( array(
     169                $author_post_id = self::$factory->post->create( array(
    170170                        'post_title' => 'Author',
    171171                        'post_author' => $author_id,
     
    173173                ) );
    174174
    175                 $this->factory->comment->create( array(
     175                self::$factory->comment->create( array(
    176176                        'comment_post_ID' => $author_post_id,
    177177                        'comment_author' => 'Commenter 1',
     
    181181
    182182                $editor_id = $this->make_user_by_role( 'editor' );
    183                 $editor_post_id = $this->factory->post->create( array(
     183                $editor_post_id = self::$factory->post->create( array(
    184184                        'post_title' => 'Editor',
    185185                        'post_author' => $editor_id,
     
    187187                ) );
    188188
    189                 $this->factory->comment->create(array(
     189                self::$factory->comment->create(array(
    190190                        'comment_post_ID' => $editor_post_id,
    191191                        'comment_author' => 'Commenter 2',
  • trunk/tests/phpunit/tests/xmlrpc/wp/getPost.php

    r25002 r35225  
    123123                $this->make_user_by_role( 'editor' );
    124124
    125                 $parent_page_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
    126                 $child_page_id = $this->factory->post->create( array(
     125                $parent_page_id = self::$factory->post->create( array( 'post_type' => 'page' ) );
     126                $child_page_id = self::$factory->post->create( array(
    127127                        'post_type' => 'page',
    128128                        'post_parent' => $parent_page_id,
  • trunk/tests/phpunit/tests/xmlrpc/wp/getPosts.php

    r35137 r35225  
    5555                $num_posts = 4;
    5656                foreach ( range( 1, $num_posts ) as $i ) {
    57                         $post_ids[] = $this->factory->post->create( array(
     57                        $post_ids[] = self::$factory->post->create( array(
    5858                                'post_type' => $cpt_name,
    5959                                'post_date' => date( 'Y-m-d H:i:s', time() + $i )
     
    8181                foreach ( $post_ids as $key => $post_id ) {
    8282                        // Larger post IDs will get more comments.
    83                         $this->factory->comment->create_post_comments( $post_id, $key );
     83                        self::$factory->comment->create_post_comments( $post_id, $key );
    8484                }
    8585
     
    110110        function test_fields() {
    111111                $this->make_user_by_role( 'editor' );
    112                 $this->factory->post->create();
     112                self::$factory->post->create();
    113113
    114114                // check default fields
     
    137137                $this->make_user_by_role( 'editor' );
    138138
    139                 $post_ids[] = $this->factory->post->create( array( 'post_title' => 'First: ' . rand_str() ) );
    140                 $post_ids[] = $this->factory->post->create( array( 'post_title' => 'Second: ' . rand_str() ) );
     139                $post_ids[] = self::$factory->post->create( array( 'post_title' => 'First: ' . rand_str() ) );
     140                $post_ids[] = self::$factory->post->create( array( 'post_title' => 'Second: ' . rand_str() ) );
    141141
    142142                // Search for none of them
  • trunk/tests/phpunit/tests/xmlrpc/wp/getRevisions.php

    r25002 r35225  
    1515                $this->make_user_by_role( 'subscriber' );
    1616
    17                 $post_id = $this->factory->post->create();
     17                $post_id = self::$factory->post->create();
    1818
    1919                $result = $this->myxmlrpcserver->wp_getRevisions( array( 1, 'subscriber', 'subscriber', $post_id ) );
     
    2525                $this->make_user_by_role( 'editor' );
    2626
    27                 $post_id = $this->factory->post->create();
     27                $post_id = self::$factory->post->create();
    2828                $result = $this->myxmlrpcserver->wp_getRevisions( array( 1, 'editor', 'editor', $post_id ) );
    2929                $this->assertNotInstanceOf( 'IXR_Error', $result );
     
    3333                $this->make_user_by_role( 'editor' );
    3434
    35                 $post_id = $this->factory->post->create();
     35                $post_id = self::$factory->post->create();
    3636                wp_insert_post( array( 'ID' => $post_id, 'post_content' => 'Edit 1' ) ); // Create the initial revision
    3737
  • trunk/tests/phpunit/tests/xmlrpc/wp/getTerms.php

    r25002 r35225  
    107107                $cat2 = wp_create_category( 'wp.getTerms_' . rand_str( 16 ) );
    108108
    109                 $this->factory->post->create_many( 5, array( 'post_category' => array( $cat1 ) ) );
    110                 $this->factory->post->create_many( 3, array( 'post_category' => array( $cat2 ) ) );
     109                self::$factory->post->create_many( 5, array( 'post_category' => array( $cat1 ) ) );
     110                self::$factory->post->create_many( 3, array( 'post_category' => array( $cat2 ) ) );
    111111
    112112                $filter = array( 'orderby' => 'count', 'order' => 'DESC' );
  • trunk/tests/phpunit/tests/xmlrpc/wp/getUsers.php

    r35137 r35225  
    8080                        grant_super_admin( $administrator_id );
    8181
    82                 $this->factory->user->create_many( 5 );
     82                self::$factory->user->create_many( 5 );
    8383
    8484                $user_ids = get_users( array( 'fields' => 'ID' ) );
  • trunk/tests/phpunit/tests/xmlrpc/wp/newComment.php

    r34559 r35225  
    77        function test_new_comment_post_closed() {
    88                $this->make_user_by_role( 'administrator' );
    9                 $post = $this->factory->post->create_and_get( array(
     9                $post = self::$factory->post->create_and_get( array(
    1010                        'comment_status' => 'closed'
    1111                ) );
  • trunk/tests/phpunit/tests/xmlrpc/wp/newPost.php

    r34855 r35225  
    129129                // create attachment
    130130                $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' );
    131                 $attachment_id = $this->factory->attachment->create_upload_object( $filename );
     131                $attachment_id = self::$factory->attachment->create_upload_object( $filename );
    132132
    133133                $post = array( 'post_title' => 'Post Thumbnail Test', 'post_thumbnail' => $attachment_id );
  • trunk/tests/phpunit/tests/xmlrpc/wp/restoreRevision.php

    r29788 r35225  
    1111                parent::setUp();
    1212
    13                 $this->post_id = $this->factory->post->create( array( 'post_content' => 'edit1' ) ); // Not saved as a revision
     13                $this->post_id = self::$factory->post->create( array( 'post_content' => 'edit1' ) ); // Not saved as a revision
    1414                // First saved revision on update, see https://core.trac.wordpress.org/changeset/24650
    15                 wp_insert_post( array( 'ID' => $this->post_id, 'post_content' => 'edit2' ) ); 
     15                wp_insert_post( array( 'ID' => $this->post_id, 'post_content' => 'edit2' ) );
    1616
    1717                $revisions = wp_get_post_revisions( $this->post_id );
Note: See TracChangeset for help on using the changeset viewer.