Changeset 35242
- Timestamp:
- 10/17/2015 06:02:16 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 170 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.gitignore
r31769 r35242 5 5 wp-tests-config.php 6 6 .htaccess 7 7 .idea 8 8 # Files and folders related to build/test tools 9 9 /phpunit.xml -
trunk/tests/phpunit/includes/testcase-ajax.php
r35225 r35242 76 76 77 77 // Make some posts 78 self:: $factory->post->create_many( 5 );78 self::factory()->post->create_many( 5 ); 79 79 } 80 80 … … 149 149 protected function _setRole( $role ) { 150 150 $post = $_POST; 151 $user_id = self:: $factory->user->create( array( 'role' => $role ) );151 $user_id = self::factory()->user->create( array( 'role' => $role ) ); 152 152 wp_set_current_user( $user_id ); 153 153 $_POST = array_merge($_POST, $post); -
trunk/tests/phpunit/includes/testcase-canonical.php
r35225 r35242 50 50 51 51 // Already created by install defaults: 52 // self:: $factory->term->create( array( 'taxonomy' => 'category', 'name' => 'uncategorized' ) );52 // self::factory()->term->create( array( 'taxonomy' => 'category', 'name' => 'uncategorized' ) ); 53 53 54 54 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
r35225 r35242 23 23 24 24 protected function make_user_by_role( $role ) { 25 return self:: $factory->user->create( array(25 return self::factory()->user->create( array( 26 26 'user_login' => $role, 27 27 'user_pass' => $role, -
trunk/tests/phpunit/includes/testcase.php
r35225 r35242 15 15 protected static $ignore_files; 16 16 17 /** 18 * @var WP_UnitTest_Factory 19 */ 20 protected static $factory; 17 function __isset( $name ) { 18 return 'factory' === $name; 19 } 20 21 function __get( $name ) { 22 if ( 'factory' === $name ) { 23 return self::factory(); 24 } 25 } 26 27 protected static function factory() { 28 static $factory = null; 29 if ( ! $factory ) { 30 $factory = new WP_UnitTest_Factory(); 31 } 32 return $factory; 33 } 21 34 22 35 public static function get_called_class() { … … 38 51 parent::setUpBeforeClass(); 39 52 40 if ( ! self::$factory ) {41 self::$factory = new WP_UnitTest_Factory();42 }43 44 53 $c = self::get_called_class(); 45 54 if ( ! method_exists( $c, 'wpSetUpBeforeClass' ) ) { … … 47 56 } 48 57 49 call_user_func( array( $c, 'wpSetUpBeforeClass' ), self:: $factory);58 call_user_func( array( $c, 'wpSetUpBeforeClass' ), self::factory() ); 50 59 51 60 self::commit_transaction(); -
trunk/tests/phpunit/tests/admin/includesComment.php
r35225 r35242 7 7 class Tests_Admin_IncludesComment extends WP_UnitTestCase { 8 8 public function test_must_match_date_and_author() { 9 $p1 = self:: $factory->post->create();10 $c1 = self:: $factory->comment->create( array(9 $p1 = self::factory()->post->create(); 10 $c1 = self::factory()->comment->create( array( 11 11 'comment_author' => 1, 12 12 'comment_date' => '2014-05-06 12:00:00', … … 14 14 ) ); 15 15 16 $p2 = self:: $factory->post->create();17 $c2 = self:: $factory->comment->create( array(16 $p2 = self::factory()->post->create(); 17 $c2 = self::factory()->comment->create( array( 18 18 'comment_author' => 2, 19 19 'comment_date' => '2004-01-02 12:00:00', … … 29 29 */ 30 30 public function test_default_value_of_timezone_should_be_blog() { 31 $p = self:: $factory->post->create();32 $c = self:: $factory->comment->create( array(31 $p = self::factory()->post->create(); 32 $c = self::factory()->comment->create( array( 33 33 'comment_author' => 1, 34 34 'comment_post_ID' => $p, … … 44 44 */ 45 45 public function test_should_respect_timezone_blog() { 46 $p = self:: $factory->post->create();47 $c = self:: $factory->comment->create( array(46 $p = self::factory()->post->create(); 47 $c = self::factory()->comment->create( array( 48 48 'comment_author' => 1, 49 49 'comment_post_ID' => $p, … … 59 59 */ 60 60 public function test_should_respect_timezone_gmt() { 61 $p = self:: $factory->post->create();62 $c = self:: $factory->comment->create( array(61 $p = self::factory()->post->create(); 62 $c = self::factory()->comment->create( array( 63 63 'comment_author' => 1, 64 64 'comment_post_ID' => $p, … … 74 74 */ 75 75 public function test_invalid_timezone_should_fall_back_on_blog() { 76 $p = self:: $factory->post->create();77 $c = self:: $factory->comment->create( array(76 $p = self::factory()->post->create(); 77 $c = self::factory()->comment->create( array( 78 78 'comment_author' => 1, 79 79 'comment_post_ID' => $p, -
trunk/tests/phpunit/tests/admin/includesPlugin.php
r35225 r35242 30 30 function test_menu_page_url() { 31 31 $current_user = get_current_user_id(); 32 wp_set_current_user( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );32 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 33 33 update_option( 'siteurl', 'http://example.com' ); 34 34 -
trunk/tests/phpunit/tests/admin/includesPost.php
r35225 r35242 12 12 13 13 function test__wp_translate_postdata_cap_checks_contributor() { 14 $contributor_id = self:: $factory->user->create( array( 'role' => 'contributor' ) );15 $editor_id = self:: $factory->user->create( array( 'role' => 'editor' ) );14 $contributor_id = self::factory()->user->create( array( 'role' => 'contributor' ) ); 15 $editor_id = self::factory()->user->create( array( 'role' => 'editor' ) ); 16 16 17 17 wp_set_current_user( $contributor_id ); … … 52 52 // Edit Draft Post for another user 53 53 $_post_data = array(); 54 $_post_data['post_ID'] = self:: $factory->post->create( array( 'post_author' => $editor_id ) );54 $_post_data['post_ID'] = self::factory()->post->create( array( 'post_author' => $editor_id ) ); 55 55 $_post_data['post_author'] = $editor_id; 56 56 $_post_data['post_type'] = 'post'; … … 65 65 66 66 function test__wp_translate_postdata_cap_checks_editor() { 67 $contributor_id = self:: $factory->user->create( array( 'role' => 'contributor' ) );68 $editor_id = self:: $factory->user->create( array( 'role' => 'editor' ) );67 $contributor_id = self::factory()->user->create( array( 'role' => 'contributor' ) ); 68 $editor_id = self::factory()->user->create( array( 'role' => 'editor' ) ); 69 69 70 70 wp_set_current_user( $editor_id ); … … 105 105 // Edit Draft Post for another user 106 106 $_post_data = array(); 107 $_post_data['post_ID'] = self:: $factory->post->create( array( 'post_author' => $contributor_id ) );107 $_post_data['post_ID'] = self::factory()->post->create( array( 'post_author' => $contributor_id ) ); 108 108 $_post_data['post_author'] = $contributor_id; 109 109 $_post_data['post_type'] = 'post'; … … 123 123 */ 124 124 function test_edit_post_auto_draft() { 125 $user_id = self:: $factory->user->create( array( 'role' => 'editor' ) );125 $user_id = self::factory()->user->create( array( 'role' => 'editor' ) ); 126 126 wp_set_current_user( $user_id ); 127 $post = self:: $factory->post->create_and_get( array( 'post_status' => 'auto-draft' ) );127 $post = self::factory()->post->create_and_get( array( 'post_status' => 'auto-draft' ) ); 128 128 $this->assertEquals( 'auto-draft', $post->post_status ); 129 129 $post_data = array( … … 141 141 */ 142 142 public function test_edit_post_should_parse_tax_input_by_name_rather_than_slug_for_nonhierarchical_taxonomies() { 143 $u = self:: $factory->user->create( array( 'role' => 'editor' ) );143 $u = self::factory()->user->create( array( 'role' => 'editor' ) ); 144 144 wp_set_current_user( $u ); 145 145 146 146 register_taxonomy( 'wptests_tax', array( 'post' ) ); 147 $t1 = self:: $factory->term->create( array(147 $t1 = self::factory()->term->create( array( 148 148 'taxonomy' => 'wptests_tax', 149 149 'name' => 'foo', 150 150 'slug' => 'bar', 151 151 ) ); 152 $t2 = self:: $factory->term->create( array(152 $t2 = self::factory()->term->create( array( 153 153 'taxonomy' => 'wptests_tax', 154 154 'name' => 'bar', … … 156 156 ) ); 157 157 158 $p = self:: $factory->post->create();158 $p = self::factory()->post->create(); 159 159 160 160 $post_data = array( … … 180 180 */ 181 181 public function test_edit_post_should_not_create_terms_for_an_empty_tag_input_field() { 182 $u = self:: $factory->user->create( array( 'role' => 'editor' ) );182 $u = self::factory()->user->create( array( 'role' => 'editor' ) ); 183 183 wp_set_current_user( $u ); 184 184 185 185 register_taxonomy( 'wptests_tax', array( 'post' ) ); 186 $t1 = self:: $factory->term->create( array(186 $t1 = self::factory()->term->create( array( 187 187 'taxonomy' => 'wptests_tax', 188 188 'name' => 'foo', … … 190 190 ) ); 191 191 192 $p = self:: $factory->post->create();192 $p = self::factory()->post->create(); 193 193 194 194 $post_data = array( … … 210 210 */ 211 211 function test_bulk_edit_posts_stomping() { 212 $admin = self:: $factory->user->create( array( 'role' => 'administrator' ) );213 $users = self:: $factory->user->create_many( 2, array( 'role' => 'author' ) );212 $admin = self::factory()->user->create( array( 'role' => 'administrator' ) ); 213 $users = self::factory()->user->create_many( 2, array( 'role' => 'author' ) ); 214 214 wp_set_current_user( $admin ); 215 215 216 $post1 = self:: $factory->post->create( array(216 $post1 = self::factory()->post->create( array( 217 217 'post_author' => $users[0], 218 218 'comment_status' => 'open', … … 221 221 ) ); 222 222 223 $post2 = self:: $factory->post->create( array(223 $post2 = self::factory()->post->create( array( 224 224 'post_author' => $users[1], 225 225 'comment_status' => 'closed', … … 256 256 257 257 $future_date = date( 'Y-m-d H:i:s', time() + 100 ); 258 $p = self:: $factory->post->create( array( 'post_status' => 'future', 'post_name' => 'foo', 'post_date' => $future_date ) );258 $p = self::factory()->post->create( array( 'post_status' => 'future', 'post_name' => 'foo', 'post_date' => $future_date ) ); 259 259 260 260 $found = get_sample_permalink( $p ); … … 269 269 */ 270 270 public function test_get_sample_permalink_html_should_use_default_permalink_for_view_post_link_when_pretty_permalinks_are_disabled() { 271 wp_set_current_user( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );271 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 272 272 273 273 $future_date = date( 'Y-m-d H:i:s', time() + 100 ); 274 $p = self:: $factory->post->create( array( 'post_status' => 'future', 'post_name' => 'foo', 'post_date' => $future_date ) );274 $p = self::factory()->post->create( array( 'post_status' => 'future', 'post_name' => 'foo', 'post_date' => $future_date ) ); 275 275 276 276 $found = get_sample_permalink_html( $p ); … … 285 285 $this->set_permalink_structure( '/%postname%/' ); 286 286 287 wp_set_current_user( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );287 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 288 288 289 289 $future_date = date( 'Y-m-d H:i:s', time() + 100 ); 290 $p = self:: $factory->post->create( array( 'post_status' => 'future', 'post_name' => 'foo', 'post_date' => $future_date ) );290 $p = self::factory()->post->create( array( 'post_status' => 'future', 'post_name' => 'foo', 'post_date' => $future_date ) ); 291 291 292 292 $found = get_sample_permalink_html( $p ); … … 302 302 $this->set_permalink_structure( '/%postname%/' ); 303 303 304 wp_set_current_user( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );304 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 305 305 306 306 // Published posts should use published permalink 307 $p = self:: $factory->post->create( array( 'post_status' => 'publish', 'post_name' => 'foo' ) );307 $p = self::factory()->post->create( array( 'post_status' => 'publish', 'post_name' => 'foo' ) ); 308 308 309 309 $found = get_sample_permalink_html( $p, null, 'new_slug' ); … … 314 314 // Scheduled posts should use published permalink 315 315 $future_date = date( 'Y-m-d H:i:s', time() + 100 ); 316 $p = self:: $factory->post->create( array( 'post_status' => 'future', 'post_name' => 'bar', 'post_date' => $future_date ) );316 $p = self::factory()->post->create( array( 'post_status' => 'future', 'post_name' => 'bar', 'post_date' => $future_date ) ); 317 317 318 318 $found = get_sample_permalink_html( $p, null, 'new_slug' ); … … 322 322 323 323 // Draft posts should use preview link 324 $p = self:: $factory->post->create( array( 'post_status' => 'draft', 'post_name' => 'baz' ) );324 $p = self::factory()->post->create( array( 'post_status' => 'draft', 'post_name' => 'baz' ) ); 325 325 326 326 $found = get_sample_permalink_html( $p, null, 'new_slug' ); … … 340 340 $this->set_permalink_structure( '/%postname%/' ); 341 341 342 $p = self:: $factory->post->create( array(342 $p = self::factory()->post->create( array( 343 343 'post_name' => '2015', 344 344 ) ); … … 354 354 $this->set_permalink_structure( '/%year%/%postname%/' ); 355 355 356 $p = self:: $factory->post->create( array(356 $p = self::factory()->post->create( array( 357 357 'post_name' => '2015', 358 358 ) ); … … 368 368 $this->set_permalink_structure( '/%year%/%postname%/' ); 369 369 370 $p = self:: $factory->post->create( array(370 $p = self::factory()->post->create( array( 371 371 'post_name' => '11', 372 372 ) ); … … 382 382 $this->set_permalink_structure( '/%year%/%postname%/' ); 383 383 384 $p = self:: $factory->post->create( array(384 $p = self::factory()->post->create( array( 385 385 'post_name' => '13', 386 386 ) ); … … 396 396 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 397 397 398 $p = self:: $factory->post->create( array(398 $p = self::factory()->post->create( array( 399 399 'post_name' => '30', 400 400 ) ); … … 410 410 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 411 411 412 self:: $factory->post->create( array(412 self::factory()->post->create( array( 413 413 'post_name' => '30-2', 414 414 ) ); 415 415 416 $p = self:: $factory->post->create( array(416 $p = self::factory()->post->create( array( 417 417 'post_name' => '30', 418 418 ) ); … … 428 428 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 429 429 430 $p = self:: $factory->post->create( array(430 $p = self::factory()->post->create( array( 431 431 'post_name' => '32', 432 432 ) ); … … 442 442 $this->set_permalink_structure( '/%year%/%month%/%day%/%postname%/' ); 443 443 444 $p = self:: $factory->post->create( array(444 $p = self::factory()->post->create( array( 445 445 'post_name' => '30', 446 446 ) ); … … 451 451 452 452 public function test_post_exists_should_match_title() { 453 $p = self:: $factory->post->create( array(453 $p = self::factory()->post->create( array( 454 454 'post_title' => 'Foo Bar', 455 455 ) ); … … 459 459 460 460 public function test_post_exists_should_not_match_nonexistent_title() { 461 $p = self:: $factory->post->create( array(461 $p = self::factory()->post->create( array( 462 462 'post_title' => 'Foo Bar', 463 463 ) ); … … 469 469 $title = 'Foo Bar'; 470 470 $content = 'Foo Bar Baz'; 471 $p = self:: $factory->post->create( array(471 $p = self::factory()->post->create( array( 472 472 'post_title' => $title, 473 473 'post_content' => $content, … … 480 480 $title = 'Foo Bar'; 481 481 $content = 'Foo Bar Baz'; 482 $p = self:: $factory->post->create( array(482 $p = self::factory()->post->create( array( 483 483 'post_title' => $title, 484 484 'post_content' => $content . ' Quz', … … 491 491 $title = 'Foo Bar'; 492 492 $date = '2014-05-08 12:00:00'; 493 $p = self:: $factory->post->create( array(493 $p = self::factory()->post->create( array( 494 494 'post_title' => $title, 495 495 'post_date' => $date, … … 502 502 $title = 'Foo Bar'; 503 503 $date = '2014-05-08 12:00:00'; 504 $p = self:: $factory->post->create( array(504 $p = self::factory()->post->create( array( 505 505 'post_title' => $title, 506 506 'post_date' => '2015-10-10 00:00:00', … … 514 514 $content = 'Foo Bar Baz'; 515 515 $date = '2014-05-08 12:00:00'; 516 $p = self:: $factory->post->create( array(516 $p = self::factory()->post->create( array( 517 517 'post_title' => $title, 518 518 'post_content' => $content, -
trunk/tests/phpunit/tests/adminbar.php
r35225 r35242 16 16 */ 17 17 function test_content_post_type() { 18 wp_set_current_user( self:: $factory->user->create( array( 'role' => 'editor' ) ) );18 wp_set_current_user( self::factory()->user->create( array( 'role' => 'editor' ) ) ); 19 19 20 20 register_post_type( 'content', array( 'show_in_admin_bar' => true ) ); … … 35 35 */ 36 36 function test_merging_existing_meta_values() { 37 wp_set_current_user( self:: $factory->user->create( array( 'role' => 'editor' ) ) );37 wp_set_current_user( self::factory()->user->create( array( 'role' => 'editor' ) ) ); 38 38 39 39 $admin_bar = new WP_Admin_Bar; … … 63 63 } 64 64 65 $nobody = self:: $factory->user->create( array( 'role' => '' ) );65 $nobody = self::factory()->user->create( array( 'role' => '' ) ); 66 66 $this->assertFalse( user_can( $nobody, 'read' ) ); 67 67 … … 93 93 } 94 94 95 $editor = self:: $factory->user->create( array( 'role' => 'editor' ) );95 $editor = self::factory()->user->create( array( 'role' => 'editor' ) ); 96 96 $this->assertTrue( user_can( $editor, 'read' ) ); 97 97 … … 126 126 } 127 127 128 $admin = self:: $factory->user->create( array( 'role' => 'administrator' ) );129 $editor = self:: $factory->user->create( array( 'role' => 'editor' ) );128 $admin = self::factory()->user->create( array( 'role' => 'administrator' ) ); 129 $editor = self::factory()->user->create( array( 'role' => 'editor' ) ); 130 130 131 131 $this->assertTrue( user_can( $admin, 'read' ) ); 132 132 $this->assertTrue( user_can( $editor, 'read' ) ); 133 133 134 $new_blog_id = self:: $factory->blog->create( array(134 $new_blog_id = self::factory()->blog->create( array( 135 135 'user_id' => $admin, 136 136 ) ); … … 180 180 } 181 181 182 $admin = self:: $factory->user->create( array( 'role' => 'administrator' ) );183 $nobody = self:: $factory->user->create( array( 'role' => '' ) );182 $admin = self::factory()->user->create( array( 'role' => 'administrator' ) ); 183 $nobody = self::factory()->user->create( array( 'role' => '' ) ); 184 184 185 185 $this->assertTrue( user_can( $admin, 'read' ) ); 186 186 $this->assertFalse( user_can( $nobody, 'read' ) ); 187 187 188 $new_blog_id = self:: $factory->blog->create( array(188 $new_blog_id = self::factory()->blog->create( array( 189 189 'user_id' => $admin, 190 190 ) ); -
trunk/tests/phpunit/tests/ajax/Autosave.php
r35225 r35242 34 34 parent::setUp(); 35 35 // Set a user so the $post has 'post_author' 36 $this->user_id = self:: $factory->user->create( array( 'role' => 'administrator' ) );36 $this->user_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); 37 37 wp_set_current_user( $this->user_id ); 38 38 39 $post_id = self:: $factory->post->create( array( 'post_status' => 'draft' ) );39 $post_id = self::factory()->post->create( array( 'post_status' => 'draft' ) ); 40 40 $this->_post = get_post( $post_id ); 41 41 } … … 98 98 public function test_autosave_locked_post() { 99 99 // Lock the post to another user 100 $another_user_id = self:: $factory->user->create( array( 'role' => 'editor' ) );100 $another_user_id = self::factory()->user->create( array( 'role' => 'editor' ) ); 101 101 wp_set_current_user( $another_user_id ); 102 102 wp_set_post_lock( $this->_post->ID ); -
trunk/tests/phpunit/tests/ajax/CustomizeMenus.php
r35225 r35242 23 23 parent::setUp(); 24 24 require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; 25 wp_set_current_user( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );25 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 26 26 global $wp_customize; 27 27 $this->wp_customize = new WP_Customize_Manager(); … … 66 66 } 67 67 68 wp_set_current_user( self:: $factory->user->create( array( 'role' => $role ) ) );68 wp_set_current_user( self::factory()->user->create( array( 'role' => $role ) ) ); 69 69 70 70 $_POST = array( … … 308 308 309 309 // Create some terms and pages. 310 self:: $factory->term->create_many( 5 );311 self:: $factory->post->create_many( 5, array( 'post_type' => 'page' ) );310 self::factory()->term->create_many( 5 ); 311 self::factory()->post->create_many( 5, array( 'post_type' => 'page' ) ); 312 312 313 313 $_POST = array_merge( array( … … 397 397 } 398 398 399 wp_set_current_user( self:: $factory->user->create( array( 'role' => $role ) ) );399 wp_set_current_user( self::factory()->user->create( array( 'role' => $role ) ) ); 400 400 401 401 $_POST = array( … … 470 470 function test_ajax_search_available_items_results( $post_args, $expected_results ) { 471 471 472 self:: $factory->post->create_many( 5, array( 'post_title' => 'Test Post' ) );472 self::factory()->post->create_many( 5, array( 'post_title' => 'Test Post' ) ); 473 473 474 474 $_POST = array_merge( array( -
trunk/tests/phpunit/tests/ajax/DeleteComment.php
r35225 r35242 27 27 public function setUp() { 28 28 parent::setUp(); 29 $post_id = self:: $factory->post->create();30 $this->_comments = self:: $factory->comment->create_post_comments( $post_id, 15 );29 $post_id = self::factory()->post->create(); 30 $this->_comments = self::factory()->comment->create_post_comments( $post_id, 15 ); 31 31 $this->_comments = array_map( 'get_comment', $this->_comments ); 32 32 } -
trunk/tests/phpunit/tests/ajax/DimComment.php
r35225 r35242 27 27 public function setUp() { 28 28 parent::setUp(); 29 $post_id = self:: $factory->post->create();30 $this->_comments = self:: $factory->comment->create_post_comments( $post_id, 15 );29 $post_id = self::factory()->post->create(); 30 $this->_comments = self::factory()->comment->create_post_comments( $post_id, 15 ); 31 31 $this->_comments = array_map( 'get_comment', $this->_comments ); 32 32 } -
trunk/tests/phpunit/tests/ajax/EditComment.php
r35225 r35242 27 27 public function setUp() { 28 28 parent::setUp(); 29 $post_id = self:: $factory->post->create();30 self:: $factory->comment->create_post_comments( $post_id, 5 );29 $post_id = self::factory()->post->create(); 30 self::factory()->comment->create_post_comments( $post_id, 5 ); 31 31 $this->_comment_post = get_post( $post_id ); 32 32 } -
trunk/tests/phpunit/tests/ajax/GetComments.php
r35225 r35242 33 33 public function setUp() { 34 34 parent::setUp(); 35 $post_id = self:: $factory->post->create();36 self:: $factory->comment->create_post_comments( $post_id, 5 );35 $post_id = self::factory()->post->create(); 36 self::factory()->comment->create_post_comments( $post_id, 5 ); 37 37 $this->_comment_post = get_post( $post_id ); 38 38 39 $post_id = self:: $factory->post->create();39 $post_id = self::factory()->post->create(); 40 40 $this->_no_comment_post = get_post( $post_id ); 41 41 -
trunk/tests/phpunit/tests/ajax/QuickEdit.php
r35225 r35242 26 26 ) ); 27 27 28 $t1 = self:: $factory->term->create( array(28 $t1 = self::factory()->term->create( array( 29 29 'taxonomy' => 'wptests_tax_1', 30 30 ) ); 31 $t2 = self:: $factory->term->create( array(31 $t2 = self::factory()->term->create( array( 32 32 'taxonomy' => 'wptests_tax_2', 33 33 ) ); … … 36 36 $this->_setRole( 'administrator' ); 37 37 38 $post = self:: $factory->post->create_and_get( array(38 $post = self::factory()->post->create_and_get( array( 39 39 'post_author' => get_current_user_id(), 40 40 ) ); -
trunk/tests/phpunit/tests/ajax/ReplytoComment.php
r35225 r35242 33 33 public function setUp() { 34 34 parent::setUp(); 35 $post_id = self:: $factory->post->create();36 self:: $factory->comment->create_post_comments( $post_id, 5 );35 $post_id = self::factory()->post->create(); 36 self::factory()->comment->create_post_comments( $post_id, 5 ); 37 37 $this->_comment_post = get_post( $post_id ); 38 38 39 $post_id = self:: $factory->post->create( array( 'post_status' => 'draft' ) );39 $post_id = self::factory()->post->create( array( 'post_status' => 'draft' ) ); 40 40 $this->_draft_post = get_post( $post_id ); 41 41 } -
trunk/tests/phpunit/tests/attachment/slashes.php
r35225 r35242 9 9 function setUp() { 10 10 parent::setUp(); 11 $this->author_id = self:: $factory->user->create( array( 'role' => 'editor' ) );11 $this->author_id = self::factory()->user->create( array( 'role' => 'editor' ) ); 12 12 $this->old_current_user = get_current_user_id(); 13 13 wp_set_current_user( $this->author_id ); -
trunk/tests/phpunit/tests/avatar.php
r35225 r35242 88 88 $this->assertEquals( $url, $url2 ); 89 89 90 $post_id = self:: $factory->post->create( array( 'post_author' => 1 ) );90 $post_id = self::factory()->post->create( array( 'post_author' => 1 ) ); 91 91 $post = get_post( $post_id ); 92 92 $url2 = get_avatar_url( $post ); 93 93 $this->assertEquals( $url, $url2 ); 94 94 95 $comment_id = self:: $factory->comment->create( array( 'comment_post_ID' => $post_id, 'user_id' => 1 ) );95 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => $post_id, 'user_id' => 1 ) ); 96 96 $comment = get_comment( $comment_id ); 97 97 $url2 = get_avatar_url( $comment ); … … 139 139 $url = get_avatar_url( 1 ); 140 140 141 $post_id = self:: $factory->post->create( array( 'post_author' => 1 ) );142 $comment_id = self:: $factory->comment->create( array( 'comment_post_ID' => $post_id, 'user_id' => 1, 'comment_type' => 'pingback' ) );141 $post_id = self::factory()->post->create( array( 'post_author' => 1 ) ); 142 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => $post_id, 'user_id' => 1, 'comment_type' => 'pingback' ) ); 143 143 $comment = get_comment( $comment_id ); 144 144 -
trunk/tests/phpunit/tests/canonical/pageOnFront.php
r35225 r35242 19 19 20 20 update_option( 'show_on_front', 'page' ); 21 update_option( 'page_for_posts', self:: $factory->post->create( array( 'post_title' => 'blog-page', 'post_type' => 'page' ) ) );22 update_option( 'page_on_front', self:: $factory->post->create( array( 'post_title' => 'front-page', 'post_type' => 'page' ) ) );21 update_option( 'page_for_posts', self::factory()->post->create( array( 'post_title' => 'blog-page', 'post_type' => 'page' ) ) ); 22 update_option( 'page_on_front', self::factory()->post->create( array( 'post_title' => 'front-page', 'post_type' => 'page' ) ) ); 23 23 } 24 24 -
trunk/tests/phpunit/tests/canonical/paged.php
r35225 r35242 13 13 $next = '<!--nextpage-->'; 14 14 15 $post_id = self:: $factory->post->create( array(15 $post_id = self::factory()->post->create( array( 16 16 'post_status' => 'publish', 17 17 'post_content' => "{$para}{$next}{$para}{$next}{$para}" -
trunk/tests/phpunit/tests/category.php
r35225 r35242 22 22 function test_get_all_category_ids() { 23 23 // create categories 24 self:: $factory->category->create_many( 2 );24 self::factory()->category->create_many( 2 ); 25 25 26 26 // create new taxonomy to ensure not included … … 39 39 40 40 // create Test Categories 41 $testcat = self:: $factory->category->create_and_get(41 $testcat = self::factory()->category->create_and_get( 42 42 array( 43 43 'slug' => 'testcat', … … 45 45 ) 46 46 ); 47 $testcat2 = self:: $factory->category->create_and_get(47 $testcat2 = self::factory()->category->create_and_get( 48 48 array( 49 49 'slug' => 'testcat2', … … 74 74 'description' => 'Category Test' 75 75 ); 76 $testcat = self:: $factory->category->create_and_get( $testcat_array );76 $testcat = self::factory()->category->create_and_get( $testcat_array ); 77 77 $testcat_array['term_id'] = $testcat->term_id; 78 78 … … 83 83 'parent' => $testcat->term_id 84 84 ); 85 $testcat2 = self:: $factory->category->create_and_get( $testcat2_array );85 $testcat2 = self::factory()->category->create_and_get( $testcat2_array ); 86 86 $testcat2_array['term_id'] = $testcat2->term_id; 87 87 … … 146 146 147 147 // create Test Category 148 $testcat = self:: $factory->category->create_and_get(148 $testcat = self::factory()->category->create_and_get( 149 149 array( 150 150 'slug' => 'testcat', … … 166 166 167 167 // create Test Category 168 $testcat = self:: $factory->category->create_and_get(168 $testcat = self::factory()->category->create_and_get( 169 169 array( 170 170 'slug' => 'testcat', … … 186 186 187 187 // create Test Categories 188 $root_id = self:: $factory->category->create(188 $root_id = self::factory()->category->create( 189 189 array( 190 190 'slug' => 'root', 191 191 ) 192 192 ); 193 $root_cat_id = self:: $factory->category->create(193 $root_cat_id = self::factory()->category->create( 194 194 array( 195 195 'slug' => 'cat', … … 197 197 ) 198 198 ); 199 $root_cat_cat_id = self:: $factory->category->create(199 $root_cat_cat_id = self::factory()->category->create( 200 200 array( 201 201 'slug' => 'cat', //note this is modified on create … … 203 203 ) 204 204 ); 205 $root_path_id = self:: $factory->category->create(205 $root_path_id = self::factory()->category->create( 206 206 array( 207 207 'slug' => 'path', … … 209 209 ) 210 210 ); 211 $root_path_cat_id = self:: $factory->category->create(211 $root_path_cat_id = self::factory()->category->create( 212 212 array( 213 213 'slug' => 'cat', //note this is modified on create … … 215 215 ) 216 216 ); 217 $root_level_id = self:: $factory->category->create(217 $root_level_id = self::factory()->category->create( 218 218 array( 219 219 'slug' => 'level-1', … … 221 221 ) 222 222 ); 223 $root_level_cat_id = self:: $factory->category->create(223 $root_level_cat_id = self::factory()->category->create( 224 224 array( 225 225 'slug' => 'cat', //note this is modified on create … … 249 249 public function test_wp_dropdown_categories_value_field_should_default_to_term_id() { 250 250 // Create a test category. 251 $cat_id = self:: $factory->category->create( array(251 $cat_id = self::factory()->category->create( array( 252 252 'name' => 'Test Category', 253 253 'slug' => 'test_category', … … 269 269 public function test_wp_dropdown_categories_value_field_term_id() { 270 270 // Create a test category. 271 $cat_id = self:: $factory->category->create( array(271 $cat_id = self::factory()->category->create( array( 272 272 'name' => 'Test Category', 273 273 'slug' => 'test_category', … … 290 290 public function test_wp_dropdown_categories_value_field_slug() { 291 291 // Create a test category. 292 $cat_id = self:: $factory->category->create( array(292 $cat_id = self::factory()->category->create( array( 293 293 'name' => 'Test Category', 294 294 'slug' => 'test_category', … … 311 311 public function test_wp_dropdown_categories_value_field_should_fall_back_on_term_id_when_an_invalid_value_is_provided() { 312 312 // Create a test category. 313 $cat_id = self:: $factory->category->create( array(313 $cat_id = self::factory()->category->create( array( 314 314 'name' => 'Test Category', 315 315 'slug' => 'test_category', … … 331 331 */ 332 332 public function test_wp_dropdown_categories_selected_should_respect_custom_value_field() { 333 $c1 = self:: $factory->category->create( array(333 $c1 = self::factory()->category->create( array( 334 334 'name' => 'Test Category 1', 335 335 'slug' => 'test_category_1', 336 336 ) ); 337 337 338 $c2 = self:: $factory->category->create( array(338 $c2 = self::factory()->category->create( array( 339 339 'name' => 'Test Category 2', 340 340 'slug' => 'test_category_2', … … 355 355 */ 356 356 public function test_wp_dropdown_categories_show_option_all_should_be_selected_if_no_selected_value_is_explicitly_passed_and_value_field_does_not_have_string_values() { 357 $cats = self:: $factory->category->create_many( 3 );357 $cats = self::factory()->category->create_many( 3 ); 358 358 359 359 $found = wp_dropdown_categories( array( … … 376 376 */ 377 377 public function test_wp_dropdown_categories_show_option_all_should_be_selected_if_selected_value_of_0_string_is_explicitly_passed_and_value_field_does_not_have_string_values() { 378 $cats = self:: $factory->category->create_many( 3 );378 $cats = self::factory()->category->create_many( 3 ); 379 379 380 380 $found = wp_dropdown_categories( array( -
trunk/tests/phpunit/tests/category/getCategoryParents.php
r35225 r35242 11 11 parent::setUp(); 12 12 13 $this->c1 = self:: $factory->category->create_and_get();14 $this->c2 = self:: $factory->category->create_and_get( array(13 $this->c1 = self::factory()->category->create_and_get(); 14 $this->c2 = self::factory()->category->create_and_get( array( 15 15 'parent' => $this->c1->term_id, 16 16 ) ); … … 52 52 53 53 public function test_visited() { 54 $c3 = self:: $factory->category->create_and_get( array(54 $c3 = self::factory()->category->create_and_get( array( 55 55 'parent' => $this->c2->term_id, 56 56 ) ); 57 $c4 = self:: $factory->category->create_and_get( array(57 $c4 = self::factory()->category->create_and_get( array( 58 58 'parent' => $c3->term_id, 59 59 ) ); -
trunk/tests/phpunit/tests/category/wpListCategories.php
r35225 r35242 6 6 class Tests_Category_WpListCategories extends WP_UnitTestCase { 7 7 public function test_class() { 8 $c = self:: $factory->category->create();8 $c = self::factory()->category->create(); 9 9 10 10 $found = wp_list_categories( array( … … 17 17 18 18 public function test_class_containing_current_cat() { 19 $c1 = self:: $factory->category->create();20 $c2 = self:: $factory->category->create();19 $c1 = self::factory()->category->create(); 20 $c2 = self::factory()->category->create(); 21 21 22 22 $found = wp_list_categories( array( … … 31 31 32 32 public function test_class_containing_current_cat_parent() { 33 $c1 = self:: $factory->category->create();34 $c2 = self:: $factory->category->create( array(33 $c1 = self::factory()->category->create(); 34 $c2 = self::factory()->category->create( array( 35 35 'parent' => $c1, 36 36 ) ); … … 50 50 */ 51 51 public function test_current_category_should_accept_an_array_of_ids() { 52 $cats = self:: $factory->category->create_many( 3 );52 $cats = self::factory()->category->create_many( 3 ); 53 53 54 54 $found = wp_list_categories( array( … … 67 67 */ 68 68 public function test_should_not_create_element_when_cat_name_is_filtered_to_empty_string() { 69 $c1 = self:: $factory->category->create( array(69 $c1 = self::factory()->category->create( array( 70 70 'name' => 'Test Cat 1', 71 71 ) ); 72 $c2 = self:: $factory->category->create( array(72 $c2 = self::factory()->category->create( array( 73 73 'name' => 'Test Cat 2', 74 74 ) ); … … 89 89 90 90 public function test_show_option_all_link_should_go_to_home_page_when_show_on_front_is_false() { 91 $cats = self:: $factory->category->create_many( 2 );91 $cats = self::factory()->category->create_many( 2 ); 92 92 93 93 $found = wp_list_categories( array( … … 102 102 103 103 public function test_show_option_all_link_should_respect_page_for_posts() { 104 $cats = self:: $factory->category->create_many( 2 );105 $p = self:: $factory->post->create( array( 'post_type' => 'page' ) );104 $cats = self::factory()->category->create_many( 2 ); 105 $p = self::factory()->post->create( array( 'post_type' => 'page' ) ); 106 106 107 107 update_option( 'show_on_front', 'page' ); … … 126 126 register_taxonomy( 'wptests_tax', array( 'foo', 'wptests_pt', 'wptests_pt2' ) ); 127 127 128 $terms = self:: $factory->term->create_many( 2, array(128 $terms = self::factory()->term->create_many( 2, array( 129 129 'taxonomy' => 'wptests_tax', 130 130 ) ); … … 150 150 register_taxonomy( 'wptests_tax', array( 'foo', 'wptests_pt', 'wptests_pt2' ) ); 151 151 152 $terms = self:: $factory->term->create_many( 2, array(152 $terms = self::factory()->term->create_many( 2, array( 153 153 'taxonomy' => 'wptests_tax', 154 154 ) ); … … 171 171 register_taxonomy( 'wptests_tax', array( 'foo', 'wptests_pt', 'post', 'wptests_pt2' ) ); 172 172 173 $terms = self:: $factory->term->create_many( 2, array(173 $terms = self::factory()->term->create_many( 2, array( 174 174 'taxonomy' => 'wptests_tax', 175 175 ) ); … … 192 192 register_taxonomy( 'wptests_tax', array( 'foo', 'wptests_pt', 'wptests_pt2' ) ); 193 193 194 $terms = self:: $factory->term->create_many( 2, array(194 $terms = self::factory()->term->create_many( 2, array( 195 195 'taxonomy' => 'wptests_tax', 196 196 ) ); … … 255 255 */ 256 256 public function test_hide_title_if_empty_should_be_ignored_when_category_list_is_not_empty() { 257 $cat = self:: $factory->category->create();257 $cat = self::factory()->category->create(); 258 258 259 259 $found = wp_list_categories( array( … … 270 270 */ 271 271 public function test_exclude_tree_should_be_respected() { 272 $c = self:: $factory->category->create();273 $parent = self:: $factory->category->create( array( 'name' => 'Parent', 'slug' => 'parent' ) );274 $child = self:: $factory->category->create( array( 'name' => 'Child', 'slug' => 'child', 'parent' => $parent ) );272 $c = self::factory()->category->create(); 273 $parent = self::factory()->category->create( array( 'name' => 'Parent', 'slug' => 'parent' ) ); 274 $child = self::factory()->category->create( array( 'name' => 'Child', 'slug' => 'child', 'parent' => $parent ) ); 275 275 276 276 $args = array( 'echo' => 0, 'hide_empty' => 0, 'exclude_tree' => $parent ); … … 287 287 */ 288 288 public function test_exclude_tree_should_be_merged_with_exclude() { 289 $c = self:: $factory->category->create();290 $parent = self:: $factory->category->create( array( 'name' => 'Parent', 'slug' => 'parent' ) );291 $child = self:: $factory->category->create( array( 'name' => 'Child', 'slug' => 'child', 'parent' => $parent ) );292 $parent2 = self:: $factory->category->create( array( 'name' => 'Parent', 'slug' => 'parent2' ) );293 $child2 = self:: $factory->category->create( array( 'name' => 'Child', 'slug' => 'child2', 'parent' => $parent2 ) );289 $c = self::factory()->category->create(); 290 $parent = self::factory()->category->create( array( 'name' => 'Parent', 'slug' => 'parent' ) ); 291 $child = self::factory()->category->create( array( 'name' => 'Child', 'slug' => 'child', 'parent' => $parent ) ); 292 $parent2 = self::factory()->category->create( array( 'name' => 'Parent', 'slug' => 'parent2' ) ); 293 $child2 = self::factory()->category->create( array( 'name' => 'Child', 'slug' => 'child2', 'parent' => $parent2 ) ); 294 294 295 295 $args = array( 'echo' => 0, 'hide_empty' => 0, 'exclude_tree' => $parent ); -
trunk/tests/phpunit/tests/comment-submission.php
r35225 r35242 39 39 $this->assertSame( 0, did_action( $error ) ); 40 40 41 $post = self:: $factory->post->create_and_get( array(41 $post = self::factory()->post->create_and_get( array( 42 42 'comment_status' => 'closed', 43 43 ) ); … … 59 59 $this->assertSame( 0, did_action( $error ) ); 60 60 61 $post = self:: $factory->post->create_and_get();61 $post = self::factory()->post->create_and_get(); 62 62 wp_trash_post( $post ); 63 63 $data = array( … … 78 78 $this->assertSame( 0, did_action( $error ) ); 79 79 80 $post = self:: $factory->post->create_and_get( array(80 $post = self::factory()->post->create_and_get( array( 81 81 'post_status' => 'draft', 82 82 ) ); … … 99 99 $this->assertSame( 0, did_action( $error ) ); 100 100 101 $post = self:: $factory->post->create_and_get( array(101 $post = self::factory()->post->create_and_get( array( 102 102 'post_date' => date( 'Y-m-d H:i:s', strtotime( '+1 day' ) ), 103 103 ) ); … … 122 122 $this->assertSame( 0, did_action( $error ) ); 123 123 124 $post = self:: $factory->post->create_and_get( array(124 $post = self::factory()->post->create_and_get( array( 125 125 'post_password' => 'password', 126 126 ) ); … … 143 143 $_COOKIE['wp-postpass_' . COOKIEHASH] = $hasher->HashPassword( $password ); 144 144 145 $post = self:: $factory->post->create_and_get( array(145 $post = self::factory()->post->create_and_get( array( 146 146 'post_password' => $password, 147 147 ) ); … … 163 163 public function test_submitting_valid_comment_as_logged_in_user_succeeds() { 164 164 165 $user = self:: $factory->user->create_and_get( array(165 $user = self::factory()->user->create_and_get( array( 166 166 'user_url' => 'http://user.example.org' 167 167 ) ); … … 169 169 wp_set_current_user( $user->ID ); 170 170 171 $post = self:: $factory->post->create_and_get();171 $post = self::factory()->post->create_and_get(); 172 172 $data = array( 173 173 'comment_post_ID' => $post->ID, … … 188 188 public function test_submitting_valid_comment_anonymously_succeeds() { 189 189 190 $post = self:: $factory->post->create_and_get();190 $post = self::factory()->post->create_and_get(); 191 191 $data = array( 192 192 'comment_post_ID' => $post->ID, … … 215 215 public function test_submitting_comment_handles_slashes_correctly_handles_slashes() { 216 216 217 $post = self:: $factory->post->create_and_get();217 $post = self::factory()->post->create_and_get(); 218 218 $data = array( 219 219 'comment_post_ID' => $post->ID, … … 237 237 $error = 'not_logged_in'; 238 238 239 $post = self:: $factory->post->create_and_get( array(239 $post = self::factory()->post->create_and_get( array( 240 240 'post_status' => 'private', 241 241 ) ); … … 253 253 public function test_submitting_comment_to_own_private_post_succeeds() { 254 254 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(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( 260 260 'post_status' => 'private', 261 261 'post_author' => $user->ID, … … 275 275 public function test_submitting_comment_to_accessible_private_post_succeeds() { 276 276 277 $author = self:: $factory->user->create_and_get( array(277 $author = self::factory()->user->create_and_get( array( 278 278 'role' => 'author', 279 279 ) ); 280 $user = self:: $factory->user->create_and_get( array(280 $user = self::factory()->user->create_and_get( array( 281 281 'role' => 'editor', 282 282 ) ); … … 284 284 wp_set_current_user( $user->ID ); 285 285 286 $post = self:: $factory->post->create_and_get( array(286 $post = self::factory()->post->create_and_get( array( 287 287 'post_status' => 'private', 288 288 'post_author' => $author->ID, … … 302 302 public function test_anonymous_user_cannot_comment_unfiltered_html() { 303 303 304 $post = self:: $factory->post->create_and_get();304 $post = self::factory()->post->create_and_get(); 305 305 $data = array( 306 306 'comment_post_ID' => $post->ID, … … 319 319 public function test_unprivileged_user_cannot_comment_unfiltered_html() { 320 320 321 $user = self:: $factory->user->create_and_get( array(321 $user = self::factory()->user->create_and_get( array( 322 322 'role' => 'author', 323 323 ) ); … … 326 326 $this->assertFalse( current_user_can( 'unfiltered_html' ) ); 327 327 328 $post = self:: $factory->post->create_and_get();328 $post = self::factory()->post->create_and_get(); 329 329 $data = array( 330 330 'comment_post_ID' => $post->ID, … … 341 341 public function test_unprivileged_user_cannot_comment_unfiltered_html_even_with_valid_nonce() { 342 342 343 $user = self:: $factory->user->create_and_get( array(343 $user = self::factory()->user->create_and_get( array( 344 344 'role' => 'author', 345 345 ) ); … … 348 348 $this->assertFalse( current_user_can( 'unfiltered_html' ) ); 349 349 350 $post = self:: $factory->post->create_and_get();350 $post = self::factory()->post->create_and_get(); 351 351 $action = 'unfiltered-html-comment_' . $post->ID; 352 352 $nonce = wp_create_nonce( $action ); … … 371 371 $this->assertFalse( defined( 'DISALLOW_UNFILTERED_HTML' ) ); 372 372 373 $user = self:: $factory->user->create_and_get( array(373 $user = self::factory()->user->create_and_get( array( 374 374 'role' => 'editor', 375 375 ) ); … … 385 385 $this->assertTrue( current_user_can( 'unfiltered_html' ) ); 386 386 387 $post = self:: $factory->post->create_and_get();387 $post = self::factory()->post->create_and_get(); 388 388 $action = 'unfiltered-html-comment_' . $post->ID; 389 389 $nonce = wp_create_nonce( $action ); … … 406 406 public function test_privileged_user_cannot_comment_unfiltered_html_without_valid_nonce() { 407 407 408 $user = self:: $factory->user->create_and_get( array(408 $user = self::factory()->user->create_and_get( array( 409 409 'role' => 'editor', 410 410 ) ); … … 420 420 $this->assertTrue( current_user_can( 'unfiltered_html' ) ); 421 421 422 $post = self:: $factory->post->create_and_get();422 $post = self::factory()->post->create_and_get(); 423 423 $data = array( 424 424 'comment_post_ID' => $post->ID, … … 440 440 update_option( 'comment_registration', '1' ); 441 441 442 $post = self:: $factory->post->create_and_get();442 $post = self::factory()->post->create_and_get(); 443 443 $data = array( 444 444 'comment_post_ID' => $post->ID, … … 460 460 update_option( 'require_name_email', '1' ); 461 461 462 $post = self:: $factory->post->create_and_get();462 $post = self::factory()->post->create_and_get(); 463 463 $data = array( 464 464 'comment_post_ID' => $post->ID, … … 482 482 update_option( 'require_name_email', '1' ); 483 483 484 $post = self:: $factory->post->create_and_get();484 $post = self::factory()->post->create_and_get(); 485 485 $data = array( 486 486 'comment_post_ID' => $post->ID, … … 504 504 update_option( 'require_name_email', '1' ); 505 505 506 $post = self:: $factory->post->create_and_get();506 $post = self::factory()->post->create_and_get(); 507 507 $data = array( 508 508 'comment_post_ID' => $post->ID, … … 524 524 $error = 'require_valid_comment'; 525 525 526 $post = self:: $factory->post->create_and_get();526 $post = self::factory()->post->create_and_get(); 527 527 $data = array( 528 528 'comment_post_ID' => $post->ID, -
trunk/tests/phpunit/tests/comment.php
r35225 r35242 22 22 23 23 function test_wp_update_comment() { 24 $post = self:: $factory->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post' ) );25 $post2 = self:: $factory->post->create_and_get( array( 'post_title' => 'some-post-2', 'post_type' => 'post' ) );26 $comments = self:: $factory->comment->create_post_comments( $post->ID, 5 );24 $post = self::factory()->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post' ) ); 25 $post2 = self::factory()->post->create_and_get( array( 'post_title' => 'some-post-2', 'post_type' => 'post' ) ); 26 $comments = self::factory()->comment->create_post_comments( $post->ID, 5 ); 27 27 $result = wp_update_comment( array( 'comment_ID' => $comments[0], 'comment_parent' => $comments[1] ) ); 28 28 $this->assertEquals( 1, $result ); … … 40 40 */ 41 41 function test_wp_update_comment_updates_comment_type() { 42 $comment_id = self:: $factory->comment->create( array( 'comment_post_ID' => self::$post_id ) );42 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) ); 43 43 44 44 wp_update_comment( array( 'comment_ID' => $comment_id, 'comment_type' => 'pingback' ) ); … … 52 52 */ 53 53 function test_wp_update_comment_updates_user_id() { 54 $comment_id = self:: $factory->comment->create( array( 'comment_post_ID' => self::$post_id ) );54 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) ); 55 55 56 56 wp_update_comment( array( 'comment_ID' => $comment_id, 'user_id' => 1 ) ); … … 61 61 62 62 public function test_get_approved_comments() { 63 $ca1 = self:: $factory->comment->create( array(63 $ca1 = self::factory()->comment->create( array( 64 64 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' 65 65 ) ); 66 $ca2 = self:: $factory->comment->create( array(66 $ca2 = self::factory()->comment->create( array( 67 67 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' 68 68 ) ); 69 $ca3 = self:: $factory->comment->create( array(69 $ca3 = self::factory()->comment->create( array( 70 70 'comment_post_ID' => self::$post_id, 'comment_approved' => '0' 71 71 ) ); 72 $c2 = self:: $factory->comment->create( array(72 $c2 = self::factory()->comment->create( array( 73 73 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' 74 74 ) ); 75 $c3 = self:: $factory->comment->create( array(75 $c3 = self::factory()->comment->create( array( 76 76 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' 77 77 ) ); 78 $c4 = self:: $factory->comment->create( array(78 $c4 = self::factory()->comment->create( array( 79 79 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'mario' 80 80 ) ); 81 $c5 = self:: $factory->comment->create( array(81 $c5 = self::factory()->comment->create( array( 82 82 'comment_post_ID' => self::$post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' 83 83 ) ); … … 93 93 */ 94 94 public function test_get_approved_comments_with_post_id_0_should_return_empty_array() { 95 $ca1 = self:: $factory->comment->create( array(95 $ca1 = self::factory()->comment->create( array( 96 96 'comment_post_ID' => self::$post_id, 'comment_approved' => '1' 97 97 ) ); … … 257 257 */ 258 258 public function test_wp_notify_moderator_should_not_throw_notice_when_post_author_is_0() { 259 $p = self:: $factory->post->create( array(259 $p = self::factory()->post->create( array( 260 260 'post_author' => 0, 261 261 ) ); 262 262 263 $c = self:: $factory->comment->create( array(263 $c = self::factory()->comment->create( array( 264 264 'comment_post_ID' => $p, 265 265 ) ); … … 272 272 */ 273 273 public function test_wp_new_comment_notify_postauthor_should_not_send_email_when_comment_has_been_marked_as_spam() { 274 $c = self:: $factory->comment->create( array(274 $c = self::factory()->comment->create( array( 275 275 'comment_post_ID' => self::$post_id, 276 276 'comment_approved' => 'spam', … … 285 285 */ 286 286 public function test_wp_new_comment_with_meta() { 287 $c = self:: $factory->comment->create( array(287 $c = self::factory()->comment->create( array( 288 288 'comment_approved' => '1', 289 289 'comment_meta' => array( … … 300 300 */ 301 301 public function test_wp_comment_get_children_should_fill_children() { 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(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( 308 308 'comment_post_ID' => self::$post_id, 309 309 'comment_approved' => '1', … … 311 311 ) ); 312 312 313 $c3 = self:: $factory->comment->create( array(313 $c3 = self::factory()->comment->create( array( 314 314 'comment_post_ID' => self::$post_id, 315 315 'comment_approved' => '1', … … 317 317 ) ); 318 318 319 $c4 = self:: $factory->comment->create( array(319 $c4 = self::factory()->comment->create( array( 320 320 'comment_post_ID' => self::$post_id, 321 321 'comment_approved' => '1', … … 323 323 ) ); 324 324 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(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( 331 331 'comment_post_ID' => self::$post_id, 332 332 'comment_approved' => '1', … … 348 348 */ 349 349 public function test_post_properties_should_be_lazyloaded() { 350 $c = self:: $factory->comment->create( array( 'comment_post_ID' => self::$post_id ) );350 $c = self::factory()->comment->create( array( 'comment_post_ID' => self::$post_id ) ); 351 351 352 352 $post = get_post( self::$post_id ); -
trunk/tests/phpunit/tests/comment/checkComment.php
r35225 r35242 32 32 33 33 public function test_should_return_true_when_comment_whitelist_is_enabled_and_author_has_approved_comment() { 34 $post_id = self:: $factory->post->create();34 $post_id = self::factory()->post->create(); 35 35 $prev_args = array( 36 36 'comment_post_ID' => $post_id, … … 40 40 'comment_author' => 'BobtheBuilder', 41 41 ); 42 $prev_comment_id = self:: $factory->comment->create( $prev_args );42 $prev_comment_id = self::factory()->comment->create( $prev_args ); 43 43 44 44 update_option( 'comment_whitelist', 1 ); -
trunk/tests/phpunit/tests/comment/commentForm.php
r35225 r35242 6 6 class Tests_Comment_CommentForm extends WP_UnitTestCase { 7 7 public function test_default_markup_for_submit_button_and_wrapper() { 8 $p = self:: $factory->post->create();8 $p = self::factory()->post->create(); 9 9 10 10 $args = array( … … 22 22 23 23 public function test_custom_submit_button() { 24 $p = self:: $factory->post->create();24 $p = self::factory()->post->create(); 25 25 26 26 $args = array( … … 38 38 39 39 public function test_custom_submit_field() { 40 $p = self:: $factory->post->create();40 $p = self::factory()->post->create(); 41 41 42 42 $args = array( … … 58 58 */ 59 59 public function test_submit_button_and_submit_field_should_fall_back_on_defaults_when_filtered_defaults_do_not_contain_the_keys() { 60 $p = self:: $factory->post->create();60 $p = self::factory()->post->create(); 61 61 62 62 $args = array( -
trunk/tests/phpunit/tests/comment/commentsTemplate.php
r35225 r35242 13 13 public function test_should_respect_comment_order_asc_when_default_comments_page_is_newest() { 14 14 $now = time(); 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(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( 22 22 'comment_post_ID' => $p, 23 23 'comment_content' => '2', … … 43 43 public function test_should_respect_comment_order_desc_when_default_comments_page_is_newest() { 44 44 $now = time(); 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(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( 52 52 'comment_post_ID' => $p, 53 53 'comment_content' => '2', … … 73 73 public function test_should_respect_comment_order_asc_when_default_comments_page_is_oldest() { 74 74 $now = time(); 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(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( 82 82 'comment_post_ID' => $p, 83 83 'comment_content' => '2', … … 103 103 public function test_should_respect_comment_order_desc_when_default_comments_page_is_oldest() { 104 104 $now = time(); 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(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( 112 112 'comment_post_ID' => $p, 113 113 'comment_content' => '2', … … 133 133 public function test_should_respect_comment_order_asc_when_default_comments_page_is_newest_on_subsequent_pages() { 134 134 $now = time(); 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(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( 152 152 'comment_post_ID' => $p, 153 153 'comment_content' => '4', 154 154 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ), 155 155 ) ); 156 $comment_5 = self:: $factory->comment->create( array(156 $comment_5 = self::factory()->comment->create( array( 157 157 'comment_post_ID' => $p, 158 158 'comment_content' => '3', 159 159 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 500 ), 160 160 ) ); 161 $comment_6 = self:: $factory->comment->create( array(161 $comment_6 = self::factory()->comment->create( array( 162 162 'comment_post_ID' => $p, 163 163 'comment_content' => '4', … … 188 188 public function test_should_respect_comment_order_desc_when_default_comments_page_is_newest_on_subsequent_pages() { 189 189 $now = time(); 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(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( 207 207 'comment_post_ID' => $p, 208 208 'comment_content' => '4', 209 209 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ), 210 210 ) ); 211 $comment_5 = self:: $factory->comment->create( array(211 $comment_5 = self::factory()->comment->create( array( 212 212 'comment_post_ID' => $p, 213 213 'comment_content' => '3', 214 214 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 500 ), 215 215 ) ); 216 $comment_6 = self:: $factory->comment->create( array(216 $comment_6 = self::factory()->comment->create( array( 217 217 'comment_post_ID' => $p, 218 218 'comment_content' => '4', … … 243 243 public function test_should_respect_comment_order_asc_when_default_comments_page_is_oldest_on_subsequent_pages() { 244 244 $now = time(); 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(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( 262 262 'comment_post_ID' => $p, 263 263 'comment_content' => '4', … … 288 288 public function test_should_respect_comment_order_desc_when_default_comments_page_is_oldest_on_subsequent_pages() { 289 289 $now = time(); 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(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( 307 307 'comment_post_ID' => $p, 308 308 'comment_content' => '4', … … 335 335 public function test_last_page_of_comments_should_be_full_when_default_comment_page_is_newest() { 336 336 $now = time(); 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(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( 349 349 'comment_post_ID' => $p, 350 350 'comment_content' => '3', … … 377 377 public function test_first_page_of_comments_should_have_remainder_when_default_comments_page_is_newest() { 378 378 $now = time(); 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(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( 391 391 'comment_post_ID' => $p, 392 392 'comment_content' => '3', … … 417 417 public function test_comment_permalinks_should_be_correct_when_using_default_display_callback_with_default_comment_page_oldest() { 418 418 $now = time(); 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(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( 436 436 'comment_post_ID' => $p, 437 437 'comment_content' => '4', … … 481 481 public function test_comment_permalinks_should_be_correct_when_using_default_display_callback_with_default_comment_page_newest() { 482 482 $now = time(); 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(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( 500 500 'comment_post_ID' => $p, 501 501 'comment_content' => '4', 502 502 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ), 503 503 ) ); 504 $comment_5 = self:: $factory->comment->create( array(504 $comment_5 = self::factory()->comment->create( array( 505 505 'comment_post_ID' => $p, 506 506 'comment_content' => '4', 507 507 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 500 ), 508 508 ) ); 509 $comment_6 = self:: $factory->comment->create( array(509 $comment_6 = self::factory()->comment->create( array( 510 510 'comment_post_ID' => $p, 511 511 'comment_content' => '4', -
trunk/tests/phpunit/tests/comment/dateQuery.php
r35225 r35242 23 23 // Just some dummy posts to use as parents for comments 24 24 for ( $i = 1; $i <= 2; $i++ ) { 25 $this->posts[$i] = self:: $factory->post->create();25 $this->posts[$i] = self::factory()->post->create(); 26 26 } 27 27 … … 40 40 41 41 foreach ( $comment_dates as $comment_date => $comment_parent ) { 42 $result = self:: $factory->comment->create( array(42 $result = self::factory()->comment->create( array( 43 43 'comment_date' => $comment_date, 44 44 'comment_post_ID' => $this->posts[ $comment_parent ], -
trunk/tests/phpunit/tests/comment/getCommentClass.php
r35225 r35242 6 6 class Tests_Comment_GetCommentClass extends WP_UnitTestCase { 7 7 public function test_should_accept_comment_id() { 8 $post_id = self:: $factory->post->create();9 $comment_id = self:: $factory->comment->create( array( 'comment_post_ID' => $post_id ) );8 $post_id = self::factory()->post->create(); 9 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => $post_id ) ); 10 10 11 11 $classes = get_comment_class( '', $comment_id ); … … 14 14 15 15 public function test_should_accept_comment_object() { 16 $post_id = self:: $factory->post->create();17 $comment = self:: $factory->comment->create_and_get( array( 'comment_post_ID' => $post_id ) );16 $post_id = self::factory()->post->create(); 17 $comment = self::factory()->comment->create_and_get( array( 'comment_post_ID' => $post_id ) ); 18 18 19 19 $classes = get_comment_class( '', $comment ); … … 22 22 23 23 public function test_should_append_single_class() { 24 $post_id = self:: $factory->post->create();25 $comment_id = self:: $factory->comment->create( array( 'comment_post_ID' => $post_id ) );24 $post_id = self::factory()->post->create(); 25 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => $post_id ) ); 26 26 27 27 $classes = get_comment_class( 'foo', $comment_id ); … … 30 30 31 31 public function test_should_append_array_of_classes() { 32 $post_id = self:: $factory->post->create();33 $comment_id = self:: $factory->comment->create( array( 'comment_post_ID' => $post_id ) );32 $post_id = self::factory()->post->create(); 33 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => $post_id ) ); 34 34 35 35 $classes = get_comment_class( array( 'foo', 'bar' ), $comment_id ); -
trunk/tests/phpunit/tests/comment/getCommentCount.php
r35225 r35242 15 15 16 16 public function test_get_comment_count_approved() { 17 self:: $factory->comment->create( array(17 self::factory()->comment->create( array( 18 18 'comment_approved' => 1 19 19 ) ); … … 30 30 31 31 public function test_get_comment_count_awaiting() { 32 self:: $factory->comment->create( array(32 self::factory()->comment->create( array( 33 33 'comment_approved' => 0 34 34 ) ); … … 45 45 46 46 public function test_get_comment_count_spam() { 47 self:: $factory->comment->create( array(47 self::factory()->comment->create( array( 48 48 'comment_approved' => 'spam' 49 49 ) ); … … 60 60 61 61 public function test_get_comment_count_trash() { 62 self:: $factory->comment->create( array(62 self::factory()->comment->create( array( 63 63 'comment_approved' => 'trash' 64 64 ) ); … … 75 75 76 76 public function test_get_comment_count_post_trashed() { 77 self:: $factory->comment->create( array(77 self::factory()->comment->create( array( 78 78 'comment_approved' => 'post-trashed' 79 79 ) ); -
trunk/tests/phpunit/tests/comment/getCommentExcerpt.php
r35225 r35242 15 15 16 16 public function test_get_comment_excerpt() { 17 $comment_id = self:: $factory->comment->create( array(17 $comment_id = self::factory()->comment->create( array( 18 18 'comment_content' => self::$bacon_comment 19 19 ) ); … … 25 25 26 26 public function test_get_comment_excerpt_filtered() { 27 $comment_id = self:: $factory->comment->create( array(27 $comment_id = self::factory()->comment->create( array( 28 28 'comment_content' => self::$bacon_comment 29 29 ) ); -
trunk/tests/phpunit/tests/comment/getCommentLink.php
r35225 r35242 12 12 13 13 $now = time(); 14 $this->p = self:: $factory->post->create();15 $this->comments[] = self:: $factory->comment->create( array(14 $this->p = self::factory()->post->create(); 15 $this->comments[] = self::factory()->comment->create( array( 16 16 'comment_post_ID' => $this->p, 17 17 'comment_content' => '1', 18 18 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), 19 19 ) ); 20 $this->comments[] = self:: $factory->comment->create( array(20 $this->comments[] = self::factory()->comment->create( array( 21 21 'comment_post_ID' => $this->p, 22 22 'comment_content' => '2', 23 23 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), 24 24 ) ); 25 $this->comments[] = self:: $factory->comment->create( array(25 $this->comments[] = self::factory()->comment->create( array( 26 26 'comment_post_ID' => $this->p, 27 27 'comment_content' => '3', 28 28 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), 29 29 ) ); 30 $this->comments[] = self:: $factory->comment->create( array(30 $this->comments[] = self::factory()->comment->create( array( 31 31 'comment_post_ID' => $this->p, 32 32 'comment_content' => '4', 33 33 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ), 34 34 ) ); 35 $this->comments[] = self:: $factory->comment->create( array(35 $this->comments[] = self::factory()->comment->create( array( 36 36 'comment_post_ID' => $this->p, 37 37 'comment_content' => '4', 38 38 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 500 ), 39 39 ) ); 40 $this->comments[] = self:: $factory->comment->create( array(40 $this->comments[] = self::factory()->comment->create( array( 41 41 'comment_post_ID' => $this->p, 42 42 'comment_content' => '4', -
trunk/tests/phpunit/tests/comment/getCommentsPagesCount.php
r35225 r35242 39 39 function test_empty() { 40 40 //setup post and comments 41 $post_id = self:: $factory->post->create( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) );41 $post_id = self::factory()->post->create( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) ); 42 42 $this->go_to( '/?p=' . $post_id ); 43 43 … … 61 61 function test_threaded_comments( ) { 62 62 //setup post and comments 63 $post = self:: $factory->post->create_and_get( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) );64 $comments = self:: $factory->comment->create_post_comments( $post->ID, 15 );65 self:: $factory->comment->create_post_comments( $post->ID, 6, array( 'comment_parent' => $comments[0] ) );63 $post = self::factory()->post->create_and_get( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) ); 64 $comments = self::factory()->comment->create_post_comments( $post->ID, 15 ); 65 self::factory()->comment->create_post_comments( $post->ID, 6, array( 'comment_parent' => $comments[0] ) ); 66 66 $comments = get_comments( array( 'post_id' => $post->ID ) ); 67 67 … … 77 77 78 78 //setup post and comments 79 $post = self:: $factory->post->create_and_get( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) );80 $comments = self:: $factory->comment->create_post_comments( $post->ID, 15 );81 self:: $factory->comment->create_post_comments( $post->ID, 6, array('comment_parent' => $comments[0] ) );79 $post = self::factory()->post->create_and_get( array( 'post_title' => 'comment--post', 'post_type' => 'post' ) ); 80 $comments = self::factory()->comment->create_post_comments( $post->ID, 15 ); 81 self::factory()->comment->create_post_comments( $post->ID, 6, array('comment_parent' => $comments[0] ) ); 82 82 $comments = get_comments( array( 'post_id' => $post->ID ) ); 83 83 … … 105 105 update_option( 'posts_per_rss', 100 ); 106 106 107 $post = self:: $factory->post->create_and_get( array( 'post_title' => 'comment-post', 'post_type' => 'post' ) );108 $comments = self:: $factory->comment->create_post_comments( $post->ID, 25 );107 $post = self::factory()->post->create_and_get( array( 'post_title' => 'comment-post', 'post_type' => 'post' ) ); 108 $comments = self::factory()->comment->create_post_comments( $post->ID, 25 ); 109 109 110 110 $wp_query = new WP_Query( array( 'p' => $post->ID, 'comments_per_page' => 10, 'feed' =>'comments-' ) ); -
trunk/tests/phpunit/tests/comment/getPageOfComment.php
r35225 r35242 8 8 9 9 public function test_last_comment() { 10 $p = self:: $factory->post->create();10 $p = self::factory()->post->create(); 11 11 12 12 // page 4 13 $comment_last = self:: $factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-24 00:00:00' ) );14 self:: $factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-23 00:00:00' ) );13 $comment_last = self::factory()->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-24 00:00:00' ) ); 14 self::factory()->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-23 00:00:00' ) ); 15 15 16 16 // page 3 17 self:: $factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-22 00:00:00' ) );18 self:: $factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-21 00:00:00' ) );19 self:: $factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-20 00:00:00' ) );17 self::factory()->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-22 00:00:00' ) ); 18 self::factory()->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-21 00:00:00' ) ); 19 self::factory()->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-20 00:00:00' ) ); 20 20 21 21 // page 2 22 self:: $factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-19 00:00:00' ) );23 self:: $factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-18 00:00:00' ) );24 self:: $factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-17 00:00:00' ) );22 self::factory()->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-19 00:00:00' ) ); 23 self::factory()->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-18 00:00:00' ) ); 24 self::factory()->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-17 00:00:00' ) ); 25 25 26 26 // page 1 27 self:: $factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-16 00:00:00' ) );28 self:: $factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-15 00:00:00' ) );29 $comment_first = self:: $factory->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-14 00:00:00' ) );27 self::factory()->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-16 00:00:00' ) ); 28 self::factory()->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-15 00:00:00' ) ); 29 $comment_first = self::factory()->comment->create_post_comments( $p, 1, array( 'comment_date' => '2013-09-14 00:00:00' ) ); 30 30 31 31 $this->assertEquals( 4, get_page_of_comment( $comment_last[0], array( 'per_page' => 3 ) ) ); … … 37 37 38 38 public function test_type_pings() { 39 $p = self:: $factory->post->create();39 $p = self::factory()->post->create(); 40 40 $now = time(); 41 41 42 42 $trackbacks = array(); 43 43 for ( $i = 0; $i <= 3; $i++ ) { 44 $trackbacks[ $i ] = self:: $factory->comment->create( array( 'comment_post_ID' => $p, 'comment_type' => 'trackback', 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ) ) );44 $trackbacks[ $i ] = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_type' => 'trackback', 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ) ) ); 45 45 $now -= 10 * $i; 46 46 } … … 48 48 $pingbacks = array(); 49 49 for ( $i = 0; $i <= 6; $i++ ) { 50 $pingbacks[ $i ] = self:: $factory->comment->create( array( 'comment_post_ID' => $p, 'comment_type' => 'pingback', 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ) ) );50 $pingbacks[ $i ] = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_type' => 'pingback', 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ) ) ); 51 51 $now -= 10 * $i; 52 52 } … … 63 63 global $wpdb; 64 64 65 $p = self:: $factory->post->create();66 $c = self:: $factory->comment->create( array( 'comment_post_ID' => $p ) );65 $p = self::factory()->post->create(); 66 $c = self::factory()->comment->create( array( 'comment_post_ID' => $p ) ); 67 67 68 68 // Prime cache. … … 82 82 global $wpdb; 83 83 84 $p = self:: $factory->post->create();85 $comment = self:: $factory->comment->create( array( 'comment_post_ID' => $p, 'comment_type' => 'comment' ) );84 $p = self::factory()->post->create(); 85 $comment = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_type' => 'comment' ) ); 86 86 87 87 $now = time(); 88 88 $trackbacks = array(); 89 89 for ( $i = 0; $i <= 5; $i++ ) { 90 $trackbacks[ $i ] = self:: $factory->comment->create( array( 'comment_post_ID' => $p, 'comment_type' => 'trackback', 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( 10 * $i ) ) ) );90 $trackbacks[ $i ] = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_type' => 'trackback', 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( 10 * $i ) ) ) ); 91 91 } 92 92 … … 106 106 */ 107 107 public function test_cache_should_be_invalidated_when_comment_is_approved() { 108 $p = self:: $factory->post->create();109 $c = self:: $factory->comment->create( array( 'comment_post_ID' => $p, 'comment_approved' => 0 ) );108 $p = self::factory()->post->create(); 109 $c = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_approved' => 0 ) ); 110 110 111 111 // Prime cache. … … 122 122 */ 123 123 public function test_cache_should_be_invalidated_when_comment_is_deleted() { 124 $p = self:: $factory->post->create();125 $c = self:: $factory->comment->create( array( 'comment_post_ID' => $p ) );124 $p = self::factory()->post->create(); 125 $c = self::factory()->comment->create( array( 'comment_post_ID' => $p ) ); 126 126 127 127 // Prime cache. … … 138 138 */ 139 139 public function test_cache_should_be_invalidated_when_comment_is_spammed() { 140 $p = self:: $factory->post->create();141 $c = self:: $factory->comment->create( array( 'comment_post_ID' => $p ) );140 $p = self::factory()->post->create(); 141 $c = self::factory()->comment->create( array( 'comment_post_ID' => $p ) ); 142 142 143 143 // Prime cache. … … 156 156 $now = time(); 157 157 158 $p = self:: $factory->post->create();159 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ) ) );160 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 20 ) ) );161 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $p, 'comment_approved' => 0, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 30 ) ) );158 $p = self::factory()->post->create(); 159 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ) ) ); 160 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 20 ) ) ); 161 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_approved' => 0, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 30 ) ) ); 162 162 163 163 $this->assertEquals( 1, get_page_of_comment( $c1, array( 'per_page' => 2 ) ) ); … … 172 172 */ 173 173 public function test_query_should_be_limited_to_comments_on_the_proper_post() { 174 $posts = self:: $factory->post->create_many( 2 );174 $posts = self::factory()->post->create_many( 2 ); 175 175 176 176 $now = time(); 177 177 $comments_0 = $comments_1 = array(); 178 178 for ( $i = 0; $i < 5; $i++ ) { 179 $comments_0[] = self:: $factory->comment->create( array( 'comment_post_ID' => $posts[0], 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( $i * 60 ) ) ) );180 $comments_1[] = self:: $factory->comment->create( array( 'comment_post_ID' => $posts[1], 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( $i * 60 ) ) ) );179 $comments_0[] = self::factory()->comment->create( array( 'comment_post_ID' => $posts[0], 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( $i * 60 ) ) ) ); 180 $comments_1[] = self::factory()->comment->create( array( 'comment_post_ID' => $posts[1], 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( $i * 60 ) ) ) ); 181 181 } 182 182 … … 192 192 */ 193 193 public function test_only_top_level_comments_should_be_included_in_older_count() { 194 $post = self:: $factory->post->create();194 $post = self::factory()->post->create(); 195 195 196 196 $now = time(); 197 197 $comment_parents = $comment_children = array(); 198 198 for ( $i = 0; $i < 5; $i++ ) { 199 $parent = self:: $factory->comment->create( array( 'comment_post_ID' => $post, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( $i * 60 ) ) ) );199 $parent = self::factory()->comment->create( array( 'comment_post_ID' => $post, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( $i * 60 ) ) ) ); 200 200 $comment_parents[ $i ] = $parent; 201 201 202 $child = self:: $factory->comment->create( array( 'comment_post_ID' => $post, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( $i * 59 ) ), 'comment_parent' => $parent ) );202 $child = self::factory()->comment->create( array( 'comment_post_ID' => $post, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( $i * 59 ) ), 'comment_parent' => $parent ) ); 203 203 $comment_children[ $i ] = $child; 204 204 } … … 229 229 $now = time(); 230 230 231 $p = self:: $factory->post->create();232 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ) ) );233 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 20 ) ) );234 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 30 ) ) );231 $p = self::factory()->post->create(); 232 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now ) ) ); 233 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 20 ) ) ); 234 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p, 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 30 ) ) ); 235 235 236 236 update_option( 'comments_per_page', 2 ); -
trunk/tests/phpunit/tests/comment/metaCache.php
r35225 r35242 11 11 global $wpdb; 12 12 13 $p = self:: $factory->post->create( array( 'post_status' => 'publish' ) );14 $comment_ids = self:: $factory->comment->create_post_comments( $p, 3 );13 $p = self::factory()->post->create( array( 'post_status' => 'publish' ) ); 14 $comment_ids = self::factory()->comment->create_post_comments( $p, 3 ); 15 15 16 16 foreach ( $comment_ids as $cid ) { … … 39 39 global $wpdb; 40 40 41 $p = self:: $factory->post->create( array( 'post_status' => 'publish' ) );42 $comment_ids = self:: $factory->comment->create_post_comments( $p, 3 );41 $p = self::factory()->post->create( array( 'post_status' => 'publish' ) ); 42 $comment_ids = self::factory()->comment->create_post_comments( $p, 3 ); 43 43 44 44 foreach ( $comment_ids as $cid ) { … … 68 68 global $wpdb; 69 69 70 $p = self:: $factory->post->create( array( 'post_status' => 'publish' ) );71 $comment_ids = self:: $factory->comment->create_post_comments( $p, 3 );70 $p = self::factory()->post->create( array( 'post_status' => 'publish' ) ); 71 $comment_ids = self::factory()->comment->create_post_comments( $p, 3 ); 72 72 73 73 foreach ( $comment_ids as $cid ) { … … 94 94 global $wpdb; 95 95 96 $p = self:: $factory->post->create( array( 'post_status' => 'publish' ) );97 $comment_ids = self:: $factory->comment->create_post_comments( $p, 3 );96 $p = self::factory()->post->create( array( 'post_status' => 'publish' ) ); 97 $comment_ids = self::factory()->comment->create_post_comments( $p, 3 ); 98 98 99 99 foreach ( $comment_ids as $cid ) { … … 129 129 global $wpdb; 130 130 131 $posts = self:: $factory->post->create_many( 2, array( 'post_status' => 'publish' ) );131 $posts = self::factory()->post->create_many( 2, array( 'post_status' => 'publish' ) ); 132 132 133 133 $now = time(); 134 134 $comments = array(); 135 135 for ( $i = 0; $i < 5; $i++ ) { 136 $comments[] = self:: $factory->comment->create( array(136 $comments[] = self::factory()->comment->create( array( 137 137 'comment_post_ID' => $posts[0], 138 138 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( 60 * $i ) ), … … 173 173 global $wpdb; 174 174 175 $posts = self:: $factory->post->create_many( 2, array( 'post_status' => 'publish' ) );175 $posts = self::factory()->post->create_many( 2, array( 'post_status' => 'publish' ) ); 176 176 177 177 $now = time(); 178 178 $comments = array(); 179 179 for ( $i = 0; $i < 5; $i++ ) { 180 $comments[] = self:: $factory->comment->create( array(180 $comments[] = self::factory()->comment->create( array( 181 181 'comment_post_ID' => $posts[0], 182 182 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - ( 60 * $i ) ), -
trunk/tests/phpunit/tests/comment/query.php
r35225 r35242 13 13 parent::setUp(); 14 14 15 $this->post_id = self:: $factory->post->create();15 $this->post_id = self::factory()->post->create(); 16 16 } 17 17 18 18 public function test_query() { 19 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );20 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );21 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );22 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );23 $c5 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );19 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 20 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 21 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 22 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 23 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) ); 24 24 25 25 $q = new WP_Comment_Query(); … … 32 32 33 33 public function test_query_post_id_0() { 34 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );34 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 35 35 36 36 $q = new WP_Comment_Query(); … … 47 47 */ 48 48 public function test_query_type_empty_string() { 49 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );50 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );51 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );52 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );53 $c5 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );49 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 50 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 51 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 52 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 53 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) ); 54 54 55 55 $q = new WP_Comment_Query(); … … 66 66 */ 67 67 public function test_query_type_comment() { 68 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );69 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );70 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );71 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );72 $c5 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );68 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 69 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 70 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 71 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 72 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) ); 73 73 74 74 $q = new WP_Comment_Query(); … … 82 82 83 83 public function test_query_type_pingback() { 84 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );85 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );86 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );87 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );84 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 85 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 86 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 87 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 88 88 89 89 $q = new WP_Comment_Query(); … … 98 98 99 99 public function test_query_type_trackback() { 100 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );101 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );102 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );103 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );100 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 101 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 102 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 103 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 104 104 105 105 $q = new WP_Comment_Query(); … … 117 117 */ 118 118 public function test_query_type_pings() { 119 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );120 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );121 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );122 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );123 $c5 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );119 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 120 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 121 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 122 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 123 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) ); 124 124 125 125 $q = new WP_Comment_Query(); … … 137 137 */ 138 138 public function test_type_array_comments_and_custom() { 139 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );140 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );141 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );142 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );143 $c5 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );144 $c6 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );139 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 140 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 141 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 142 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 143 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) ); 144 $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 145 145 146 146 $q = new WP_Comment_Query(); … … 157 157 */ 158 158 public function test_type_not__in_array_custom() { 159 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );160 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );161 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );162 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );163 $c5 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );164 $c6 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );159 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 160 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 161 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 162 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 163 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) ); 164 $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 165 165 166 166 $q = new WP_Comment_Query(); … … 177 177 */ 178 178 public function test_type__in_array_and_not_type_array_custom() { 179 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );180 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );181 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );182 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );183 $c5 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );184 $c6 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );179 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 180 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 181 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 182 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 183 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) ); 184 $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 185 185 186 186 $q = new WP_Comment_Query(); … … 198 198 */ 199 199 public function test_type_array_and_type__not_in_array_custom() { 200 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );201 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );202 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );203 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );204 $c5 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );205 $c6 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );200 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 201 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 202 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 203 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 204 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) ); 205 $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 206 206 207 207 $q = new WP_Comment_Query(); … … 219 219 */ 220 220 public function test_type__not_in_custom() { 221 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );222 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );223 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );224 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );225 $c5 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );226 $c6 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );221 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 222 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 223 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 224 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 225 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) ); 226 $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 227 227 228 228 $q = new WP_Comment_Query(); … … 239 239 */ 240 240 public function test_type_array_comments_and_pings() { 241 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );242 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );243 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );244 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) );245 $c5 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) );241 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 242 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 243 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 244 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'mario' ) ); 245 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'luigi' ) ); 246 246 247 247 $q = new WP_Comment_Query(); … … 258 258 */ 259 259 public function test_type_array_comment_pings() { 260 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );261 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );262 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );260 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 261 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 262 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 263 263 264 264 $q = new WP_Comment_Query(); … … 275 275 */ 276 276 public function test_type_array_pingback() { 277 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );278 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );279 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );277 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 278 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 279 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 280 280 281 281 $q = new WP_Comment_Query(); … … 292 292 */ 293 293 public function test_type_array_custom_pingpack() { 294 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );295 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );296 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );294 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 295 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 296 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 297 297 298 298 $q = new WP_Comment_Query(); … … 309 309 */ 310 310 public function test_type_array_pings() { 311 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );312 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );313 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );311 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 312 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 313 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 314 314 315 315 $q = new WP_Comment_Query(); … … 326 326 */ 327 327 public function test_type_status_approved_array_comment_pings() { 328 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );329 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );330 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );331 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0', 'comment_type' => 'pingback' ) );328 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 329 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 330 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 331 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0', 'comment_type' => 'pingback' ) ); 332 332 333 333 $q = new WP_Comment_Query(); … … 345 345 */ 346 346 public function test_type_array_trackback() { 347 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );348 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );349 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );347 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 348 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 349 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 350 350 351 351 $q = new WP_Comment_Query(); … … 362 362 */ 363 363 public function test_type_array_custom_trackback() { 364 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );365 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );366 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) );364 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 365 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 366 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'pingback' ) ); 367 367 368 368 $q = new WP_Comment_Query(); … … 379 379 */ 380 380 public function test_type_array_pings_approved() { 381 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );382 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );383 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) );384 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0', 'comment_type' => 'trackback' ) );381 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 382 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 383 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1', 'comment_type' => 'trackback' ) ); 384 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0', 'comment_type' => 'trackback' ) ); 385 385 386 386 $q = new WP_Comment_Query(); … … 398 398 */ 399 399 public function test_status_empty_string() { 400 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );401 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );402 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'spam' ) );400 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 401 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) ); 402 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'spam' ) ); 403 403 404 404 $q = new WP_Comment_Query(); … … 415 415 */ 416 416 public function test_status_hold() { 417 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );418 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );417 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 418 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) ); 419 419 420 420 $q = new WP_Comment_Query(); … … 431 431 */ 432 432 public function test_status_approve() { 433 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );434 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );433 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 434 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) ); 435 435 436 436 $q = new WP_Comment_Query(); … … 444 444 445 445 public function test_status_custom() { 446 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );447 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );448 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo1' ) );446 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 447 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) ); 448 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo1' ) ); 449 449 450 450 $q = new WP_Comment_Query(); … … 458 458 459 459 public function test_status_all() { 460 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );461 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );462 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );460 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 461 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) ); 462 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) ); 463 463 464 464 $q = new WP_Comment_Query(); … … 472 472 473 473 public function test_status_default_to_all() { 474 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );475 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );476 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );474 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 475 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) ); 476 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) ); 477 477 478 478 $q = new WP_Comment_Query(); … … 488 488 */ 489 489 public function test_status_comma_any() { 490 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );491 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );492 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );490 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 491 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) ); 492 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) ); 493 493 494 494 $q = new WP_Comment_Query(); … … 505 505 */ 506 506 public function test_status_comma_separated() { 507 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );508 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );509 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );507 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 508 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) ); 509 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) ); 510 510 511 511 $q = new WP_Comment_Query(); … … 522 522 */ 523 523 public function test_status_array() { 524 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );525 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) );526 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) );524 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 525 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'foo' ) ); 526 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '0' ) ); 527 527 528 528 $q = new WP_Comment_Query(); … … 538 538 $limit = 5; 539 539 540 $post_id = self:: $factory->post->create();541 self:: $factory->comment->create_post_comments( $post_id, $limit );540 $post_id = self::factory()->post->create(); 541 self::factory()->comment->create_post_comments( $post_id, $limit ); 542 542 $comments = get_comments( array( 'post_id' => $post_id ) ); 543 543 $this->assertEquals( $limit, count( $comments ) ); … … 546 546 } 547 547 548 $post_id2 = self:: $factory->post->create();549 self:: $factory->comment->create_post_comments( $post_id2, $limit );548 $post_id2 = self::factory()->post->create(); 549 self::factory()->comment->create_post_comments( $post_id2, $limit ); 550 550 $comments = get_comments( array( 'post_id' => $post_id2 ) ); 551 551 $this->assertEquals( $limit, count( $comments ) ); … … 554 554 } 555 555 556 $post_id3 = self:: $factory->post->create();557 self:: $factory->comment->create_post_comments( $post_id3, $limit, array( 'comment_approved' => '0' ) );556 $post_id3 = self::factory()->post->create(); 557 self::factory()->comment->create_post_comments( $post_id3, $limit, array( 'comment_approved' => '0' ) ); 558 558 $comments = get_comments( array( 'post_id' => $post_id3 ) ); 559 559 $this->assertEquals( $limit, count( $comments ) ); … … 571 571 $this->assertEquals( 0, count( $comments ) ); 572 572 573 self:: $factory->comment->create_post_comments( $post_id3, $limit, array( 'comment_approved' => '1' ) );573 self::factory()->comment->create_post_comments( $post_id3, $limit, array( 'comment_approved' => '1' ) ); 574 574 $comments = get_comments( array( 'post_id' => $post_id3 ) ); 575 575 $this->assertEquals( $limit * 2, count( $comments ) ); … … 583 583 */ 584 584 function test_orderby_meta() { 585 $comment_id = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );586 $comment_id2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );587 $comment_id3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );585 $comment_id = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id ) ); 586 $comment_id2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id ) ); 587 $comment_id3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id ) ); 588 588 589 589 add_comment_meta( $comment_id, 'key', 'value1', true ); … … 633 633 */ 634 634 public function test_orderby_clause_key() { 635 $comments = self:: $factory->comment->create_many( 3 );635 $comments = self::factory()->comment->create_many( 3 ); 636 636 add_comment_meta( $comments[0], 'foo', 'aaa' ); 637 637 add_comment_meta( $comments[1], 'foo', 'zzz' ); … … 658 658 */ 659 659 public function test_orderby_clause_key_as_secondary_sort() { 660 $c1 = self:: $factory->comment->create( array(660 $c1 = self::factory()->comment->create( array( 661 661 'comment_date' => '2015-01-28 03:00:00', 662 662 ) ); 663 $c2 = self:: $factory->comment->create( array(663 $c2 = self::factory()->comment->create( array( 664 664 'comment_date' => '2015-01-28 05:00:00', 665 665 ) ); 666 $c3 = self:: $factory->comment->create( array(666 $c3 = self::factory()->comment->create( array( 667 667 'comment_date' => '2015-01-28 03:00:00', 668 668 ) ); … … 694 694 */ 695 695 public function test_orderby_more_than_one_clause_key() { 696 $comments = self:: $factory->comment->create_many( 3 );696 $comments = self::factory()->comment->create_many( 3 ); 697 697 698 698 add_comment_meta( $comments[0], 'foo', 'jjj' ); … … 729 729 */ 730 730 public function test_meta_query_should_work_with_comment__in() { 731 $comments = self:: $factory->comment->create_many( 3 );731 $comments = self::factory()->comment->create_many( 3 ); 732 732 733 733 add_comment_meta( $comments[0], 'foo', 'jjj' ); … … 753 753 */ 754 754 public function test_meta_query_should_work_with_comment__not_in() { 755 $comments = self:: $factory->comment->create_many( 3 );755 $comments = self::factory()->comment->create_many( 3 ); 756 756 757 757 add_comment_meta( $comments[0], 'foo', 'jjj' ); … … 777 777 */ 778 778 function test_get_comments_by_user() { 779 $users = self:: $factory->user->create_many( 2 );780 self:: $factory->comment->create( array( 'user_id' => $users[0], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );781 self:: $factory->comment->create( array( 'user_id' => $users[0], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );782 self:: $factory->comment->create( array( 'user_id' => $users[1], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );779 $users = self::factory()->user->create_many( 2 ); 780 self::factory()->comment->create( array( 'user_id' => $users[0], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 781 self::factory()->comment->create( array( 'user_id' => $users[0], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 782 self::factory()->comment->create( array( 'user_id' => $users[1], 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 783 783 784 784 $comments = get_comments( array( … … 809 809 */ 810 810 function test_fields_ids_query() { 811 $comment_1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );812 $comment_2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );813 $comment_3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );811 $comment_1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) ); 812 $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) ); 813 $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) ); 814 814 815 815 // Ensure we are dealing with integers, and not objects. … … 827 827 */ 828 828 function test_fields_comment__in() { 829 $comment_1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );830 $comment_2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );831 $comment_3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );829 $comment_1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) ); 830 $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) ); 831 $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) ); 832 832 833 833 $comment_ids = get_comments( array( … … 843 843 */ 844 844 function test_fields_comment__not_in() { 845 $comment_1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );846 $comment_2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );847 $comment_3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );845 $comment_1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) ); 846 $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) ); 847 $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) ); 848 848 849 849 $comment_ids = get_comments( array( … … 859 859 */ 860 860 function test_fields_post__in() { 861 $p1 = self:: $factory->post->create();862 $p2 = self:: $factory->post->create();863 $p3 = self:: $factory->post->create();864 865 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 7, 'comment_approved' => '1' ) );866 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) );867 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $p3, 'user_id' => 1, 'comment_approved' => '1' ) );861 $p1 = self::factory()->post->create(); 862 $p2 = self::factory()->post->create(); 863 $p3 = self::factory()->post->create(); 864 865 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 7, 'comment_approved' => '1' ) ); 866 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) ); 867 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p3, 'user_id' => 1, 'comment_approved' => '1' ) ); 868 868 869 869 $comment_ids = get_comments( array( … … 879 879 */ 880 880 function test_fields_post__not_in() { 881 $p1 = self:: $factory->post->create();882 $p2 = self:: $factory->post->create();883 $p3 = self:: $factory->post->create();884 885 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 7, 'comment_approved' => '1' ) );886 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) );887 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $p3, 'user_id' => 1, 'comment_approved' => '1' ) );881 $p1 = self::factory()->post->create(); 882 $p2 = self::factory()->post->create(); 883 $p3 = self::factory()->post->create(); 884 885 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 7, 'comment_approved' => '1' ) ); 886 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) ); 887 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p3, 'user_id' => 1, 'comment_approved' => '1' ) ); 888 888 889 889 $comment_ids = get_comments( array( … … 902 902 $author_id2 = 106; 903 903 904 $p1 = self:: $factory->post->create( array( 'post_author' => $author_id1 ) );905 $p2 = self:: $factory->post->create( array( 'post_author' => $author_id1 ) );906 $p3 = self:: $factory->post->create( array( 'post_author' => $author_id2 ) );907 908 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) );909 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) );910 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $p3, 'user_id' => 1, 'comment_approved' => '1' ) );904 $p1 = self::factory()->post->create( array( 'post_author' => $author_id1 ) ); 905 $p2 = self::factory()->post->create( array( 'post_author' => $author_id1 ) ); 906 $p3 = self::factory()->post->create( array( 'post_author' => $author_id2 ) ); 907 908 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) ); 909 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) ); 910 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p3, 'user_id' => 1, 'comment_approved' => '1' ) ); 911 911 912 912 $comment_ids = get_comments( array( … … 925 925 $author_id2 = 112; 926 926 927 $p1 = self:: $factory->post->create( array( 'post_author' => $author_id1 ) );928 $p2 = self:: $factory->post->create( array( 'post_author' => $author_id1 ) );929 $p3 = self:: $factory->post->create( array( 'post_author' => $author_id2 ) );930 931 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) );932 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) );933 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $p3, 'user_id' => 1, 'comment_approved' => '1' ) );927 $p1 = self::factory()->post->create( array( 'post_author' => $author_id1 ) ); 928 $p2 = self::factory()->post->create( array( 'post_author' => $author_id1 ) ); 929 $p3 = self::factory()->post->create( array( 'post_author' => $author_id2 ) ); 930 931 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) ); 932 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 1, 'comment_approved' => '1' ) ); 933 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p3, 'user_id' => 1, 'comment_approved' => '1' ) ); 934 934 935 935 $comment_ids = get_comments( array( … … 945 945 */ 946 946 function test_fields_author__in() { 947 $p1 = self:: $factory->post->create();948 $p2 = self:: $factory->post->create();949 $p3 = self:: $factory->post->create();950 $p4 = self:: $factory->post->create();951 952 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) );953 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 2, 'comment_approved' => '1' ) );954 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 3, 'comment_approved' => '1' ) );955 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $p4, 'user_id' => 4, 'comment_approved' => '1' ) );947 $p1 = self::factory()->post->create(); 948 $p2 = self::factory()->post->create(); 949 $p3 = self::factory()->post->create(); 950 $p4 = self::factory()->post->create(); 951 952 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) ); 953 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 2, 'comment_approved' => '1' ) ); 954 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 3, 'comment_approved' => '1' ) ); 955 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $p4, 'user_id' => 4, 'comment_approved' => '1' ) ); 956 956 957 957 $comment_ids = get_comments( array( … … 967 967 */ 968 968 function test_fields_author__not_in() { 969 $p1 = self:: $factory->post->create();970 $p2 = self:: $factory->post->create();971 $p3 = self:: $factory->post->create();972 $p4 = self:: $factory->post->create();973 974 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) );975 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 2, 'comment_approved' => '1' ) );976 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 3, 'comment_approved' => '1' ) );977 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $p4, 'user_id' => 4, 'comment_approved' => '1' ) );969 $p1 = self::factory()->post->create(); 970 $p2 = self::factory()->post->create(); 971 $p3 = self::factory()->post->create(); 972 $p4 = self::factory()->post->create(); 973 974 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 1, 'comment_approved' => '1' ) ); 975 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $p1, 'user_id' => 2, 'comment_approved' => '1' ) ); 976 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $p2, 'user_id' => 3, 'comment_approved' => '1' ) ); 977 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $p4, 'user_id' => 4, 'comment_approved' => '1' ) ); 978 978 979 979 $comment_ids = get_comments( array( … … 989 989 */ 990 990 public function test_get_comments_with_status_all() { 991 $comment_1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );992 $comment_2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );993 $comment_3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );991 $comment_1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) ); 992 $comment_2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) ); 993 $comment_3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) ); 994 994 $comments_approved_1 = get_comments( array( 'status' => 'all' ) ); 995 995 … … 1002 1002 */ 1003 1003 public function test_get_comments_with_include_unapproved_user_id() { 1004 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );1005 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );1006 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );1007 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );1004 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) ); 1005 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) ); 1006 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) ); 1007 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) ); 1008 1008 1009 1009 $found = get_comments( array( … … 1020 1020 */ 1021 1021 public function test_get_comments_with_include_unapproved_user_id_array() { 1022 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );1023 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );1024 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );1025 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );1026 $c5 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 8, 'comment_approved' => '0' ) );1022 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) ); 1023 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) ); 1024 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) ); 1025 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) ); 1026 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 8, 'comment_approved' => '0' ) ); 1027 1027 1028 1028 $found = get_comments( array( … … 1039 1039 */ 1040 1040 public function test_get_comments_with_include_unapproved_user_id_comma_separated() { 1041 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );1042 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );1043 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) );1044 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) );1045 $c5 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 8, 'comment_approved' => '0' ) );1041 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) ); 1042 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) ); 1043 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '0' ) ); 1044 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 6, 'comment_approved' => '0' ) ); 1045 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 8, 'comment_approved' => '0' ) ); 1046 1046 1047 1047 $found = get_comments( array( … … 1058 1058 */ 1059 1059 public function test_get_comments_with_include_unapproved_author_email() { 1060 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );1061 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );1062 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );1063 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );1060 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) ); 1061 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) ); 1062 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) ); 1063 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) ); 1064 1064 1065 1065 $found = get_comments( array( … … 1076 1076 */ 1077 1077 public function test_get_comments_with_include_unapproved_mixed_array() { 1078 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );1079 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );1080 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );1081 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );1082 $c5 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );1078 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) ); 1079 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) ); 1080 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) ); 1081 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) ); 1082 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) ); 1083 1083 1084 1084 $found = get_comments( array( … … 1095 1095 */ 1096 1096 public function test_get_comments_with_include_unapproved_mixed_comma_separated() { 1097 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );1098 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );1099 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) );1100 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );1101 $c5 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );1097 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) ); 1098 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '1', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) ); 1099 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'foo@example.com' ) ); 1100 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 0, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) ); 1101 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) ); 1102 1102 1103 1103 $found = get_comments( array( … … 1111 1111 1112 1112 public function test_search() { 1113 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) );1114 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'foo@example.com' ) );1115 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://foo.bar' ) );1116 $c4 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com', 'comment_author_IP' => 'foo.bar' ) );1117 $c5 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com', 'comment_content' => 'Nice foo comment' ) );1118 $c6 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com' ) );1113 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'foo', 'comment_author_email' => 'bar@example.com' ) ); 1114 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'foo@example.com' ) ); 1115 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://foo.bar' ) ); 1116 $c4 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com', 'comment_author_IP' => 'foo.bar' ) ); 1117 $c5 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com', 'comment_content' => 'Nice foo comment' ) ); 1118 $c6 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 4, 'comment_approved' => '0', 'comment_author' => 'bar', 'comment_author_email' => 'bar@example.com', 'comment_author_url' => 'http://example.com' ) ); 1119 1119 1120 1120 $q = new WP_Comment_Query(); … … 1364 1364 public function test_orderby_date_modified_gmt_should_order_by_comment_ID_in_case_of_tie_ASC() { 1365 1365 $now = current_time( 'mysql', 1 ); 1366 $comments = self:: $factory->comment->create_many( 5, array(1366 $comments = self::factory()->comment->create_many( 5, array( 1367 1367 'comment_post_ID' => $this->post_id, 1368 1368 'comment_date_gmt' => $now, … … 1384 1384 public function test_orderby_date_modified_gmt_should_order_by_comment_ID_in_case_of_tie_DESC() { 1385 1385 $now = current_time( 'mysql', 1 ); 1386 $comments = self:: $factory->comment->create_many( 5, array(1386 $comments = self::factory()->comment->create_many( 5, array( 1387 1387 'comment_post_ID' => $this->post_id, 1388 1388 'comment_date_gmt' => $now, … … 1417 1417 1418 1418 public function test_count() { 1419 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );1420 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );1419 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) ); 1420 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) ); 1421 1421 1422 1422 $q = new WP_Comment_Query(); … … 1432 1432 */ 1433 1433 public function test_count_with_meta_query() { 1434 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );1435 $c2 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );1436 $c3 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );1434 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) ); 1435 $c2 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) ); 1436 $c3 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) ); 1437 1437 add_comment_meta( $c1, 'foo', 'bar' ); 1438 1438 add_comment_meta( $c3, 'foo', 'bar' ); … … 1456 1456 register_post_type( 'post-type-2' ); 1457 1457 1458 $p1 = self:: $factory->post->create( array( 'post_type' => 'post-type-1' ) );1459 $p2 = self:: $factory->post->create( array( 'post_type' => 'post-type-2' ) );1460 1461 $c1 = self:: $factory->comment->create_post_comments( $p1, 1 );1462 $c2 = self:: $factory->comment->create_post_comments( $p2, 1 );1458 $p1 = self::factory()->post->create( array( 'post_type' => 'post-type-1' ) ); 1459 $p2 = self::factory()->post->create( array( 'post_type' => 'post-type-2' ) ); 1460 1461 $c1 = self::factory()->comment->create_post_comments( $p1, 1 ); 1462 $c2 = self::factory()->comment->create_post_comments( $p2, 1 ); 1463 1463 1464 1464 $q = new WP_Comment_Query(); … … 1481 1481 register_post_type( 'post-type-2' ); 1482 1482 1483 $p1 = self:: $factory->post->create( array( 'post_type' => 'post-type-1' ) );1484 $p2 = self:: $factory->post->create( array( 'post_type' => 'post-type-2' ) );1485 1486 $c1 = self:: $factory->comment->create_post_comments( $p1, 1 );1487 $c2 = self:: $factory->comment->create_post_comments( $p2, 1 );1483 $p1 = self::factory()->post->create( array( 'post_type' => 'post-type-1' ) ); 1484 $p2 = self::factory()->post->create( array( 'post_type' => 'post-type-2' ) ); 1485 1486 $c1 = self::factory()->comment->create_post_comments( $p1, 1 ); 1487 $c2 = self::factory()->comment->create_post_comments( $p2, 1 ); 1488 1488 1489 1489 $q = new WP_Comment_Query(); … … 1506 1506 register_post_type( 'post-type-2' ); 1507 1507 1508 $p1 = self:: $factory->post->create( array( 'post_type' => 'post-type-1' ) );1509 $p2 = self:: $factory->post->create( array( 'post_type' => 'post-type-2' ) );1510 $p3 = self:: $factory->post->create( array( 'post_type' => 'post-type-3' ) );1511 1512 $c1 = self:: $factory->comment->create_post_comments( $p1, 1 );1513 $c2 = self:: $factory->comment->create_post_comments( $p2, 1 );1514 $c3 = self:: $factory->comment->create_post_comments( $p3, 1 );1508 $p1 = self::factory()->post->create( array( 'post_type' => 'post-type-1' ) ); 1509 $p2 = self::factory()->post->create( array( 'post_type' => 'post-type-2' ) ); 1510 $p3 = self::factory()->post->create( array( 'post_type' => 'post-type-3' ) ); 1511 1512 $c1 = self::factory()->comment->create_post_comments( $p1, 1 ); 1513 $c2 = self::factory()->comment->create_post_comments( $p2, 1 ); 1514 $c3 = self::factory()->comment->create_post_comments( $p3, 1 ); 1515 1515 1516 1516 $q = new WP_Comment_Query(); … … 1527 1527 1528 1528 public function test_post_name_single_value() { 1529 $p1 = self:: $factory->post->create( array( 'post_name' => 'foo' ) );1530 $p2 = self:: $factory->post->create( array( 'post_name' => 'bar' ) );1531 1532 $c1 = self:: $factory->comment->create_post_comments( $p1, 1 );1533 $c2 = self:: $factory->comment->create_post_comments( $p2, 1 );1529 $p1 = self::factory()->post->create( array( 'post_name' => 'foo' ) ); 1530 $p2 = self::factory()->post->create( array( 'post_name' => 'bar' ) ); 1531 1532 $c1 = self::factory()->comment->create_post_comments( $p1, 1 ); 1533 $c2 = self::factory()->comment->create_post_comments( $p2, 1 ); 1534 1534 1535 1535 $q = new WP_Comment_Query(); … … 1546 1546 */ 1547 1547 public function test_post_name_singleton_array() { 1548 $p1 = self:: $factory->post->create( array( 'post_name' => 'foo' ) );1549 $p2 = self:: $factory->post->create( array( 'post_name' => 'bar' ) );1550 1551 $c1 = self:: $factory->comment->create_post_comments( $p1, 1 );1552 $c2 = self:: $factory->comment->create_post_comments( $p2, 1 );1548 $p1 = self::factory()->post->create( array( 'post_name' => 'foo' ) ); 1549 $p2 = self::factory()->post->create( array( 'post_name' => 'bar' ) ); 1550 1551 $c1 = self::factory()->comment->create_post_comments( $p1, 1 ); 1552 $c2 = self::factory()->comment->create_post_comments( $p2, 1 ); 1553 1553 1554 1554 $q = new WP_Comment_Query(); … … 1565 1565 */ 1566 1566 public function test_post_name_array() { 1567 $p1 = self:: $factory->post->create( array( 'post_name' => 'foo' ) );1568 $p2 = self:: $factory->post->create( array( 'post_name' => 'bar' ) );1569 $p3 = self:: $factory->post->create( array( 'post_name' => 'baz' ) );1570 1571 $c1 = self:: $factory->comment->create_post_comments( $p1, 1 );1572 $c2 = self:: $factory->comment->create_post_comments( $p2, 1 );1573 $c3 = self:: $factory->comment->create_post_comments( $p3, 1 );1567 $p1 = self::factory()->post->create( array( 'post_name' => 'foo' ) ); 1568 $p2 = self::factory()->post->create( array( 'post_name' => 'bar' ) ); 1569 $p3 = self::factory()->post->create( array( 'post_name' => 'baz' ) ); 1570 1571 $c1 = self::factory()->comment->create_post_comments( $p1, 1 ); 1572 $c2 = self::factory()->comment->create_post_comments( $p2, 1 ); 1573 $c3 = self::factory()->comment->create_post_comments( $p3, 1 ); 1574 1574 1575 1575 $q = new WP_Comment_Query(); … … 1583 1583 1584 1584 public function test_post_status_single_value() { 1585 $p1 = self:: $factory->post->create( array( 'post_status' => 'publish' ) );1586 $p2 = self:: $factory->post->create( array( 'post_status' => 'draft' ) );1587 1588 $c1 = self:: $factory->comment->create_post_comments( $p1, 1 );1589 $c2 = self:: $factory->comment->create_post_comments( $p2, 1 );1585 $p1 = self::factory()->post->create( array( 'post_status' => 'publish' ) ); 1586 $p2 = self::factory()->post->create( array( 'post_status' => 'draft' ) ); 1587 1588 $c1 = self::factory()->comment->create_post_comments( $p1, 1 ); 1589 $c2 = self::factory()->comment->create_post_comments( $p2, 1 ); 1590 1590 1591 1591 $q = new WP_Comment_Query(); … … 1602 1602 */ 1603 1603 public function test_post_status_singleton_array() { 1604 $p1 = self:: $factory->post->create( array( 'post_status' => 'publish' ) );1605 $p2 = self:: $factory->post->create( array( 'post_status' => 'draft' ) );1606 1607 $c1 = self:: $factory->comment->create_post_comments( $p1, 1 );1608 $c2 = self:: $factory->comment->create_post_comments( $p2, 1 );1604 $p1 = self::factory()->post->create( array( 'post_status' => 'publish' ) ); 1605 $p2 = self::factory()->post->create( array( 'post_status' => 'draft' ) ); 1606 1607 $c1 = self::factory()->comment->create_post_comments( $p1, 1 ); 1608 $c2 = self::factory()->comment->create_post_comments( $p2, 1 ); 1609 1609 1610 1610 $q = new WP_Comment_Query(); … … 1621 1621 */ 1622 1622 public function test_post_status_array() { 1623 $p1 = self:: $factory->post->create( array( 'post_status' => 'publish' ) );1624 $p2 = self:: $factory->post->create( array( 'post_status' => 'draft' ) );1625 $p3 = self:: $factory->post->create( array( 'post_status' => 'future' ) );1626 1627 $c1 = self:: $factory->comment->create_post_comments( $p1, 1 );1628 $c2 = self:: $factory->comment->create_post_comments( $p2, 1 );1629 $c3 = self:: $factory->comment->create_post_comments( $p3, 1 );1623 $p1 = self::factory()->post->create( array( 'post_status' => 'publish' ) ); 1624 $p2 = self::factory()->post->create( array( 'post_status' => 'draft' ) ); 1625 $p3 = self::factory()->post->create( array( 'post_status' => 'future' ) ); 1626 1627 $c1 = self::factory()->comment->create_post_comments( $p1, 1 ); 1628 $c2 = self::factory()->comment->create_post_comments( $p2, 1 ); 1629 $c3 = self::factory()->comment->create_post_comments( $p3, 1 ); 1630 1630 1631 1631 $q = new WP_Comment_Query(); … … 1642 1642 */ 1643 1643 public function test_comment_query_object() { 1644 $comment_id = self:: $factory->comment->create();1644 $comment_id = self::factory()->comment->create(); 1645 1645 1646 1646 $query1 = new WP_Comment_Query(); … … 1664 1664 global $wpdb; 1665 1665 1666 $p = self:: $factory->post->create();1667 $c = self:: $factory->comment->create( array( 'comment_post_ID' => $p ) );1666 $p = self::factory()->post->create(); 1667 $c = self::factory()->comment->create( array( 'comment_post_ID' => $p ) ); 1668 1668 1669 1669 $q1 = new WP_Comment_Query(); … … 1689 1689 */ 1690 1690 public function test_it_should_be_possible_to_modify_meta_query_using_pre_get_comments_action() { 1691 $comments = self:: $factory->comment->create_many( 2, array(1691 $comments = self::factory()->comment->create_many( 2, array( 1692 1692 'comment_post_ID' => $this->post_id, 1693 1693 ) ); … … 1720 1720 */ 1721 1721 public function test_it_should_be_possible_to_modify_meta_params_using_pre_get_comments_action() { 1722 $comments = self:: $factory->comment->create_many( 2, array(1722 $comments = self::factory()->comment->create_many( 2, array( 1723 1723 'comment_post_ID' => $this->post_id, 1724 1724 ) ); … … 1747 1747 */ 1748 1748 public function test_parent__in() { 1749 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );1750 $c2 = self:: $factory->comment->create( array(1749 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 1750 $c2 = self::factory()->comment->create( array( 1751 1751 'comment_post_ID' => $this->post_id, 1752 1752 'comment_approved' => '1', … … 1767 1767 */ 1768 1768 public function test_parent__in_commas() { 1769 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );1770 $c2 = self:: $factory->comment->create( array(1769 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 1770 $c2 = self::factory()->comment->create( array( 1771 1771 'comment_post_ID' => $this->post_id, 1772 1772 'comment_approved' => '1' 1773 1773 ) ); 1774 $c3 = self:: $factory->comment->create( array(1774 $c3 = self::factory()->comment->create( array( 1775 1775 'comment_post_ID' => $this->post_id, 1776 1776 'comment_approved' => '1', 1777 1777 'comment_parent' => $c1, 1778 1778 ) ); 1779 $c4 = self:: $factory->comment->create( array(1779 $c4 = self::factory()->comment->create( array( 1780 1780 'comment_post_ID' => $this->post_id, 1781 1781 'comment_approved' => '1', … … 1796 1796 */ 1797 1797 public function test_parent__not_in() { 1798 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );1799 1800 self:: $factory->comment->create( array(1798 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 1799 1800 self::factory()->comment->create( array( 1801 1801 'comment_post_ID' => $this->post_id, 1802 1802 'comment_approved' => '1', … … 1817 1817 */ 1818 1818 public function test_parent__not_in_commas() { 1819 $c1 = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) );1820 $c2 = self:: $factory->comment->create( array(1819 $c1 = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 1820 $c2 = self::factory()->comment->create( array( 1821 1821 'comment_post_ID' => $this->post_id, 1822 1822 'comment_approved' => '1' 1823 1823 ) ); 1824 1824 1825 self:: $factory->comment->create( array(1825 self::factory()->comment->create( array( 1826 1826 'comment_post_ID' => $this->post_id, 1827 1827 'comment_approved' => '1', 1828 1828 'comment_parent' => $c1, 1829 1829 ) ); 1830 self:: $factory->comment->create( array(1830 self::factory()->comment->create( array( 1831 1831 'comment_post_ID' => $this->post_id, 1832 1832 'comment_approved' => '1', … … 1847 1847 */ 1848 1848 public function test_orderby_comment__in() { 1849 self:: $factory->comment->create( array(1849 self::factory()->comment->create( array( 1850 1850 'comment_post_ID' => $this->post_id, 1851 1851 'comment_approved' => '1' 1852 1852 ) ); 1853 1853 1854 $c2 = self:: $factory->comment->create( array(1854 $c2 = self::factory()->comment->create( array( 1855 1855 'comment_post_ID' => $this->post_id, 1856 1856 'comment_approved' => '1' 1857 1857 ) ); 1858 $c3 = self:: $factory->comment->create( array(1858 $c3 = self::factory()->comment->create( array( 1859 1859 'comment_post_ID' => $this->post_id, 1860 1860 'comment_approved' => '1' 1861 1861 ) ); 1862 1862 1863 self:: $factory->comment->create( array(1863 self::factory()->comment->create( array( 1864 1864 'comment_post_ID' => $this->post_id, 1865 1865 'comment_approved' => '1' … … 1881 1881 */ 1882 1882 public function test_no_found_rows_should_default_to_true() { 1883 $comments = self:: $factory->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) );1883 $comments = self::factory()->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) ); 1884 1884 1885 1885 $q = new WP_Comment_Query( array( … … 1896 1896 */ 1897 1897 public function test_should_respect_no_found_rows_true() { 1898 $comments = self:: $factory->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) );1898 $comments = self::factory()->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) ); 1899 1899 1900 1900 $q = new WP_Comment_Query( array( … … 1912 1912 */ 1913 1913 public function test_should_respect_no_found_rows_false() { 1914 $comments = self:: $factory->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) );1914 $comments = self::factory()->comment->create_many( 3, array( 'comment_post_ID' => $this->post_id ) ); 1915 1915 1916 1916 $q = new WP_Comment_Query( array( … … 1928 1928 */ 1929 1929 public function test_hierarchical_should_skip_child_comments_in_offset() { 1930 $top_level_0 = self:: $factory->comment->create( array(1931 'comment_post_ID' => $this->post_id, 1932 'comment_approved' => '1', 1933 ) ); 1934 1935 $child_of_0 = self:: $factory->comment->create( array(1930 $top_level_0 = self::factory()->comment->create( array( 1931 'comment_post_ID' => $this->post_id, 1932 'comment_approved' => '1', 1933 ) ); 1934 1935 $child_of_0 = self::factory()->comment->create( array( 1936 1936 'comment_post_ID' => $this->post_id, 1937 1937 'comment_approved' => '1', … … 1939 1939 ) ); 1940 1940 1941 $top_level_comments = self:: $factory->comment->create_many( 3, array(1941 $top_level_comments = self::factory()->comment->create_many( 3, array( 1942 1942 'comment_post_ID' => $this->post_id, 1943 1943 'comment_approved' => '1', … … 1961 1961 */ 1962 1962 public function test_hierarchical_should_not_include_child_comments_in_number() { 1963 $top_level_0 = self:: $factory->comment->create( array(1964 'comment_post_ID' => $this->post_id, 1965 'comment_approved' => '1', 1966 ) ); 1967 1968 $child_of_0 = self:: $factory->comment->create( array(1963 $top_level_0 = self::factory()->comment->create( array( 1964 'comment_post_ID' => $this->post_id, 1965 'comment_approved' => '1', 1966 ) ); 1967 1968 $child_of_0 = self::factory()->comment->create( array( 1969 1969 'comment_post_ID' => $this->post_id, 1970 1970 'comment_approved' => '1', … … 1972 1972 ) ); 1973 1973 1974 $top_level_comments = self:: $factory->comment->create_many( 3, array(1974 $top_level_comments = self::factory()->comment->create_many( 3, array( 1975 1975 'comment_post_ID' => $this->post_id, 1976 1976 'comment_approved' => '1', … … 1992 1992 */ 1993 1993 public function test_hierarchical_threaded() { 1994 $c1 = self:: $factory->comment->create( array(1995 'comment_post_ID' => $this->post_id, 1996 'comment_approved' => '1', 1997 ) ); 1998 1999 $c2 = self:: $factory->comment->create( array(1994 $c1 = self::factory()->comment->create( array( 1995 'comment_post_ID' => $this->post_id, 1996 'comment_approved' => '1', 1997 ) ); 1998 1999 $c2 = self::factory()->comment->create( array( 2000 2000 'comment_post_ID' => $this->post_id, 2001 2001 'comment_approved' => '1', … … 2003 2003 ) ); 2004 2004 2005 $c3 = self:: $factory->comment->create( array(2005 $c3 = self::factory()->comment->create( array( 2006 2006 'comment_post_ID' => $this->post_id, 2007 2007 'comment_approved' => '1', … … 2009 2009 ) ); 2010 2010 2011 $c4 = self:: $factory->comment->create( array(2011 $c4 = self::factory()->comment->create( array( 2012 2012 'comment_post_ID' => $this->post_id, 2013 2013 'comment_approved' => '1', … … 2015 2015 ) ); 2016 2016 2017 $c5 = self:: $factory->comment->create( array(2018 'comment_post_ID' => $this->post_id, 2019 'comment_approved' => '1', 2020 ) ); 2021 2022 $c6 = self:: $factory->comment->create( array(2017 $c5 = self::factory()->comment->create( array( 2018 'comment_post_ID' => $this->post_id, 2019 'comment_approved' => '1', 2020 ) ); 2021 2022 $c6 = self::factory()->comment->create( array( 2023 2023 'comment_post_ID' => $this->post_id, 2024 2024 'comment_approved' => '1', … … 2055 2055 */ 2056 2056 public function test_hierarchical_threaded_approved() { 2057 $c1 = self:: $factory->comment->create( array(2058 'comment_post_ID' => $this->post_id, 2059 'comment_approved' => '1', 2060 ) ); 2061 2062 $c2 = self:: $factory->comment->create( array(2057 $c1 = self::factory()->comment->create( array( 2058 'comment_post_ID' => $this->post_id, 2059 'comment_approved' => '1', 2060 ) ); 2061 2062 $c2 = self::factory()->comment->create( array( 2063 2063 'comment_post_ID' => $this->post_id, 2064 2064 'comment_approved' => '1', … … 2066 2066 ) ); 2067 2067 2068 $c3 = self:: $factory->comment->create( array(2068 $c3 = self::factory()->comment->create( array( 2069 2069 'comment_post_ID' => $this->post_id, 2070 2070 'comment_approved' => '0', … … 2072 2072 ) ); 2073 2073 2074 $c4 = self:: $factory->comment->create( array(2074 $c4 = self::factory()->comment->create( array( 2075 2075 'comment_post_ID' => $this->post_id, 2076 2076 'comment_approved' => '1', … … 2078 2078 ) ); 2079 2079 2080 $c5 = self:: $factory->comment->create( array(2081 'comment_post_ID' => $this->post_id, 2082 'comment_approved' => '1', 2083 ) ); 2084 2085 self:: $factory->comment->create( array(2080 $c5 = self::factory()->comment->create( array( 2081 'comment_post_ID' => $this->post_id, 2082 'comment_approved' => '1', 2083 ) ); 2084 2085 self::factory()->comment->create( array( 2086 2086 'comment_post_ID' => $this->post_id, 2087 2087 'comment_approved' => '1', … … 2118 2118 global $wpdb; 2119 2119 2120 $p = self:: $factory->post->create();2121 $c = self:: $factory->comment->create( array( 'comment_post_ID' => $p ) );2120 $p = self::factory()->post->create(); 2121 $c = self::factory()->comment->create( array( 'comment_post_ID' => $p ) ); 2122 2122 2123 2123 $q = new WP_Comment_Query( array( … … 2136 2136 global $wpdb; 2137 2137 2138 $p = self:: $factory->post->create();2139 $c = self:: $factory->comment->create( array( 'comment_post_ID' => $p ) );2138 $p = self::factory()->post->create(); 2139 $c = self::factory()->comment->create( array( 'comment_post_ID' => $p ) ); 2140 2140 2141 2141 $q = new WP_Comment_Query( array( -
trunk/tests/phpunit/tests/comment/slashes.php
r35225 r35242 10 10 parent::setUp(); 11 11 // we need an admin user to bypass comment flood protection 12 $this->author_id = self:: $factory->user->create( array( 'role' => 'administrator' ) );12 $this->author_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); 13 13 $this->old_current_user = get_current_user_id(); 14 14 wp_set_current_user( $this->author_id ); … … 35 35 */ 36 36 function test_wp_new_comment() { 37 $post_id = self:: $factory->post->create();37 $post_id = self::factory()->post->create(); 38 38 39 39 // not testing comment_author_email or comment_author_url … … 75 75 */ 76 76 function test_edit_comment() { 77 $post_id = self:: $factory->post->create();78 $comment_id = self:: $factory->comment->create(array(77 $post_id = self::factory()->post->create(); 78 $comment_id = self::factory()->comment->create(array( 79 79 'comment_post_ID' => $post_id 80 80 )); … … 118 118 */ 119 119 function test_wp_insert_comment() { 120 $post_id = self:: $factory->post->create();120 $post_id = self::factory()->post->create(); 121 121 122 122 $comment_id = wp_insert_comment(array( … … 146 146 */ 147 147 function test_wp_update_comment() { 148 $post_id = self:: $factory->post->create();149 $comment_id = self:: $factory->comment->create(array(148 $post_id = self::factory()->post->create(); 149 $comment_id = self::factory()->comment->create(array( 150 150 'comment_post_ID' => $post_id 151 151 )); -
trunk/tests/phpunit/tests/comment/template.php
r35225 r35242 6 6 7 7 function test_get_comments_number() { 8 $post_id = self:: $factory->post->create();8 $post_id = self::factory()->post->create(); 9 9 10 10 $this->assertEquals( 0, get_comments_number( 0 ) ); … … 12 12 $this->assertEquals( 0, get_comments_number( get_post( $post_id ) ) ); 13 13 14 self:: $factory->comment->create_post_comments( $post_id, 12 );14 self::factory()->comment->create_post_comments( $post_id, 12 ); 15 15 16 16 $this->assertEquals( 12, get_comments_number( $post_id ) ); … … 19 19 20 20 function test_get_comments_number_without_arg() { 21 $post_id = self:: $factory->post->create();21 $post_id = self::factory()->post->create(); 22 22 $permalink = get_permalink( $post_id ); 23 23 $this->go_to( $permalink ); … … 25 25 $this->assertEquals( 0, get_comments_number() ); 26 26 27 self:: $factory->comment->create_post_comments( $post_id, 12 );27 self::factory()->comment->create_post_comments( $post_id, 12 ); 28 28 $this->go_to( $permalink ); 29 29 -
trunk/tests/phpunit/tests/comment/walker.php
r35225 r35242 9 9 parent::setUp(); 10 10 11 $this->post_id = self:: $factory->post->create();11 $this->post_id = self::factory()->post->create(); 12 12 } 13 13 … … 16 16 */ 17 17 function test_has_children() { 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 ) );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 ) ); 20 20 $comment_parent = get_comment( $comment_parent ); 21 21 $comment_child = get_comment( $comment_child ); -
trunk/tests/phpunit/tests/comment/wpCountComments.php
r35225 r35242 16 16 17 17 public function test_wp_count_comments_approved() { 18 self:: $factory->comment->create( array(18 self::factory()->comment->create( array( 19 19 'comment_approved' => 1 20 20 ) ); … … 32 32 33 33 public function test_wp_count_comments_awaiting() { 34 self:: $factory->comment->create( array(34 self::factory()->comment->create( array( 35 35 'comment_approved' => 0 36 36 ) ); … … 48 48 49 49 public function test_wp_count_comments_spam() { 50 self:: $factory->comment->create( array(50 self::factory()->comment->create( array( 51 51 'comment_approved' => 'spam' 52 52 ) ); … … 64 64 65 65 public function test_wp_count_comments_trash() { 66 self:: $factory->comment->create( array(66 self::factory()->comment->create( array( 67 67 'comment_approved' => 'trash' 68 68 ) ); … … 80 80 81 81 public function test_wp_count_comments_post_trashed() { 82 self:: $factory->comment->create( array(82 self::factory()->comment->create( array( 83 83 'comment_approved' => 'post-trashed' 84 84 ) ); … … 96 96 97 97 public function test_wp_count_comments_cache() { 98 $post_id = self:: $factory->post->create( array(98 $post_id = self::factory()->post->create( array( 99 99 'post_status' => 'publish' 100 100 ) ); 101 $comment_id = self:: $factory->comment->create( array(101 $comment_id = self::factory()->comment->create( array( 102 102 'comment_approved' => '1', 103 103 'comment_post_ID' => $post_id -
trunk/tests/phpunit/tests/customize/manager.php
r35225 r35242 252 252 */ 253 253 function test_return_url() { 254 wp_set_current_user( self:: $factory->user->create( array( 'role' => 'author' ) ) );254 wp_set_current_user( self::factory()->user->create( array( 'role' => 'author' ) ) ); 255 255 $this->assertEquals( get_admin_url(), $this->manager->get_return_url() ); 256 256 257 wp_set_current_user( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );257 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 258 258 $this->assertTrue( current_user_can( 'edit_theme_options' ) ); 259 259 $this->assertEquals( admin_url( 'themes.php' ), $this->manager->get_return_url() ); … … 302 302 */ 303 303 function test_customize_pane_settings() { 304 wp_set_current_user( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );304 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 305 305 $this->manager->register_controls(); 306 306 $this->manager->prepare_controls(); -
trunk/tests/phpunit/tests/customize/nav-menu-item-setting.php
r35225 r35242 22 22 parent::setUp(); 23 23 require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; 24 wp_set_current_user( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );24 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 25 25 26 26 global $wp_customize; … … 150 150 do_action( 'customize_register', $this->wp_customize ); 151 151 152 $post_id = self:: $factory->post->create( array( 'post_title' => 'Hello World' ) );152 $post_id = self::factory()->post->create( array( 'post_title' => 'Hello World' ) ); 153 153 154 154 $menu_id = wp_create_nav_menu( 'Menu' ); … … 193 193 do_action( 'customize_register', $this->wp_customize ); 194 194 195 $tax_id = self:: $factory->category->create( array( 'name' => 'Salutations' ) );195 $tax_id = self::factory()->category->create( array( 'name' => 'Salutations' ) ); 196 196 197 197 $menu_id = wp_create_nav_menu( 'Menu' ); … … 271 271 $this->assertEquals( $post_value, $value ); 272 272 273 $post_id = self:: $factory->post->create( array( 'post_title' => 'Hello World' ) );273 $post_id = self::factory()->post->create( array( 'post_title' => 'Hello World' ) ); 274 274 $item_id = wp_update_nav_menu_item( $menu_id, 0, array( 275 275 'menu-item-type' => 'post_type', … … 297 297 do_action( 'customize_register', $this->wp_customize ); 298 298 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' ) );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' ) ); 301 301 302 302 $primary_menu_id = wp_create_nav_menu( 'Primary' ); … … 349 349 350 350 $menu_id = wp_create_nav_menu( 'Primary' ); 351 $post_id = self:: $factory->post->create( array( 'post_title' => 'Hello World' ) );351 $post_id = self::factory()->post->create( array( 'post_title' => 'Hello World' ) ); 352 352 $item_ids = array(); 353 353 for ( $i = 0; $i < 5; $i += 1 ) { … … 404 404 405 405 $menu_id = wp_create_nav_menu( 'Primary' ); 406 $post_id = self:: $factory->post->create( array( 'post_title' => 'Hello World' ) );406 $post_id = self::factory()->post->create( array( 'post_title' => 'Hello World' ) ); 407 407 $item_ids = array(); 408 408 for ( $i = 0; $i < 5; $i += 1 ) { … … 489 489 do_action( 'customize_register', $this->wp_customize ); 490 490 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' ) );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' ) ); 493 493 494 494 $primary_menu_id = wp_create_nav_menu( 'Primary' ); … … 555 555 556 556 $menu_id = wp_create_nav_menu( 'Primary' ); 557 $post_id = self:: $factory->post->create( array( 'post_title' => 'Hello World' ) );