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' ) );557 $post_id = self::factory()->post->create( array( 'post_title' => 'Hello World' ) ); 558 558 $item_ids = array(); 559 559 for ( $i = 0; $i < 5; $i += 1 ) { … … 624 624 625 625 $menu_id = wp_create_nav_menu( 'Primary' ); 626 $post_id = self:: $factory->post->create( array( 'post_title' => 'Hello World' ) );626 $post_id = self::factory()->post->create( array( 'post_title' => 'Hello World' ) ); 627 627 $item_ids = array(); 628 628 for ( $i = 0; $i < 5; $i += 1 ) { -
trunk/tests/phpunit/tests/customize/nav-menu-setting.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 27 27 global $wp_customize; -
trunk/tests/phpunit/tests/customize/nav-menus.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(); … … 125 125 126 126 // Create pages. 127 self:: $factory->post->create_many( 12, array( 'post_type' => 'page' ) );127 self::factory()->post->create_many( 12, array( 'post_type' => 'page' ) ); 128 128 129 129 // Home is included in menu items when page is zero. … … 146 146 147 147 // Create page. 148 $post_id = self:: $factory->post->create( array( 'post_title' => 'Post Title' ) );148 $post_id = self::factory()->post->create( array( 'post_title' => 'Post Title' ) ); 149 149 150 150 // Create pages. 151 self:: $factory->post->create_many( 10 );151 self::factory()->post->create_many( 10 ); 152 152 153 153 // Expected menu item array. … … 176 176 177 177 // Create page. 178 $page_id = self:: $factory->post->create( array( 'post_title' => 'Page Title', 'post_type' => 'page' ) );178 $page_id = self::factory()->post->create( array( 'post_title' => 'Page Title', 'post_type' => 'page' ) ); 179 179 180 180 // Expected menu item array. … … 202 202 203 203 // Create post. 204 $post_id = self:: $factory->post->create( array( 'post_title' => 'Post Title' ) );204 $post_id = self::factory()->post->create( array( 'post_title' => 'Post Title' ) ); 205 205 206 206 // Expected menu item array. … … 228 228 229 229 // Create term. 230 $term_id = self:: $factory->category->create( array( 'name' => 'Term Title' ) );230 $term_id = self::factory()->category->create( array( 'name' => 'Term Title' ) ); 231 231 232 232 // Expected menu item array. … … 280 280 // Create posts 281 281 $post_ids = array(); 282 $post_ids[] = self:: $factory->post->create( array( 'post_title' => 'Search & Test' ) );283 $post_ids[] = self:: $factory->post->create( array( 'post_title' => 'Some Other Title' ) );282 $post_ids[] = self::factory()->post->create( array( 'post_title' => 'Search & Test' ) ); 283 $post_ids[] = self::factory()->post->create( array( 'post_title' => 'Some Other Title' ) ); 284 284 285 285 // Create terms 286 286 $term_ids = array(); 287 $term_ids[] = self:: $factory->category->create( array( 'name' => 'Dogs Are Cool' ) );288 $term_ids[] = self:: $factory->category->create( array( 'name' => 'Cats Drool' ) );287 $term_ids[] = self::factory()->category->create( array( 'name' => 'Dogs Are Cool' ) ); 288 $term_ids[] = self::factory()->category->create( array( 'name' => 'Cats Drool' ) ); 289 289 290 290 // Test empty results … … 387 387 do_action( 'customize_register', $this->wp_customize ); 388 388 $menu_id = wp_create_nav_menu( 'Primary' ); 389 $post_id = self:: $factory->post->create( array( 'post_title' => 'Hello World' ) );389 $post_id = self::factory()->post->create( array( 'post_title' => 'Hello World' ) ); 390 390 $item_id = wp_update_nav_menu_item( $menu_id, 0, array( 391 391 'menu-item-type' => 'post_type', -
trunk/tests/phpunit/tests/customize/panel.php
r35225 r35242 129 129 */ 130 130 function test_check_capabilities() { 131 $user_id = self:: $factory->user->create( array( 'role' => 'administrator' ) );131 $user_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); 132 132 wp_set_current_user( $user_id ); 133 133 … … 155 155 */ 156 156 function test_maybe_render() { 157 wp_set_current_user( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );157 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 158 158 $panel = new WP_Customize_Panel( $this->manager, 'bar' ); 159 159 $customize_render_panel_count = did_action( 'customize_render_panel' ); … … 180 180 */ 181 181 function test_print_templates_standard() { 182 wp_set_current_user( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );182 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 183 183 184 184 $panel = new WP_Customize_Panel( $this->manager, 'baz' ); … … 198 198 */ 199 199 function test_print_templates_custom() { 200 wp_set_current_user( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );200 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 201 201 202 202 $panel = new Custom_Panel_Test( $this->manager, 'baz' ); -
trunk/tests/phpunit/tests/customize/section.php
r35225 r35242 136 136 */ 137 137 function test_check_capabilities() { 138 $user_id = self:: $factory->user->create( array( 'role' => 'administrator' ) );138 $user_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); 139 139 wp_set_current_user( $user_id ); 140 140 … … 162 162 */ 163 163 function test_maybe_render() { 164 wp_set_current_user( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );164 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 165 165 $section = new WP_Customize_Section( $this->manager, 'bar' ); 166 166 $customize_render_section_count = did_action( 'customize_render_section' ); … … 187 187 */ 188 188 function test_print_templates_standard() { 189 wp_set_current_user( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );189 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 190 190 191 191 $section = new WP_Customize_Section( $this->manager, 'baz' ); … … 202 202 */ 203 203 function test_print_templates_custom() { 204 wp_set_current_user( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );204 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 205 205 206 206 $section = new Custom_Section_Test( $this->manager, 'baz' ); -
trunk/tests/phpunit/tests/customize/setting.php
r35225 r35242 395 395 396 396 // Satisfy all requirements for save to happen. 397 wp_set_current_user( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );397 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 398 398 $this->assertTrue( false !== $setting->save() ); 399 399 $this->assertTrue( 1 === did_action( 'customize_update_custom' ) ); … … 466 466 $this->assertTrue( $setting->is_current_blog_previewed() ); 467 467 468 $blog_id = self:: $factory->blog->create();468 $blog_id = self::factory()->blog->create(); 469 469 switch_to_blog( $blog_id ); 470 470 $this->assertFalse( $setting->is_current_blog_previewed() ); -
trunk/tests/phpunit/tests/customize/widgets.php
r35236 r35242 39 39 remove_action( 'after_setup_theme', 'twentyfifteen_setup' ); // @todo We should not be including a theme anyway 40 40 41 $user_id = self:: $factory->user->create( array( 'role' => 'administrator' ) );41 $user_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); 42 42 wp_set_current_user( $user_id ); 43 43 -
trunk/tests/phpunit/tests/date/query.php
r35225 r35242 976 976 */ 977 977 public function test_validate_date_values_should_process_array_value_for_year() { 978 $p1 = self:: $factory->post->create( array( 'post_date' => '2015-01-12 00:00:00' ) );979 $p2 = self:: $factory->post->create( array( 'post_date' => '2013-01-12 00:00:00' ) );978 $p1 = self::factory()->post->create( array( 'post_date' => '2015-01-12 00:00:00' ) ); 979 $p2 = self::factory()->post->create( array( 'post_date' => '2013-01-12 00:00:00' ) ); 980 980 981 981 $q = new WP_Query( array( … … 996 996 */ 997 997 public function test_validate_date_values_should_process_array_value_for_day() { 998 $p1 = self:: $factory->post->create( array( 'post_date' => '2015-01-12 00:00:00' ) );999 $p2 = self:: $factory->post->create( array( 'post_date' => '2015-01-10 00:00:00' ) );998 $p1 = self::factory()->post->create( array( 'post_date' => '2015-01-12 00:00:00' ) ); 999 $p2 = self::factory()->post->create( array( 'post_date' => '2015-01-10 00:00:00' ) ); 1000 1000 1001 1001 $q = new WP_Query( array( … … 1017 1017 */ 1018 1018 public function test_validate_date_values_should_process_array_value_for_day_when_values_are_invalid() { 1019 $p1 = self:: $factory->post->create( array( 'post_date' => '2015-01-12 00:00:00' ) );1020 $p2 = self:: $factory->post->create( array( 'post_date' => '2015-01-10 00:00:00' ) );1019 $p1 = self::factory()->post->create( array( 'post_date' => '2015-01-12 00:00:00' ) ); 1020 $p2 = self::factory()->post->create( array( 'post_date' => '2015-01-10 00:00:00' ) ); 1021 1021 1022 1022 $q = new WP_Query( array( -
trunk/tests/phpunit/tests/db.php
r35225 r35242 510 510 } 511 511 512 $post_id = self:: $factory->post->create();512 $post_id = self::factory()->post->create(); 513 513 514 514 $this->assertNotEmpty( $wpdb->get_results( 'CALL `test_mysqli_flush_sync_procedure`' ) ); -
trunk/tests/phpunit/tests/formatting/SanitizePost.php
r35225 r35242 10 10 */ 11 11 function test_int_fields() { 12 $post = self:: $factory->post->create_and_get();12 $post = self::factory()->post->create_and_get(); 13 13 $int_fields = array( 14 14 'ID' => 'integer', -
trunk/tests/phpunit/tests/formatting/WpTrimExcerpt.php
r35225 r35242 10 10 */ 11 11 public function test_secondary_loop_respect_more() { 12 $post1 = self:: $factory->post->create( array(12 $post1 = self::factory()->post->create( array( 13 13 'post_content' => 'Post 1 Page 1<!--more-->Post 1 Page 2', 14 14 ) ); 15 $post2 = self:: $factory->post->create( array(15 $post2 = self::factory()->post->create( array( 16 16 'post_content' => 'Post 2 Page 1<!--more-->Post 2 Page 2', 17 17 ) ); … … 35 35 */ 36 36 public function test_secondary_loop_respect_nextpage() { 37 $post1 = self:: $factory->post->create( array(37 $post1 = self::factory()->post->create( array( 38 38 'post_content' => 'Post 1 Page 1<!--nextpage-->Post 1 Page 2', 39 39 ) ); 40 $post2 = self:: $factory->post->create( array(40 $post2 = self::factory()->post->create( array( 41 41 'post_content' => 'Post 2 Page 1<!--nextpage-->Post 2 Page 2', 42 42 ) ); -
trunk/tests/phpunit/tests/functions.php
r35225 r35242 690 690 $this->assertEquals( '', $actual ); 691 691 692 $GLOBALS['post'] = self:: $factory->post->create_and_get( array(692 $GLOBALS['post'] = self::factory()->post->create_and_get( array( 693 693 'post_date' => '2015-09-16 08:00:00' 694 694 ) ); -
trunk/tests/phpunit/tests/functions/getArchives.php
r35225 r35242 88 88 89 89 function test_wp_get_archives_order() { 90 self:: $factory->post->create( array( 'post_type' => 'post', 'post_author' => '1', 'post_date' => '2012-10-23 19:34:42' ) );90 self::factory()->post->create( array( 'post_type' => 'post', 'post_author' => '1', 'post_date' => '2012-10-23 19:34:42' ) ); 91 91 92 92 $date_full = date( 'F Y' ); … … 111 111 register_post_type( 'taco', array( 'public' => true ) ); 112 112 113 self:: $factory->post->create( array(113 self::factory()->post->create( array( 114 114 'post_type' => 'taco', 115 115 'post_author' => '1', -
trunk/tests/phpunit/tests/general/archives.php
r35225 r35242 17 17 global $wpdb; 18 18 19 self:: $factory->post->create_many( 3, array( 'post_type' => 'post' ) );19 self::factory()->post->create_many( 3, array( 'post_type' => 'post' ) ); 20 20 wp_cache_delete( 'last_changed', 'posts' ); 21 21 $this->assertFalse( wp_cache_get( 'last_changed', 'posts' ) ); -
trunk/tests/phpunit/tests/includes/factory.php
r35225 r35242 35 35 public function test_term_factory_create_and_get_should_return_term_object() { 36 36 register_taxonomy( 'wptests_tax', 'post' ); 37 $term = self:: $factory->term->create_and_get( array( 'taxonomy' => 'wptests_tax' ) );37 $term = self::factory()->term->create_and_get( array( 'taxonomy' => 'wptests_tax' ) ); 38 38 $this->assertInternalType( 'object', $term ); 39 39 $this->assertNotEmpty( $term->term_id ); -
trunk/tests/phpunit/tests/link.php
r35225 r35242 34 34 35 35 function test_wp_get_shortlink() { 36 $post_id = self:: $factory->post->create();37 $post_id2 = self:: $factory->post->create();36 $post_id = self::factory()->post->create(); 37 $post_id2 = self::factory()->post->create(); 38 38 39 39 // Basic case … … 78 78 79 79 function test_wp_get_shortlink_with_page() { 80 $post_id = self:: $factory->post->create( array( 'post_type' => 'page' ) );80 $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 81 81 82 82 // Basic case … … 93 93 */ 94 94 function test_wp_get_shortlink_with_home_page() { 95 $post_id = self:: $factory->post->create( array( 'post_type' => 'page' ) );95 $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 96 96 update_option( 'show_on_front', 'page' ); 97 97 update_option( 'page_on_front', $post_id ); … … 109 109 function test_get_adjacent_post() { 110 110 // Need some sample posts to test adjacency 111 $post_one = self:: $factory->post->create_and_get( array(111 $post_one = self::factory()->post->create_and_get( array( 112 112 'post_title' => 'First', 113 113 'post_date' => '2012-01-01 12:00:00' 114 114 ) ); 115 115 116 $post_two = self:: $factory->post->create_and_get( array(116 $post_two = self::factory()->post->create_and_get( array( 117 117 'post_title' => 'Second', 118 118 'post_date' => '2012-02-01 12:00:00' 119 119 ) ); 120 120 121 $post_three = self:: $factory->post->create_and_get( array(121 $post_three = self::factory()->post->create_and_get( array( 122 122 'post_title' => 'Third', 123 123 'post_date' => '2012-03-01 12:00:00' 124 124 ) ); 125 125 126 $post_four = self:: $factory->post->create_and_get( array(126 $post_four = self::factory()->post->create_and_get( array( 127 127 'post_title' => 'Fourth', 128 128 'post_date' => '2012-04-01 12:00:00' … … 184 184 $wpdb->insert( $wpdb->term_taxonomy, array( 'taxonomy' => 'foo', 'term_id' => 12345, 'description' => '' ) ); 185 185 186 $include = self:: $factory->term->create( array(186 $include = self::factory()->term->create( array( 187 187 'taxonomy' => 'category', 188 188 'name' => 'Include', 189 189 ) ); 190 $exclude = self:: $factory->category->create();191 192 $one = self:: $factory->post->create_and_get( array(190 $exclude = self::factory()->category->create(); 191 192 $one = self::factory()->post->create_and_get( array( 193 193 'post_date' => '2012-01-01 12:00:00', 194 194 'post_category' => array( $include, $exclude ), 195 195 ) ); 196 196 197 $two = self:: $factory->post->create_and_get( array(197 $two = self::factory()->post->create_and_get( array( 198 198 'post_date' => '2012-01-02 12:00:00', 199 199 'post_category' => array(), 200 200 ) ); 201 201 202 $three = self:: $factory->post->create_and_get( array(202 $three = self::factory()->post->create_and_get( array( 203 203 'post_date' => '2012-01-03 12:00:00', 204 204 'post_category' => array( $include, $exclude ), 205 205 ) ); 206 206 207 $four = self:: $factory->post->create_and_get( array(207 $four = self::factory()->post->create_and_get( array( 208 208 'post_date' => '2012-01-04 12:00:00', 209 209 'post_category' => array( $include ), 210 210 ) ); 211 211 212 $five = self:: $factory->post->create_and_get( array(212 $five = self::factory()->post->create_and_get( array( 213 213 'post_date' => '2012-01-05 12:00:00', 214 214 'post_category' => array( $include, $exclude ), … … 250 250 register_taxonomy( 'wptests_tax', 'post' ); 251 251 252 $t = self:: $factory->term->create( array(252 $t = self::factory()->term->create( array( 253 253 'taxonomy' => 'wptests_tax', 254 254 ) ); 255 255 256 $p1 = self:: $factory->post->create( array( 'post_date' => '2015-08-27 12:00:00' ) );257 $p2 = self:: $factory->post->create( array( 'post_date' => '2015-08-26 12:00:00' ) );258 $p3 = self:: $factory->post->create( array( 'post_date' => '2015-08-25 12:00:00' ) );256 $p1 = self::factory()->post->create( array( 'post_date' => '2015-08-27 12:00:00' ) ); 257 $p2 = self::factory()->post->create( array( 'post_date' => '2015-08-26 12:00:00' ) ); 258 $p3 = self::factory()->post->create( array( 'post_date' => '2015-08-25 12:00:00' ) ); 259 259 260 260 wp_set_post_terms( $p2, array( $t ), 'wptests_tax' ); … … 282 282 register_taxonomy( 'wptests_tax', 'post' ); 283 283 284 $t = self:: $factory->term->create( array(284 $t = self::factory()->term->create( array( 285 285 'taxonomy' => 'wptests_tax', 286 286 ) ); 287 287 288 $p1 = self:: $factory->post->create( array( 'post_date' => '2015-08-27 12:00:00' ) );289 $p2 = self:: $factory->post->create( array( 'post_date' => '2015-08-26 12:00:00' ) );290 $p3 = self:: $factory->post->create( array( 'post_date' => '2015-08-25 12:00:00' ) );288 $p1 = self::factory()->post->create( array( 'post_date' => '2015-08-27 12:00:00' ) ); 289 $p2 = self::factory()->post->create( array( 'post_date' => '2015-08-26 12:00:00' ) ); 290 $p3 = self::factory()->post->create( array( 'post_date' => '2015-08-25 12:00:00' ) ); 291 291 292 292 wp_set_post_terms( $p2, array( $t ), 'wptests_tax' ); … … 349 349 flush_rewrite_rules(); 350 350 351 $p = self:: $factory->post->create( array(351 $p = self::factory()->post->create( array( 352 352 'post_status' => 'publish', 353 353 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' ) ) … … 369 369 flush_rewrite_rules(); 370 370 371 $p = self:: $factory->post->create( array(371 $p = self::factory()->post->create( array( 372 372 'post_status' => 'future', 373 373 'post_type' => 'wptests_pt', … … 389 389 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 390 390 391 $attachment_id = self:: $factory->attachment->create_object( 'image.jpg', 0, array(391 $attachment_id = self::factory()->attachment->create_object( 'image.jpg', 0, array( 392 392 'post_mime_type' => 'image/jpeg', 393 393 'post_type' => 'attachment', … … 413 413 flush_rewrite_rules(); 414 414 415 $post_id = self:: $factory->post->create( array( 'post_type' => 'not_a_post_type' ) );416 417 $attachment_id = self:: $factory->attachment->create_object( 'image.jpg', $post_id, array(415 $post_id = self::factory()->post->create( array( 'post_type' => 'not_a_post_type' ) ); 416 417 $attachment_id = self::factory()->attachment->create_object( 'image.jpg', $post_id, array( 418 418 'post_mime_type' => 'image/jpeg', 419 419 'post_type' => 'attachment', -
trunk/tests/phpunit/tests/link/getAdjacentPostLink.php
r35225 r35242 11 11 public function setUp(){ 12 12 parent::setUp(); 13 $this->cat_id = self:: $factory->category->create( array( 'name' => 'other' ) );13 $this->cat_id = self::factory()->category->create( array( 'name' => 'other' ) ); 14 14 $this->post_ids = array(); 15 $this->post_ids[] = self:: $factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 05:32:29', 'category_id' => 1 ) );16 $this->post_ids[] = self:: $factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 04:32:29', 'category_id' => $this->cat_id ) );17 $this->post_ids[] = self:: $factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 03:32:29', 'category_id' => 1 ) );18 $this->post_ids[] = self:: $factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 02:32:29', 'category_id' => $this->cat_id ) );19 $this->post_ids[] = self:: $factory->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 01:32:29', 'category_id' => 1 ) );15 $this->post_ids[] = self::factory()->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 05:32:29', 'category_id' => 1 ) ); 16 $this->post_ids[] = self::factory()->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 04:32:29', 'category_id' => $this->cat_id ) ); 17 $this->post_ids[] = self::factory()->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 03:32:29', 'category_id' => 1 ) ); 18 $this->post_ids[] = self::factory()->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 02:32:29', 'category_id' => $this->cat_id ) ); 19 $this->post_ids[] = self::factory()->post->create( array( 'post_type' => 'post', 'post_date' => '2014-10-26 01:32:29', 'category_id' => 1 ) ); 20 20 21 21 //set current post (has 2 on each end) -
trunk/tests/phpunit/tests/link/getNextCommentsLink.php
r35225 r35242 9 9 10 10 public function test_page_should_respect_value_of_cpage_query_var() { 11 $p = self:: $factory->post->create();11 $p = self::factory()->post->create(); 12 12 $this->go_to( get_permalink( $p ) ); 13 13 … … 26 26 */ 27 27 public function test_page_should_default_to_1_when_no_cpage_query_var_is_found() { 28 $p = self:: $factory->post->create();28 $p = self::factory()->post->create(); 29 29 $this->go_to( get_permalink( $p ) ); 30 30 -
trunk/tests/phpunit/tests/link/getPostCommentsFeedLink.php
r35225 r35242 6 6 7 7 public function test_post_link() { 8 $post_id = self:: $factory->post->create();8 $post_id = self::factory()->post->create(); 9 9 10 10 $link = get_post_comments_feed_link( $post_id ); … … 20 20 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 21 21 22 $post_id = self:: $factory->post->create();22 $post_id = self::factory()->post->create(); 23 23 24 24 $link = get_post_comments_feed_link( $post_id ); … … 29 29 30 30 public function test_attachment_link() { 31 $post_id = self:: $factory->post->create();32 $attachment_id = self:: $factory->attachment->create_object( 'image.jpg', $post_id, array(31 $post_id = self::factory()->post->create(); 32 $attachment_id = self::factory()->attachment->create_object( 'image.jpg', $post_id, array( 33 33 'post_mime_type' => 'image/jpeg', 34 34 'post_type' => 'attachment' … … 47 47 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 48 48 49 $post_id = self:: $factory->post->create( array(49 $post_id = self::factory()->post->create( array( 50 50 'post_status' => 'publish' 51 51 ) ); 52 $attachment_id = self:: $factory->attachment->create_object( 'image.jpg', $post_id, array(52 $attachment_id = self::factory()->attachment->create_object( 'image.jpg', $post_id, array( 53 53 'post_mime_type' => 'image/jpeg', 54 54 'post_type' => 'attachment', … … 67 67 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 68 68 69 $post_id = self:: $factory->post->create();70 $attachment_id = self:: $factory->attachment->create_object( 'image.jpg', $post_id, array(69 $post_id = self::factory()->post->create(); 70 $attachment_id = self::factory()->attachment->create_object( 'image.jpg', $post_id, array( 71 71 'post_mime_type' => 'image/jpeg', 72 72 'post_type' => 'attachment' … … 80 80 81 81 public function test_unattached_link() { 82 $attachment_id = self:: $factory->attachment->create_object( 'image.jpg', 0, array(82 $attachment_id = self::factory()->attachment->create_object( 'image.jpg', 0, array( 83 83 'post_mime_type' => 'image/jpeg', 84 84 'post_type' => 'attachment' … … 97 97 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 98 98 99 $attachment_id = self:: $factory->attachment->create_object( 'image.jpg', 0, array(99 $attachment_id = self::factory()->attachment->create_object( 'image.jpg', 0, array( 100 100 'post_mime_type' => 'image/jpeg', 101 101 'post_type' => 'attachment' -
trunk/tests/phpunit/tests/link/getPreviousCommentsLink.php
r35225 r35242 9 9 10 10 public function test_page_should_respect_value_of_cpage_query_var() { 11 $p = self:: $factory->post->create();11 $p = self::factory()->post->create(); 12 12 $this->go_to( get_permalink( $p ) ); 13 13 … … 23 23 24 24 public function test_page_should_default_to_1_when_no_cpage_query_var_is_found() { 25 $p = self:: $factory->post->create();25 $p = self::factory()->post->create(); 26 26 $this->go_to( get_permalink( $p ) ); 27 27 -
trunk/tests/phpunit/tests/media.php
r35225 r35242 237 237 */ 238 238 function test_get_attached_images() { 239 $post_id = self:: $factory->post->create();240 $attachment_id = self:: $factory->attachment->create_object( $this->img_name, $post_id, array(239 $post_id = self::factory()->post->create(); 240 $attachment_id = self::factory()->attachment->create_object( $this->img_name, $post_id, array( 241 241 'post_mime_type' => 'image/jpeg', 242 242 'post_type' => 'attachment' … … 254 254 $ids1_srcs = array(); 255 255 foreach ( range( 1, 3 ) as $i ) { 256 $attachment_id = self:: $factory->attachment->create_object( "image$i.jpg", 0, array(256 $attachment_id = self::factory()->attachment->create_object( "image$i.jpg", 0, array( 257 257 'post_mime_type' => 'image/jpeg', 258 258 'post_type' => 'attachment' … … 267 267 $ids2_srcs = array(); 268 268 foreach ( range( 4, 6 ) as $i ) { 269 $attachment_id = self:: $factory->attachment->create_object( "image$i.jpg", 0, array(269 $attachment_id = self::factory()->attachment->create_object( "image$i.jpg", 0, array( 270 270 'post_mime_type' => 'image/jpeg', 271 271 'post_type' => 'attachment' … … 285 285 [gallery ids="$ids2_joined"] 286 286 BLOB; 287 $post_id = self:: $factory->post->create( array( 'post_content' => $blob ) );287 $post_id = self::factory()->post->create( array( 'post_content' => $blob ) ); 288 288 $srcs = get_post_galleries_images( $post_id ); 289 289 $this->assertEquals( $srcs, array( $ids1_srcs, $ids2_srcs ) ); … … 297 297 $ids1_srcs = array(); 298 298 foreach ( range( 1, 3 ) as $i ) { 299 $attachment_id = self:: $factory->attachment->create_object( "image$i.jpg", 0, array(299 $attachment_id = self::factory()->attachment->create_object( "image$i.jpg", 0, array( 300 300 'post_mime_type' => 'image/jpeg', 301 301 'post_type' => 'attachment' … … 310 310 $ids2_srcs = array(); 311 311 foreach ( range( 4, 6 ) as $i ) { 312 $attachment_id = self:: $factory->attachment->create_object( "image$i.jpg", 0, array(312 $attachment_id = self::factory()->attachment->create_object( "image$i.jpg", 0, array( 313 313 'post_mime_type' => 'image/jpeg', 314 314 'post_type' => 'attachment' … … 328 328 [gallery ids="$ids2_joined"] 329 329 BLOB; 330 $post_id = self:: $factory->post->create( array( 'post_content' => $blob ) );330 $post_id = self::factory()->post->create( array( 'post_content' => $blob ) ); 331 331 $srcs = get_post_gallery_images( $post_id ); 332 332 $this->assertEquals( $srcs, $ids1_srcs ); … … 506 506 function test_attachment_url_to_postid() { 507 507 $image_path = '2014/11/' . $this->img_name; 508 $attachment_id = self:: $factory->attachment->create_object( $image_path, 0, array(508 $attachment_id = self::factory()->attachment->create_object( $image_path, 0, array( 509 509 'post_mime_type' => 'image/jpeg', 510 510 'post_type' => 'attachment', … … 517 517 function test_attachment_url_to_postid_schemes() { 518 518 $image_path = '2014/11/' . $this->img_name; 519 $attachment_id = self:: $factory->attachment->create_object( $image_path, 0, array(519 $attachment_id = self::factory()->attachment->create_object( $image_path, 0, array( 520 520 'post_mime_type' => 'image/jpeg', 521 521 'post_type' => 'attachment', … … 531 531 function test_attachment_url_to_postid_filtered() { 532 532 $image_path = '2014/11/' . $this->img_name; 533 $attachment_id = self:: $factory->attachment->create_object( $image_path, 0, array(533 $attachment_id = self::factory()->attachment->create_object( $image_path, 0, array( 534 534 'post_mime_type' => 'image/jpeg', 535 535 'post_type' => 'attachment', … … 705 705 $this->assertFalse( wp_get_attachment_image_url( 0 ) ); 706 706 707 $post_id = self:: $factory->post->create();708 $attachment_id = self:: $factory->attachment->create_object( $this->img_name, $post_id, array(707 $post_id = self::factory()->post->create(); 708 $attachment_id = self::factory()->attachment->create_object( $this->img_name, $post_id, array( 709 709 'post_mime_type' => 'image/jpeg', 710 710 'post_type' => 'attachment', … … 761 761 // Make an image. 762 762 $filename = DIR_TESTDATA . '/images/test-image-large.png'; 763 $id = self:: $factory->attachment->create_upload_object( $filename );763 $id = self::factory()->attachment->create_upload_object( $filename ); 764 764 765 765 $image = wp_get_attachment_metadata( $id ); -
trunk/tests/phpunit/tests/meta.php
r35225 r35242 9 9 function setUp() { 10 10 parent::setUp(); 11 $this->author = new WP_User( self:: $factory->user->create( array( 'role' => 'author' ) ) );11 $this->author = new WP_User( self::factory()->user->create( array( 'role' => 'author' ) ) ); 12 12 $this->meta_id = add_metadata( 'user', $this->author->ID, 'meta_key', 'meta_value' ); 13 13 $this->delete_meta_id = add_metadata( 'user', $this->author->ID, 'delete_meta_key', 'delete_meta_value' ); … … 195 195 */ 196 196 function test_meta_type_cast() { 197 $post_id1 = self:: $factory->post->create();197 $post_id1 = self::factory()->post->create(); 198 198 add_post_meta( $post_id1, 'num_as_longtext', 123 ); 199 199 add_post_meta( $post_id1, 'num_as_longtext_desc', 10 ); 200 $post_id2 = self:: $factory->post->create();200 $post_id2 = self::factory()->post->create(); 201 201 add_post_meta( $post_id2, 'num_as_longtext', 99 ); 202 202 add_post_meta( $post_id2, 'num_as_longtext_desc', 100 ); … … 259 259 260 260 function test_meta_cache_order_asc() { 261 $post_id = self:: $factory->post->create();261 $post_id = self::factory()->post->create(); 262 262 $colors = array( 'red', 'blue', 'yellow', 'green' ); 263 263 foreach ( $colors as $color ) -
trunk/tests/phpunit/tests/meta/slashes.php
r35225 r35242 9 9 function setUp() { 10 10 parent::setUp(); 11 $this->author_id = self:: $factory->user->create( array( 'role' => 'editor' ) );12 $this->post_id = self:: $factory->post->create();11 $this->author_id = self::factory()->user->create( array( 'role' => 'editor' ) ); 12 $this->post_id = self::factory()->post->create(); 13 13 $this->old_current_user = get_current_user_id(); 14 14 wp_set_current_user( $this->author_id ); … … 33 33 */ 34 34 function test_edit_post() { 35 $id = self:: $factory->post->create();35 $id = self::factory()->post->create(); 36 36 if ( function_exists( 'wp_add_post_meta' ) ) { 37 37 $meta_1 = wp_add_post_meta( $id, 'slash_test_1', 'foo' ); … … 109 109 */ 110 110 function test_add_post_meta() { 111 $id = self:: $factory->post->create();111 $id = self::factory()->post->create(); 112 112 add_post_meta( $id, 'slash_test_1', addslashes( $this->slash_1 ) ); 113 113 add_post_meta( $id, 'slash_test_2', addslashes( $this->slash_3 ) ); … … 124 124 */ 125 125 function test_update_post_meta() { 126 $id = self:: $factory->post->create();126 $id = self::factory()->post->create(); 127 127 update_post_meta( $id, 'slash_test_1', addslashes( $this->slash_1 ) ); 128 128 update_post_meta( $id, 'slash_test_2', addslashes( $this->slash_3 ) ); … … 142 142 return; 143 143 } 144 $id = self:: $factory->post->create();144 $id = self::factory()->post->create(); 145 145 wp_add_post_meta( $id, 'slash_test_1', $this->slash_1 ); 146 146 wp_add_post_meta( $id, 'slash_test_2', $this->slash_3 ); … … 160 160 return; 161 161 } 162 $id = self:: $factory->post->create();162 $id = self::factory()->post->create(); 163 163 wp_update_post_meta( $id, 'slash_test_1', $this->slash_1 ); 164 164 wp_update_post_meta( $id, 'slash_test_2', $this->slash_3 ); … … 175 175 */ 176 176 function test_add_comment_meta() { 177 $id = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );177 $id = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id ) ); 178 178 179 179 add_comment_meta( $id, 'slash_test_1', $this->slash_1 ); … … 199 199 */ 200 200 function test_update_comment_meta() { 201 $id = self:: $factory->comment->create( array( 'comment_post_ID' => $this->post_id ) );201 $id = self::factory()->comment->create( array( 'comment_post_ID' => $this->post_id ) ); 202 202 203 203 add_comment_meta( $id, 'slash_test_1', 'foo' ); … … 227 227 */ 228 228 function test_add_user_meta() { 229 $id = self:: $factory->user->create();229 $id = self::factory()->user->create(); 230 230 231 231 add_user_meta( $id, 'slash_test_1', $this->slash_1 ); … … 251 251 */ 252 252 function test_update_user_meta() { 253 $id = self:: $factory->user->create();253 $id = self::factory()->user->create(); 254 254 255 255 add_user_meta( $id, 'slash_test_1', 'foo' ); -
trunk/tests/phpunit/tests/multisite/bootstrap.php
r35225 r35242 41 41 42 42 foreach ( $ids as &$id ) { 43 $id = self:: $factory->network->create( $id );43 $id = self::factory()->network->create( $id ); 44 44 } 45 45 unset( $id ); … … 89 89 90 90 foreach ( $ids as &$id ) { 91 $id = self:: $factory->blog->create( $id );91 $id = self::factory()->blog->create( $id ); 92 92 } 93 93 unset( $id ); … … 170 170 171 171 foreach ( $network_ids as &$id ) { 172 $id = self:: $factory->network->create( $id );172 $id = self::factory()->network->create( $id ); 173 173 } 174 174 unset( $id ); … … 183 183 184 184 foreach ( $ids as &$id ) { 185 $id = self:: $factory->blog->create( $id );185 $id = self::factory()->blog->create( $id ); 186 186 } 187 187 unset( $id ); -
trunk/tests/phpunit/tests/multisite/getSpaceUsed.php
r35225 r35242 23 23 24 24 function test_get_space_used_switched_site() { 25 $blog_id = self:: $factory->blog->create();25 $blog_id = self::factory()->blog->create(); 26 26 switch_to_blog( $blog_id ); 27 27 … … 31 31 while ( 0 != get_space_used() ) { 32 32 restore_current_blog(); 33 $blog_id = self:: $factory->blog->create();33 $blog_id = self::factory()->blog->create(); 34 34 switch_to_blog( $blog_id ); 35 35 } … … 59 59 $space_used = get_space_used(); 60 60 61 $blog_id = self:: $factory->blog->create();61 $blog_id = self::factory()->blog->create(); 62 62 switch_to_blog( $blog_id ); 63 63 … … 67 67 while ( 0 != get_space_used() ) { 68 68 restore_current_blog(); 69 $blog_id = self:: $factory->blog->create();69 $blog_id = self::factory()->blog->create(); 70 70 switch_to_blog( $blog_id ); 71 71 } -
trunk/tests/phpunit/tests/multisite/ms-files-rewriting.php
r35225 r35242 38 38 $site = get_current_site(); 39 39 40 $user_id = self:: $factory->user->create( array( 'role' => 'administrator' ) );41 $blog_id2 = self:: $factory->blog->create( array( 'user_id' => $user_id ) );40 $user_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); 41 $blog_id2 = self::factory()->blog->create( array( 'user_id' => $user_id ) ); 42 42 $info = wp_upload_dir(); 43 43 $this->assertEquals( 'http://' . $site->domain . '/wp-content/uploads/' . gmstrftime('%Y/%m'), $info['url'] ); … … 68 68 $file1 = wp_upload_bits( $filename, null, $contents ); 69 69 70 $blog_id = self:: $factory->blog->create();70 $blog_id = self::factory()->blog->create(); 71 71 72 72 switch_to_blog( $blog_id ); -
trunk/tests/phpunit/tests/multisite/network.php
r35225 r35242 38 38 */ 39 39 function test_get_main_network_id_two_networks() { 40 self:: $factory->network->create();40 self::factory()->network->create(); 41 41 42 42 $this->assertEquals( 1, get_main_network_id() ); … … 50 50 global $current_site; 51 51 52 $id = self:: $factory->network->create();52 $id = self::factory()->network->create(); 53 53 54 54 $current_site->id = (int) $id; … … 66 66 function test_get_main_network_id_after_network_delete() { 67 67 global $wpdb, $current_site; 68 $id = self:: $factory->network->create();68 $id = self::factory()->network->create(); 69 69 70 70 $current_site->id = (int) $id; … … 91 91 // false for large networks by default 92 92 add_filter( 'enable_live_network_counts', '__return_false' ); 93 self:: $factory->blog->create_many( 4 );93 self::factory()->blog->create_many( 4 ); 94 94 95 95 // count only updated when cron runs, so unchanged … … 97 97 98 98 add_filter( 'enable_live_network_counts', '__return_true' ); 99 $site_ids = self:: $factory->blog->create_many( 4 );99 $site_ids = self::factory()->blog->create_many( 4 ); 100 100 101 101 $this->assertEquals( $site_count_start + 9, (int) get_blog_count() ); … … 212 212 // Only false for large networks as of 3.7 213 213 add_filter( 'enable_live_network_counts', '__return_false' ); 214 self:: $factory->user->create( array( 'role' => 'administrator' ) );214 self::factory()->user->create( array( 'role' => 'administrator' ) ); 215 215 216 216 $count = get_user_count(); // No change, cache not refreshed … … 241 241 $this->assertEquals( 1, $dashboard_blog->blog_id ); 242 242 243 $user_id = self:: $factory->user->create( array( 'role' => 'administrator' ) );244 $blog_id = self:: $factory->blog->create( array( 'user_id' => $user_id ) );243 $user_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); 244 $blog_id = self::factory()->blog->create( array( 'user_id' => $user_id ) ); 245 245 $this->assertInternalType( 'int', $blog_id ); 246 246 -
trunk/tests/phpunit/tests/multisite/site.php
r35225 r35242 35 35 $this->assertEquals( $current_blog_id, wp_cache_get( 'switch-test', 'switch-test' ) ); 36 36 37 $blog_id = self:: $factory->blog->create();37 $blog_id = self::factory()->blog->create(); 38 38 39 39 $cap_key = wp_get_current_user()->cap_key; … … 75 75 global $wpdb; 76 76 77 $blog_id = self:: $factory->blog->create();77 $blog_id = self::factory()->blog->create(); 78 78 79 79 $this->assertInternalType( 'int', $blog_id ); … … 131 131 */ 132 132 function test_data_in_cache_after_wpmu_delete_blog_drop_false() { 133 $blog_id = self:: $factory->blog->create();133 $blog_id = self::factory()->blog->create(); 134 134 135 135 $details = get_blog_details( $blog_id, false ); … … 152 152 global $wpdb; 153 153 154 $blog_id = self:: $factory->blog->create();154 $blog_id = self::factory()->blog->create(); 155 155 156 156 // Delete the site without forcing a table drop. … … 170 170 */ 171 171 function test_data_in_cache_after_wpmu_delete_blog_drop_true() { 172 $blog_id = self:: $factory->blog->create();172 $blog_id = self::factory()->blog->create(); 173 173 174 174 $details = get_blog_details( $blog_id, false ); … … 191 191 global $wpdb; 192 192 193 $blog_id = self:: $factory->blog->create();193 $blog_id = self::factory()->blog->create(); 194 194 195 195 // Delete the site and force a table drop. … … 248 248 */ 249 249 function test_network_count_after_wpmu_delete_blog_drop_false() { 250 $blog_id = self:: $factory->blog->create();250 $blog_id = self::factory()->blog->create(); 251 251 252 252 // Delete the site without forcing a table drop. … … 262 262 */ 263 263 function test_blog_count_after_wpmu_delete_blog_drop_true() { 264 $blog_id = self:: $factory->blog->create();264 $blog_id = self::factory()->blog->create(); 265 265 266 266 // Delete the site and force a table drop. … … 284 284 $file1 = wp_upload_bits( $filename, null, $contents ); 285 285 286 $blog_id = self:: $factory->blog->create();286 $blog_id = self::factory()->blog->create(); 287 287 288 288 switch_to_blog( $blog_id ); … … 330 330 function test_get_blog_details_when_site_does_not_exist() { 331 331 // Create an unused site so that we can then assume an invalid site ID. 332 $blog_id = self:: $factory->blog->create();332 $blog_id = self::factory()->blog->create(); 333 333 $blog_id++; 334 334 … … 340 340 341 341 // Create a site in the invalid site's place. 342 self:: $factory->blog->create();342 self::factory()->blog->create(); 343 343 344 344 // When a new site is created, its cache is cleared through refresh_blog_details. … … 371 371 $test_action_counter = 0; 372 372 373 $blog_id = self:: $factory->blog->create();373 $blog_id = self::factory()->blog->create(); 374 374 update_blog_details( $blog_id, array( 'spam' => 1 ) ); 375 375 … … 395 395 $test_action_counter = 0; 396 396 397 $blog_id = self:: $factory->blog->create();397 $blog_id = self::factory()->blog->create(); 398 398 399 399 add_action( 'make_spam_blog', array( $this, '_action_counter_cb' ), 10 ); … … 418 418 $test_action_counter = 0; 419 419 420 $blog_id = self:: $factory->blog->create();420 $blog_id = self::factory()->blog->create(); 421 421 422 422 add_action( 'archive_blog', array( $this, '_action_counter_cb' ), 10 ); … … 441 441 $test_action_counter = 0; 442 442 443 $blog_id = self:: $factory->blog->create();443 $blog_id = self::factory()->blog->create(); 444 444 update_blog_details( $blog_id, array( 'archived' => 1 ) ); 445 445 … … 464 464 $test_action_counter = 0; 465 465 466 $blog_id = self:: $factory->blog->create();466 $blog_id = self::factory()->blog->create(); 467 467 468 468 add_action( 'make_delete_blog', array( $this, '_action_counter_cb' ), 10 ); … … 487 487 $test_action_counter = 0; 488 488 489 $blog_id = self:: $factory->blog->create();489 $blog_id = self::factory()->blog->create(); 490 490 update_blog_details( $blog_id, array( 'deleted' => 1 ) ); 491 491 … … 511 511 $test_action_counter = 0; 512 512 513 $blog_id = self:: $factory->blog->create();513 $blog_id = self::factory()->blog->create(); 514 514 515 515 add_action( 'mature_blog', array( $this, '_action_counter_cb' ), 10 ); … … 534 534 $test_action_counter = 0; 535 535 536 $blog_id = self:: $factory->blog->create();536 $blog_id = self::factory()->blog->create(); 537 537 update_blog_details( $blog_id, array( 'mature' => 1 ) ); 538 538 … … 558 558 $test_action_counter = 0; 559 559 560 $blog_id = self:: $factory->blog->create();560 $blog_id = self::factory()->blog->create(); 561 561 562 562 add_action( 'update_blog_public', array( $this, '_action_counter_cb' ), 10 ); … … 584 584 */ 585 585 function test_wp_get_sites_with_default_arguments() { 586 self:: $factory->blog->create( array( 'site_id' => 2 ) );586 self::factory()->blog->create( array( 'site_id' => 2 ) ); 587 587 588 588 $this->assertCount( 1, wp_get_sites() ); … … 600 600 */ 601 601 function test_wp_get_sites_with_network_id_null() { 602 self:: $factory->blog->create( array( 'site_id' => 2 ) );602 self::factory()->blog->create( array( 'site_id' => 2 ) ); 603 603 604 604 $this->assertCount( 2, wp_get_sites( array( 'network_id' => null ) ) ); … … 609 609 */ 610 610 function test_wp_get_sites_with_specific_network_id() { 611 self:: $factory->blog->create( array( 'site_id' => 2 ) );611 self::factory()->blog->create( array( 'site_id' => 2 ) ); 612 612 613 613 $this->assertCount( 1, wp_get_sites( array( 'network_id' => 2 ) ) ); … … 618 618 */ 619 619 function test_wp_get_sites_with_multiple_network_ids() { 620 self:: $factory->blog->create( array( 'site_id' => 2 ) );620 self::factory()->blog->create( array( 'site_id' => 2 ) ); 621 621 622 622 $this->assertCount( 2, wp_get_sites( array( 'network_id' => array( 1, 2 ) ) ) ); … … 627 627 */ 628 628 function test_wp_get_sites_with_public_meta_on_all_networks() { 629 self:: $factory->blog->create( array( 'site_id' => 2, 'meta' => array( 'public' => 0 ) ) );629 self::factory()->blog->create( array( 'site_id' => 2, 'meta' => array( 'public' => 0 ) ) ); 630 630 631 631 $this->assertCount( 1, wp_get_sites( array( 'public' => 1, 'network_id' => null ) ) ); … … 637 637 */ 638 638 function test_wp_get_sites_with_public_meta_restrict_to_one_network() { 639 self:: $factory->blog->create( array( 'site_id' => 1, 'meta' => array( 'public' => 0 ) ) );639 self::factory()->blog->create( array( 'site_id' => 1, 'meta' => array( 'public' => 0 ) ) ); 640 640 641 641 $this->assertCount( 1, wp_get_sites( array( 'public' => 1, 'network_id' => 1 ) ) ); … … 648 648 function test_wp_get_sites_limit_offset() { 649 649 // Create 2 more sites (in addition to the default one) 650 self:: $factory->blog->create_many( 2 );650 self::factory()->blog->create_many( 2 ); 651 651 652 652 // Expect first 2 sites when using limit … … 671 671 */ 672 672 function test_posts_count() { 673 self:: $factory->post->create();674 $post2 = self:: $factory->post->create();673 self::factory()->post->create(); 674 $post2 = self::factory()->post->create(); 675 675 $this->assertEquals( 2, get_blog_details()->post_count ); 676 676 … … 702 702 703 703 foreach ( $network_ids as &$id ) { 704 $id = self:: $factory->network->create( $id );704 $id = self::factory()->network->create( $id ); 705 705 } 706 706 unset( $id ); … … 715 715 716 716 foreach ( $ids as &$id ) { 717 $id = self:: $factory->blog->create( $id );717 $id = self::factory()->blog->create( $id ); 718 718 } 719 719 unset( $id ); … … 773 773 */ 774 774 function test_get_blog_id_from_url() { 775 $blog_id = self:: $factory->blog->create();775 $blog_id = self::factory()->blog->create(); 776 776 $details = get_blog_details( $blog_id, false ); 777 777 $key = md5( $details->domain . $details->path ); … … 786 786 */ 787 787 function test_get_blog_id_from_url_is_case_insensitive() { 788 $blog_id = self:: $factory->blog->create( array( 'domain' => 'example.com', 'path' => '/xyz' ) );788 $blog_id = self::factory()->blog->create( array( 'domain' => 'example.com', 'path' => '/xyz' ) ); 789 789 $details = get_blog_details( $blog_id, false ); 790 790 … … 796 796 */ 797 797 function test_get_blog_id_from_url_that_does_not_exist() { 798 $blog_id = self:: $factory->blog->create( array( 'path' => '/xyz' ) );798 $blog_id = self::factory()->blog->create( array( 'path' => '/xyz' ) ); 799 799 $details = get_blog_details( $blog_id, false ); 800 800 … … 808 808 */ 809 809 function test_get_blog_id_from_url_with_deleted_flag() { 810 $blog_id = self:: $factory->blog->create();810 $blog_id = self::factory()->blog->create(); 811 811 $details = get_blog_details( $blog_id, false ); 812 812 $key = md5( $details->domain . $details->path ); … … 822 822 */ 823 823 function test_get_blog_id_from_url_after_dropped() { 824 $blog_id = self:: $factory->blog->create();824 $blog_id = self::factory()->blog->create(); 825 825 $details = get_blog_details( $blog_id, false ); 826 826 $key = md5( $details->domain . $details->path ); … … 851 851 */ 852 852 function test_is_main_site_is_false_with_other_blog_id() { 853 $blog_id = self:: $factory->blog->create();853 $blog_id = self::factory()->blog->create(); 854 854 855 855 $this->assertFalse( is_main_site( $blog_id ) ); … … 860 860 */ 861 861 function test_is_main_site_is_false_after_switch_to_blog() { 862 $blog_id = self:: $factory->blog->create();862 $blog_id = self::factory()->blog->create(); 863 863 switch_to_blog( $blog_id ); 864 864 … … 879 879 $this->assertEquals( '', $info['error'] ); 880 880 881 $blog_id = self:: $factory->blog->create();881 $blog_id = self::factory()->blog->create(); 882 882 883 883 switch_to_blog( $blog_id ); … … 901 901 */ 902 902 function test_get_blog_post_from_another_site_on_network() { 903 $blog_id = self:: $factory->blog->create();904 $post_id = self:: $factory->post->create(); // Create a post on the primary site, ID 1.903 $blog_id = self::factory()->blog->create(); 904 $post_id = self::factory()->post->create(); // Create a post on the primary site, ID 1. 905 905 $post = get_post( $post_id ); 906 906 switch_to_blog( $blog_id ); … … 916 916 */ 917 917 function test_get_blog_post_from_same_site() { 918 $post_id = self:: $factory->post->create();918 $post_id = self::factory()->post->create(); 919 919 920 920 $this->assertEquals( get_blog_post( 1, $post_id ), get_post( $post_id ) ); -
trunk/tests/phpunit/tests/multisite/updateBlogDetails.php
r35225 r35242 26 26 27 27 function test_update_blog_details() { 28 $blog_id = self:: $factory->blog->create();28 $blog_id = self::factory()->blog->create(); 29 29 30 30 $result = update_blog_details( $blog_id, array( 'domain' => 'example.com', 'path' => 'my_path/' ) ); … … 54 54 $test_action_counter = 0; 55 55 56 $blog_id = self:: $factory->blog->create();56 $blog_id = self::factory()->blog->create(); 57 57 58 58 // Set an initial value of '1' for the flag when '0' is the flag value being tested. -
trunk/tests/phpunit/tests/multisite/wpmuValidateUserSignup.php
r35225 r35242 64 64 65 65 public function test_should_fail_for_existing_user_name() { 66 $u = self:: $factory->user->create( array( 'user_login' => 'foo123' ) );66 $u = self::factory()->user->create( array( 'user_login' => 'foo123' ) ); 67 67 $v = wpmu_validate_user_signup( 'foo123', 'foo@example.com' ); 68 68 $this->assertContains( 'user_name', $v['errors']->get_error_codes() ); … … 70 70 71 71 public function test_should_fail_for_existing_user_email() { 72 $u = self:: $factory->user->create( array( 'user_email' => 'foo@example.com' ) );72 $u = self::factory()->user->create( array( 'user_email' => 'foo@example.com' ) ); 73 73 $v = wpmu_validate_user_signup( 'foo123', 'foo@example.com' ); 74 74 $this->assertContains( 'user_email', $v['errors']->get_error_codes() ); -
trunk/tests/phpunit/tests/oembed/controller.php
r35225 r35242 18 18 19 19 function test_request_json() { 20 $user = self:: $factory->user->create_and_get( array(21 'display_name' => 'John Doe', 22 ) ); 23 $post = self:: $factory->post->create_and_get( array(20 $user = self::factory()->user->create_and_get( array( 21 'display_name' => 'John Doe', 22 ) ); 23 $post = self::factory()->post->create_and_get( array( 24 24 'post_author' => $user->ID, 25 25 'post_title' => 'Hello World', … … 61 61 62 62 function test_request_jsonp() { 63 $user = self:: $factory->user->create_and_get( array(64 'display_name' => 'John Doe', 65 ) ); 66 $post = self:: $factory->post->create_and_get( array(63 $user = self::factory()->user->create_and_get( array( 64 'display_name' => 'John Doe', 65 ) ); 66 $post = self::factory()->post->create_and_get( array( 67 67 'post_author' => $user->ID, 68 68 'post_title' => 'Hello World', … … 84 84 85 85 function test_request_jsonp_invalid_callback() { 86 $user = self:: $factory->user->create_and_get( array(87 'display_name' => 'John Doe', 88 ) ); 89 $post = self:: $factory->post->create_and_get( array(86 $user = self::factory()->user->create_and_get( array( 87 'display_name' => 'John Doe', 88 ) ); 89 $post = self::factory()->post->create_and_get( array( 90 90 'post_author' => $user->ID, 91 91 'post_title' => 'Hello World', … … 119 119 120 120 function test_request_xml() { 121 $user = self:: $factory->user->create_and_get( array(122 'display_name' => 'John Doe', 123 ) ); 124 $post = self:: $factory->post->create_and_get( array(121 $user = self::factory()->user->create_and_get( array( 122 'display_name' => 'John Doe', 123 ) ); 124 $post = self::factory()->post->create_and_get( array( 125 125 'post_author' => $user->ID, 126 126 'post_title' => 'Hello World', … … 178 178 } 179 179 180 $child = self:: $factory->blog->create();180 $child = self::factory()->blog->create(); 181 181 182 182 switch_to_blog( $child ); 183 183 184 $post = self:: $factory->post->create_and_get( array(184 $post = self::factory()->post->create_and_get( array( 185 185 'post_title' => 'Hello Child Blog', 186 186 ) ); … … 208 208 $this->assertEquals( home_url() . '/?oembed=true', get_oembed_endpoint_url( '', 'xml' ) ); 209 209 210 $post_id = self:: $factory->post->create();210 $post_id = self::factory()->post->create(); 211 211 $url = get_permalink( $post_id ); 212 212 $url_encoded = urlencode( $url ); -
trunk/tests/phpunit/tests/oembed/discovery.php
r35225 r35242 13 13 14 14 function test_add_oembed_discovery_links_to_post() { 15 $post_id = self:: $factory->post->create();15 $post_id = self::factory()->post->create(); 16 16 $this->go_to( get_permalink( $post_id ) ); 17 17 … … 29 29 30 30 function test_add_oembed_discovery_links_to_page() { 31 $post_id = self:: $factory->post->create( array(31 $post_id = self::factory()->post->create( array( 32 32 'post_type' => 'page' 33 33 )); … … 47 47 48 48 function test_add_oembed_discovery_links_to_attachment() { 49 $post_id = self:: $factory->post->create();49 $post_id = self::factory()->post->create(); 50 50 $file = DIR_TESTDATA . '/images/canola.jpg'; 51 $attachment_id = self:: $factory->attachment->create_object( $file, $post_id, array(51 $attachment_id = self::factory()->attachment->create_object( $file, $post_id, array( 52 52 'post_mime_type' => 'image/jpeg', 53 53 ) ); -
trunk/tests/phpunit/tests/oembed/getResponseData.php
r35225 r35242 10 10 11 11 function test_get_oembed_response_data() { 12 $post = self:: $factory->post->create_and_get( array(12 $post = self::factory()->post->create_and_get( array( 13 13 'post_title' => 'Some Post', 14 14 ) ); … … 34 34 */ 35 35 function test_get_oembed_response_data_author() { 36 $user_id = self:: $factory->user->create( array(36 $user_id = self::factory()->user->create( array( 37 37 'display_name' => 'John Doe', 38 38 ) ); 39 39 40 $post = self:: $factory->post->create_and_get( array(40 $post = self::factory()->post->create_and_get( array( 41 41 'post_title' => 'Some Post', 42 42 'post_author' => $user_id, … … 62 62 remove_filter( 'oembed_response_data', 'get_oembed_response_data_rich' ); 63 63 64 $post = self:: $factory->post->create_and_get( array(64 $post = self::factory()->post->create_and_get( array( 65 65 'post_title' => 'Some Post', 66 66 ) ); … … 82 82 83 83 function test_get_oembed_response_data_with_draft_post() { 84 $post = self:: $factory->post->create_and_get( array(84 $post = self::factory()->post->create_and_get( array( 85 85 'post_status' => 'draft', 86 86 ) ); … … 90 90 91 91 function test_get_oembed_response_data_with_scheduled_post() { 92 $post = self:: $factory->post->create_and_get( array(92 $post = self::factory()->post->create_and_get( array( 93 93 'post_status' => 'future', 94 94 'post_date' => strftime( '%Y-%m-%d %H:%M:%S', strtotime( '+1 day' ) ), … … 99 99 100 100 function test_get_oembed_response_data_with_private_post() { 101 $post = self:: $factory->post->create_and_get( array(101 $post = self::factory()->post->create_and_get( array( 102 102 'post_status' => 'private', 103 103 ) ); … … 107 107 108 108 function test_get_oembed_response_data_maxwidth_too_high() { 109 $post = self:: $factory->post->create_and_get();109 $post = self::factory()->post->create_and_get(); 110 110 111 111 $data = get_oembed_response_data( $post, 1000 ); … … 116 116 117 117 function test_get_oembed_response_data_maxwidth_too_low() { 118 $post = self:: $factory->post->create_and_get();118 $post = self::factory()->post->create_and_get(); 119 119 120 120 $data = get_oembed_response_data( $post, 100 ); … … 125 125 126 126 function test_get_oembed_response_data_maxwidth_invalid() { 127 $post = self:: $factory->post->create_and_get();127 $post = self::factory()->post->create_and_get(); 128 128 129 129 $data = get_oembed_response_data( $post, '400;" DROP TABLES' ); … … 139 139 140 140 function test_get_oembed_response_data_with_thumbnail() { 141 $post = self:: $factory->post->create_and_get();141 $post = self::factory()->post->create_and_get(); 142 142 $file = DIR_TESTDATA . '/images/canola.jpg'; 143 $attachment_id = self:: $factory->attachment->create_object( $file, $post->ID, array(143 $attachment_id = self::factory()->attachment->create_object( $file, $post->ID, array( 144 144 'post_mime_type' => 'image/jpeg', 145 145 ) ); … … 155 155 156 156 function test_get_oembed_response_data_for_attachment() { 157 $parent = self:: $factory->post->create();157 $parent = self::factory()->post->create(); 158 158 $file = DIR_TESTDATA . '/images/canola.jpg'; 159 $post = self:: $factory->attachment->create_object( $file, $parent, array(159 $post = self::factory()->attachment->create_object( $file, $parent, array( 160 160 'post_mime_type' => 'image/jpeg', 161 161 ) ); -
trunk/tests/phpunit/tests/oembed/headers.php
r35225 r35242 13 13 } 14 14 15 $post = self:: $factory->post->create_and_get( array(15 $post = self::factory()->post->create_and_get( array( 16 16 'post_title' => 'Hello World', 17 17 ) ); … … 47 47 } 48 48 49 $post = self:: $factory->post->create_and_get( array(49 $post = self::factory()->post->create_and_get( array( 50 50 'post_title' => 'Hello World', 51 51 ) ); -
trunk/tests/phpunit/tests/oembed/postEmbedUrl.php
r35225 r35242 13 13 update_option( 'permalink_structure', '/%postname%' ); 14 14 15 $post_id = self:: $factory->post->create();15 $post_id = self::factory()->post->create(); 16 16 $permalink = get_permalink( $post_id ); 17 17 $embed_url = get_post_embed_url( $post_id ); … … 23 23 24 24 function test_get_post_embed_url_with_ugly_permalinks() { 25 $post_id = self:: $factory->post->create();25 $post_id = self::factory()->post->create(); 26 26 $permalink = get_permalink( $post_id ); 27 27 $embed_url = get_post_embed_url( $post_id ); -
trunk/tests/phpunit/tests/oembed/template.php
r35235 r35242 6 6 class Tests_Embed_Template extends WP_UnitTestCase { 7 7 function test_oembed_output_post() { 8 $user = self:: $factory->user->create_and_get( array(8 $user = self::factory()->user->create_and_get( array( 9 9 'display_name' => 'John Doe', 10 10 ) ); 11 11 12 $post_id = self:: $factory->post->create( array(12 $post_id = self::factory()->post->create( array( 13 13 'post_author' => $user->ID, 14 14 'post_title' => 'Hello World', … … 31 31 32 32 function test_oembed_output_post_with_thumbnail() { 33 $post_id = self:: $factory->post->create( array(33 $post_id = self::factory()->post->create( array( 34 34 'post_title' => 'Hello World', 35 35 'post_content' => 'Foo Bar', … … 37 37 ) ); 38 38 $file = DIR_TESTDATA . '/images/canola.jpg'; 39 $attachment_id = self:: $factory->attachment->create_object( $file, $post_id, array(39 $attachment_id = self::factory()->attachment->create_object( $file, $post_id, array( 40 40 'post_mime_type' => 'image/jpeg', 41 41 ) ); … … 73 73 74 74 function test_oembed_output_attachment() { 75 $post = self:: $factory->post->create_and_get();75 $post = self::factory()->post->create_and_get(); 76 76 $file = DIR_TESTDATA . '/images/canola.jpg'; 77 $attachment_id = self:: $factory->attachment->create_object( $file, $post->ID, array(77 $attachment_id = self::factory()->attachment->create_object( $file, $post->ID, array( 78 78 'post_mime_type' => 'image/jpeg', 79 79 'post_title' => 'Hello World', … … 98 98 99 99 function test_oembed_output_draft_post() { 100 $post_id = self:: $factory->post->create( array(100 $post_id = self::factory()->post->create( array( 101 101 'post_title' => 'Hello World', 102 102 'post_content' => 'Foo Bar', … … 119 119 120 120 function test_oembed_output_scheduled_post() { 121 $post_id = self:: $factory->post->create( array(121 $post_id = self::factory()->post->create( array( 122 122 'post_title' => 'Hello World', 123 123 'post_content' => 'Foo Bar', … … 141 141 142 142 function test_oembed_output_private_post() { 143 $post_id = self:: $factory->post->create( array(143 $post_id = self::factory()->post->create( array( 144 144 'post_title' => 'Hello World', 145 145 'post_content' => 'Foo Bar', … … 162 162 163 163 function test_oembed_output_private_post_with_permissions() { 164 $user_id = self:: $factory->user->create( array( 'role' => 'editor' ) );164 $user_id = self::factory()->user->create( array( 'role' => 'editor' ) ); 165 165 wp_set_current_user( $user_id ); 166 166 167 $post_id = self:: $factory->post->create( array(167 $post_id = self::factory()->post->create( array( 168 168 'post_title' => 'Hello World', 169 169 'post_content' => 'Foo Bar', … … 194 194 195 195 function test_wp_embed_excerpt_more() { 196 $post_id = self:: $factory->post->create( array(196 $post_id = self::factory()->post->create( array( 197 197 'post_content' => 'Foo Bar', 198 198 ) ); … … 215 215 $this->assertFalse( is_embed() ); 216 216 217 $post_id = self:: $factory->post->create();217 $post_id = self::factory()->post->create(); 218 218 $this->go_to( get_post_embed_url( $post_id ) ); 219 219 $this->assertTrue( is_embed() ); … … 221 221 222 222 function test_is_embed_attachment() { 223 $post_id = self:: $factory->post->create();223 $post_id = self::factory()->post->create(); 224 224 $file = DIR_TESTDATA . '/images/canola.jpg'; 225 $attachment_id = self:: $factory->attachment->create_object( $file, $post_id, array(225 $attachment_id = self::factory()->attachment->create_object( $file, $post_id, array( 226 226 'post_mime_type' => 'image/jpeg', 227 227 ) ); … … 241 241 242 242 function test_get_post_embed_html() { 243 $post_id = self:: $factory->post->create();243 $post_id = self::factory()->post->create(); 244 244 245 245 $expected = '<iframe sandbox="allow-scripts" security="restricted" src="' . esc_url( get_post_embed_url( $post_id ) ) . '" width="200" height="200" title="Embedded WordPress Post" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" class="wp-embedded-content"></iframe>'; -
trunk/tests/phpunit/tests/option/multisite.php
r35225 r35242 99 99 100 100 function test_with_another_site() { 101 $user_id = self:: $factory->user->create();101 $user_id = self::factory()->user->create(); 102 102 $this->assertInternalType( 'integer', $user_id ); 103 103 104 $blog_id = self:: $factory->blog->create( array(104 $blog_id = self::factory()->blog->create( array( 105 105 'user_id' => $user_id, 106 106 'meta' => array( -
trunk/tests/phpunit/tests/option/networkOption.php
r35225 r35242 12 12 class Tests_Option_NetworkOption extends WP_UnitTestCase { 13 13 function test_add_network_option_not_available_on_other_network() { 14 $id = self:: $factory->network->create();14 $id = self::factory()->network->create(); 15 15 $option = rand_str(); 16 16 $value = rand_str(); … … 21 21 22 22 function test_add_network_option_available_on_same_network() { 23 $id = self:: $factory->network->create();23 $id = self::factory()->network->create(); 24 24 $option = rand_str(); 25 25 $value = rand_str(); … … 30 30 31 31 function test_delete_network_option_on_only_one_network() { 32 $id = self:: $factory->network->create();32 $id = self::factory()->network->create(); 33 33 $option = rand_str(); 34 34 $value = rand_str(); -
trunk/tests/phpunit/tests/option/userSettings.php
r35225 r35242 6 6 parent::setUp(); 7 7 8 $this->user_id = self:: $factory->user->create( array(8 $this->user_id = self::factory()->user->create( array( 9 9 'role' => 'administrator' 10 10 ) ); -
trunk/tests/phpunit/tests/post.php
r35225 r35242 546 546 global $wpdb; 547 547 548 $attachment = self:: $factory->post->create_and_get( array( 'post_title' => 'some-page', 'post_type' => 'attachment' ) );549 $page = self:: $factory->post->create_and_get( array( 'post_title' => 'some-page', 'post_type' => 'page' ) );550 $other_att = self:: $factory->post->create_and_get( array( 'post_title' => 'some-other-page', 'post_type' => 'attachment' ) );548 $attachment = self::factory()->post->create_and_get( array( 'post_title' => 'some-page', 'post_type' => 'attachment' ) ); 549 $page = self::factory()->post->create_and_get( array( 'post_title' => 'some-page', 'post_type' => 'page' ) ); 550 $other_att = self::factory()->post->create_and_get( array( 'post_title' => 'some-other-page', 'post_type' => 'attachment' ) ); 551 551 552 552 $wpdb->update( $wpdb->posts, array( 'post_name' => 'some-page' ), array( 'ID' => $page->ID ) ); … … 566 566 567 567 function test_wp_publish_post() { 568 $draft_id = self:: $factory->post->create( array( 'post_status' => 'draft' ) );568 $draft_id = self::factory()->post->create( array( 'post_status' => 'draft' ) ); 569 569 570 570 $post = get_post( $draft_id ); … … 582 582 function test_wp_insert_post_and_wp_publish_post_with_future_date() { 583 583 $future_date = gmdate( 'Y-m-d H:i:s', time() + 10000000 ); 584 $post_id = self:: $factory->post->create( array(584 $post_id = self::factory()->post->create( array( 585 585 'post_status' => 'publish', 586 586 'post_date' => $future_date, … … 642 642 */ 643 643 function test_get_page_uri_with_stdclass_post_object() { 644 $post_id = self:: $factory->post->create( array( 'post_name' => 'get-page-uri-post-name' ) );644 $post_id = self::factory()->post->create( array( 'post_name' => 'get-page-uri-post-name' ) ); 645 645 646 646 // Mimick an old stdClass post object, missing the ancestors field. … … 665 665 */ 666 666 function test_get_post_uri_check_orphan() { 667 $parent_id = self:: $factory->post->create( array( 'post_name' => 'parent' ) );668 $child_id = self:: $factory->post->create( array( 'post_name' => 'child', 'post_parent' => $parent_id ) );667 $parent_id = self::factory()->post->create( array( 'post_name' => 'parent' ) ); 668 $child_id = self::factory()->post->create( array( 'post_name' => 'child', 'post_parent' => $parent_id ) ); 669 669 670 670 // check the parent for good measure … … 684 684 function test_get_post_ancestors_within_loop() { 685 685 global $post; 686 $parent_id = self:: $factory->post->create();687 $post = self:: $factory->post->create_and_get( array( 'post_parent' => $parent_id ) );686 $parent_id = self::factory()->post->create(); 687 $post = self::factory()->post->create_and_get( array( 'post_parent' => $parent_id ) ); 688 688 $this->assertEquals( array( $parent_id ), get_post_ancestors( 0 ) ); 689 689 } … … 693 693 */ 694 694 function test_update_invalid_post_id() { 695 $post_id = self:: $factory->post->create( array( 'post_name' => 'get-page-uri-post-name' ) );695 $post_id = self::factory()->post->create( array( 'post_name' => 'get-page-uri-post-name' ) ); 696 696 $post = get_post( $post_id, ARRAY_A ); 697 697 … … 708 708 function test_parse_post_content_single_page() { 709 709 global $multipage, $pages, $numpages; 710 $post_id = self:: $factory->post->create( array( 'post_content' => 'Page 0' ) );710 $post_id = self::factory()->post->create( array( 'post_content' => 'Page 0' ) ); 711 711 $post = get_post( $post_id ); 712 712 setup_postdata( $post ); … … 719 719 function test_parse_post_content_multi_page() { 720 720 global $multipage, $pages, $numpages; 721 $post_id = self:: $factory->post->create( array( 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) );721 $post_id = self::factory()->post->create( array( 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) ); 722 722 $post = get_post( $post_id ); 723 723 setup_postdata( $post ); … … 730 730 function test_parse_post_content_remaining_single_page() { 731 731 global $multipage, $pages, $numpages; 732 $post_id = self:: $factory->post->create( array( 'post_content' => 'Page 0' ) );732 $post_id = self::factory()->post->create( array( 'post_content' => 'Page 0' ) ); 733 733 $post = get_post( $post_id ); 734 734 setup_postdata( $post ); … … 741 741 function test_parse_post_content_remaining_multi_page() { 742 742 global $multipage, $pages, $numpages; 743 $post_id = self:: $factory->post->create( array( 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) );743 $post_id = self::factory()->post->create( array( 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) ); 744 744 $post = get_post( $post_id ); 745 745 setup_postdata( $post ); … … 755 755 function test_parse_post_content_starting_with_nextpage() { 756 756 global $multipage, $pages, $numpages; 757 $post_id = self:: $factory->post->create( array( 'post_content' => '<!--nextpage-->Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) );757 $post_id = self::factory()->post->create( array( 'post_content' => '<!--nextpage-->Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3' ) ); 758 758 $post = get_post( $post_id ); 759 759 setup_postdata( $post ); … … 769 769 function test_parse_post_content_starting_with_nextpage_multi() { 770 770 global $multipage, $pages, $numpages; 771 $post_id = self:: $factory->post->create( array( 'post_content' => '<!--nextpage-->Page 0' ) );771 $post_id = self::factory()->post->create( array( 'post_content' => '<!--nextpage-->Page 0' ) ); 772 772 $post = get_post( $post_id ); 773 773 setup_postdata( $post ); … … 810 810 $post_type = rand_str(20); 811 811 register_post_type( $post_type ); 812 self:: $factory->post->create( array(812 self::factory()->post->create( array( 813 813 'post_type' => $post_type, 814 814 'post_author' => self::$editor_id … … 823 823 $post_type = rand_str(20); 824 824 register_post_type( $post_type ); 825 self:: $factory->post->create_many( 3, array(825 self::factory()->post->create_many( 3, array( 826 826 'post_type' => $post_type, 827 827 'post_author' => self::$editor_id … … 843 843 844 844 function test_wp_count_posts_insert_invalidation() { 845 $post_ids = self:: $factory->post->create_many( 3 );845 $post_ids = self::factory()->post->create_many( 3 ); 846 846 $initial_counts = wp_count_posts(); 847 847 … … 861 861 862 862 function test_wp_count_posts_trash_invalidation() { 863 $post_ids = self:: $factory->post->create_many( 3 );863 $post_ids = self::factory()->post->create_many( 3 ); 864 864 $initial_counts = wp_count_posts(); 865 865 … … 882 882 */ 883 883 function test_get_the_date_with_id_returns_correct_time() { 884 $post_id = self:: $factory->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );884 $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) ); 885 885 $this->assertEquals( 'March 1, 2014', get_the_date( 'F j, Y', $post_id ) ); 886 886 } … … 900 900 */ 901 901 function test_get_the_time_with_id_returns_correct_time() { 902 $post_id = self:: $factory->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );902 $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) ); 903 903 $this->assertEquals( '16:35:00', get_the_time( 'H:i:s', $post_id ) ); 904 904 } … … 918 918 */ 919 919 function test_get_post_time_with_id_returns_correct_time() { 920 $post_id = self:: $factory->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );920 $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) ); 921 921 $this->assertEquals( '16:35:00', get_post_time( 'H:i:s', false, $post_id ) ); 922 922 } … … 936 936 */ 937 937 function test_get_post_modified_time_with_id_returns_correct_time() { 938 $post_id = self:: $factory->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) );938 $post_id = self::factory()->post->create( array( 'post_date' => '2014-03-01 16:35:00' ) ); 939 939 $this->assertEquals( '16:35:00', get_post_modified_time( 'H:i:s', false, $post_id ) ); 940 940 } … … 974 974 register_taxonomy( $tax, $post_type ); 975 975 976 $post = self:: $factory->post->create( array( 'post_type' => $post_type ) );976 $post = self::factory()->post->create( array( 'post_type' => $post_type ) ); 977 977 wp_set_object_terms( $post, rand_str(), $tax ); 978 978 … … 1016 1016 require_once( ABSPATH . '/wp-admin/includes/post.php' ); 1017 1017 1018 $post_id = self:: $factory->post->create();1018 $post_id = self::factory()->post->create(); 1019 1019 1020 1020 $data = array( … … 1044 1044 */ 1045 1045 function test_wp_insert_post_default_comment_ping_status_open() { 1046 $post_id = self:: $factory->post->create( array(1046 $post_id = self::factory()->post->create( array( 1047 1047 'post_author' => self::$editor_id, 1048 1048 'post_status' => 'public', … … 1060 1060 */ 1061 1061 function test_wp_insert_post_page_default_comment_ping_status_closed() { 1062 $post_id = self:: $factory->post->create( array(1062 $post_id = self::factory()->post->create( array( 1063 1063 'post_author' => self::$editor_id, 1064 1064 'post_status' => 'public', … … 1079 1079 $post_type = rand_str(20); 1080 1080 register_post_type( $post_type, array( 'supports' => array( 'comments', 'trackbacks' ) ) ); 1081 $post_id = self:: $factory->post->create( array(1081 $post_id = self::factory()->post->create( array( 1082 1082 'post_author' => self::$editor_id, 1083 1083 'post_status' => 'public', … … 1099 1099 $post_type = rand_str(20); 1100 1100 register_post_type( $post_type ); 1101 $post_id = self:: $factory->post->create( array(1101 $post_id = self::factory()->post->create( array( 1102 1102 'post_author' => self::$editor_id, 1103 1103 'post_status' => 'public', … … 1128 1128 1129 1129 // Create a sticky post. 1130 $post = self:: $factory->post->create_and_get( array(1130 $post = self::factory()->post->create_and_get( array( 1131 1131 'post_title' => 'Will be changed', 1132 1132 'post_content' => 'Will be changed', … … 1157 1157 function test_user_without_publish_cannot_affect_sticky_with_edit_post() { 1158 1158 // Create a sticky post. 1159 $post = self:: $factory->post->create_and_get( array(1159 $post = self::factory()->post->create_and_get( array( 1160 1160 'post_title' => 'Will be changed', 1161 1161 'post_content' => 'Will be changed', … … 1192 1192 */ 1193 1193 public function test_wp_insert_post_author_zero() { 1194 $post_id = self:: $factory->post->create( array( 'post_author' => 0 ) );1194 $post_id = self::factory()->post->create( array( 'post_author' => 0 ) ); 1195 1195 1196 1196 $this->assertEquals( 0, get_post( $post_id )->post_author ); … … 1201 1201 */ 1202 1202 public function test_wp_insert_post_author_null() { 1203 $post_id = self:: $factory->post->create( array( 'post_author' => null ) );1203 $post_id = self::factory()->post->create( array( 'post_author' => null ) ); 1204 1204 1205 1205 $this->assertEquals( self::$editor_id, get_post( $post_id )->post_author ); -
trunk/tests/phpunit/tests/post/filtering.php
r35225 r35242 32 32 EOF; 33 33 34 $id = self:: $factory->post->create( array( 'post_content' => $content ) );34 $id = self::factory()->post->create( array( 'post_content' => $content ) ); 35 35 $post = get_post($id); 36 36 … … 49 49 EOF; 50 50 51 $id = self:: $factory->post->create( array( 'post_content' => $content ) );51 $id = self::factory()->post->create( array( 'post_content' => $content ) ); 52 52 $post = get_post($id); 53 53 … … 66 66 EOF; 67 67 68 $id = self:: $factory->post->create( array( 'post_content' => $content ) );68 $id = self::factory()->post->create( array( 'post_content' => $content ) ); 69 69 $post = get_post($id); 70 70 … … 85 85 EOF; 86 86 87 $id = self:: $factory->post->create( array( 'post_content' => $content ) );87 $id = self::factory()->post->create( array( 'post_content' => $content ) ); 88 88 $post = get_post($id); 89 89 … … 105 105 EOF; 106 106 107 $id = self:: $factory->post->create( array( 'post_content' => $content ) );107 $id = self::factory()->post->create( array( 'post_content' => $content ) ); 108 108 $post = get_post($id); 109 109 -
trunk/tests/phpunit/tests/post/formats.php
r35225 r35242 10 10 11 11 function test_set_get_post_format_for_post() { 12 $post_id = self:: $factory->post->create();12 $post_id = self::factory()->post->create(); 13 13 14 14 $format = get_post_format( $post_id ); … … 38 38 */ 39 39 function test_set_get_post_format_for_page() { 40 $post_id = self:: $factory->post->create( array( 'post_type' => 'page' ) );40 $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 41 41 42 42 $format = get_post_format( $post_id ); … … 70 70 71 71 function test_has_format() { 72 $post_id = self:: $factory->post->create();72 $post_id = self::factory()->post->create(); 73 73 74 74 $this->assertFalse( has_post_format( 'standard', $post_id ) ); … … 112 112 $commentary 113 113 DATA; 114 $link_post_id = self:: $factory->post->create( array( 'post_content' => $link ) );114 $link_post_id = self::factory()->post->create( array( 'post_content' => $link ) ); 115 115 $content_link = get_url_in_content( get_post_field( 'post_content', $link_post_id ) ); 116 116 $this->assertEquals( false, $content_link ); 117 117 118 $link_with_post_id = self:: $factory->post->create( array( 'post_content' => $link_with_commentary ) );118 $link_with_post_id = self::factory()->post->create( array( 'post_content' => $link_with_commentary ) ); 119 119 $content_link = get_url_in_content( get_post_field( 'post_content', $link_with_post_id ) ); 120 120 $this->assertEquals( false, $content_link ); … … 126 126 $this->assertEquals( false, $content_link ); 127 127 128 $empty_post_id = self:: $factory->post->create( array( 'post_content' => '' ) );128 $empty_post_id = self::factory()->post->create( array( 'post_content' => '' ) ); 129 129 $content_link = get_url_in_content( get_post_field( 'post_content', $empty_post_id ) ); 130 130 $this->assertEquals( false, $content_link ); 131 131 132 $comm_post_id = self:: $factory->post->create( array( 'post_content' => $commentary ) );132 $comm_post_id = self::factory()->post->create( array( 'post_content' => $commentary ) ); 133 133 $content_link = get_url_in_content( get_post_field( 'post_content', $comm_post_id ) ); 134 134 $this->assertEquals( false, $content_link ); 135 135 136 136 // Now with an href 137 $href_post_id = self:: $factory->post->create( array( 'post_content' => $href ) );137 $href_post_id = self::factory()->post->create( array( 'post_content' => $href ) ); 138 138 $content_link = get_url_in_content( get_post_field( 'post_content', $href_post_id ) ); 139 139 $this->assertEquals( $link, $content_link ); 140 140 141 $href_with_post_id = self:: $factory->post->create( array( 'post_content' => $href_with_commentary ) );141 $href_with_post_id = self::factory()->post->create( array( 'post_content' => $href_with_commentary ) ); 142 142 $content_link = get_url_in_content( get_post_field( 'post_content', $href_with_post_id ) ); 143 143 $this->assertEquals( $link, $content_link ); … … 149 149 $this->assertEquals( $link, $content_link ); 150 150 151 $empty_post_id = self:: $factory->post->create( array( 'post_content' => '' ) );151 $empty_post_id = self::factory()->post->create( array( 'post_content' => '' ) ); 152 152 $content_link = get_url_in_content( get_post_field( 'post_content', $empty_post_id ) ); 153 153 $this->assertEquals( false, $content_link ); 154 154 155 $comm_post_id = self:: $factory->post->create( array( 'post_content' => $commentary ) );155 $comm_post_id = self::factory()->post->create( array( 'post_content' => $commentary ) ); 156 156 $content_link = get_url_in_content( get_post_field( 'post_content', $comm_post_id ) ); 157 157 $this->assertEquals( false, $content_link ); -
trunk/tests/phpunit/tests/post/getBodyClass.php
r35225 r35242 10 10 public function setUp() { 11 11 parent::setUp(); 12 $this->post_id = self:: $factory->post->create();12 $this->post_id = self::factory()->post->create(); 13 13 } 14 14 … … 17 17 */ 18 18 public function test_with_utf8_category_slugs() { 19 $cat_id1 = self:: $factory->category->create( array( 'name' => 'Первая рубрика' ) );20 $cat_id2 = self:: $factory->category->create( array( 'name' => 'Вторая рубрика' ) );21 $cat_id3 = self:: $factory->category->create( array( 'name' => '25кадр' ) );19 $cat_id1 = self::factory()->category->create( array( 'name' => 'Первая рубрика' ) ); 20 $cat_id2 = self::factory()->category->create( array( 'name' => 'Вторая рубрика' ) ); 21 $cat_id3 = self::factory()->category->create( array( 'name' => '25кадр' ) ); 22 22 wp_set_post_terms( $this->post_id, array( $cat_id1, $cat_id2, $cat_id3 ), 'category' ); 23 23 … … 36 36 */ 37 37 public function test_with_utf8_tag_slugs() { 38 $tag_id1 = self:: $factory->tag->create( array( 'name' => 'Первая метка' ) );39 $tag_id2 = self:: $factory->tag->create( array( 'name' => 'Вторая метка' ) );40 $tag_id3 = self:: $factory->tag->create( array( 'name' => '25кадр' ) );38 $tag_id1 = self::factory()->tag->create( array( 'name' => 'Первая метка' ) ); 39 $tag_id2 = self::factory()->tag->create( array( 'name' => 'Вторая метка' ) ); 40 $tag_id3 = self::factory()->tag->create( array( 'name' => '25кадр' ) ); 41 41 wp_set_post_terms( $this->post_id, array( $tag_id1, $tag_id2, $tag_id3 ), 'post_tag' ); 42 42 … … 60 60 public function test_with_utf8_term_slugs() { 61 61 register_taxonomy( 'wptests_tax', 'post' ); 62 $term_id1 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Первая метка' ) );63 $term_id2 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Вторая метка' ) );64 $term_id3 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => '25кадр' ) );62 $term_id1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Первая метка' ) ); 63 $term_id2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Вторая метка' ) ); 64 $term_id3 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => '25кадр' ) ); 65 65 wp_set_post_terms( $this->post_id, array( $term_id1, $term_id2, $term_id3 ), 'wptests_tax' ); 66 66 -
trunk/tests/phpunit/tests/post/getPages.php
r35225 r35242 16 16 global $wpdb; 17 17 18 self:: $factory->post->create_many( 3, array( 'post_type' => 'page' ) );18 self::factory()->post->create_many( 3, array( 'post_type' => 'page' ) ); 19 19 wp_cache_delete( 'last_changed', 'posts' ); 20 20 $this->assertFalse( wp_cache_get( 'last_changed', 'posts' ) ); … … 100 100 */ 101 101 function test_get_pages_meta() { 102 $posts = self:: $factory->post->create_many( 3, array( 'post_type' => 'page' ) );102 $posts = self::factory()->post->create_many( 3, array( 'post_type' => 'page' ) ); 103 103 add_post_meta( $posts[0], 'some-meta-key', '0' ); 104 104 add_post_meta( $posts[1], 'some-meta-key', '' ); … … 117 117 118 118 foreach ( range( 1, 20 ) as $i ) 119 $page_ids[] = self:: $factory->post->create( array( 'post_type' => 'page' ) );119 $page_ids[] = self::factory()->post->create( array( 'post_type' => 'page' ) ); 120 120 121 121 $inc = array_slice( $page_ids, 0, 10 ); … … 139 139 */ 140 140 function test_get_pages_parent() { 141 $page_id1 = self:: $factory->post->create( array( 'post_type' => 'page' ) );142 $page_id2 = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id1 ) );143 $page_id3 = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id2 ) );144 $page_id4 = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id1 ) );141 $page_id1 = self::factory()->post->create( array( 'post_type' => 'page' ) ); 142 $page_id2 = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id1 ) ); 143 $page_id3 = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id2 ) ); 144 $page_id4 = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id1 ) ); 145 145 146 146 $pages = get_pages( array( 'parent' => 0, 'hierarchical' => false ) ); … … 167 167 */ 168 168 function test_wp_dropdown_pages() { 169 self:: $factory->post->create_many( 5, array( 'post_type' => 'page' ) );169 self::factory()->post->create_many( 5, array( 'post_type' => 'page' ) ); 170 170 171 171 preg_match_all( '#<option#', wp_dropdown_pages( 'echo=0' ), $matches ); … … 178 178 */ 179 179 function test_get_chidren_fields_ids() { 180 $post_id = self:: $factory->post->create();181 $child_ids = self:: $factory->post->create_many( 5, array( 'post_parent' => $post_id ) );180 $post_id = self::factory()->post->create(); 181 $child_ids = self::factory()->post->create_many( 5, array( 'post_parent' => $post_id ) ); 182 182 183 183 $post_ids = get_children( array( 'fields' => 'ids', 'post_parent' => $post_id ) ); … … 190 190 function test_get_pages_hierarchical_and_no_parent() { 191 191 global $wpdb; 192 $page_1 = self:: $factory->post->create( array( 'post_type' => 'page' ) );193 $page_2 = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );194 $page_3 = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );195 $page_4 = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_2 ) );192 $page_1 = self::factory()->post->create( array( 'post_type' => 'page' ) ); 193 $page_2 = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) ); 194 $page_3 = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) ); 195 $page_4 = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $page_2 ) ); 196 196 197 197 $pages = get_pages(); // Defaults: hierarchical = true, parent = -1 … … 219 219 */ 220 220 public function test_get_pages_hierarchical_empty_child_of() { 221 $page_1 = self:: $factory->post->create( array( 'post_type' => 'page' ) );222 $page_2 = self:: $factory->post->create( array( 'post_type' => 'page' ) );223 $page_3 = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );224 $page_4 = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );221 $page_1 = self::factory()->post->create( array( 'post_type' => 'page' ) ); 222 $page_2 = self::factory()->post->create( array( 'post_type' => 'page' ) ); 223 $page_3 = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) ); 224 $page_4 = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) ); 225 225 226 226 $pages = get_pages(); // Defaults: hierarchical = true, child_of = '', parent = -1 … … 253 253 */ 254 254 public function test_get_pages_non_hierarchical_empty_child_of() { 255 $page_1 = self:: $factory->post->create( array( 'post_type' => 'page' ) );256 $page_2 = self:: $factory->post->create( array( 'post_type' => 'page' ) );257 $page_3 = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );258 $page_4 = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );255 $page_1 = self::factory()->post->create( array( 'post_type' => 'page' ) ); 256 $page_2 = self::factory()->post->create( array( 'post_type' => 'page' ) ); 257 $page_3 = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) ); 258 $page_4 = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) ); 259 259 260 260 $pages = get_pages( array( 'hierarchical' => false ) ); // child_of = '', parent = -1 … … 279 279 */ 280 280 public function test_get_pages_hierarchical_non_empty_child_of() { 281 $page_1 = self:: $factory->post->create( array( 'post_type' => 'page' ) );282 $page_2 = self:: $factory->post->create( array( 'post_type' => 'page' ) );283 $page_3 = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );284 $page_4 = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_3 ) );285 $page_5 = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );281 $page_1 = self::factory()->post->create( array( 'post_type' => 'page' ) ); 282 $page_2 = self::factory()->post->create( array( 'post_type' => 'page' ) ); 283 $page_3 = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) ); 284 $page_4 = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $page_3 ) ); 285 $page_5 = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) ); 286 286 287 287 $pages = get_pages( array( 'child_of' => $page_1 ) ); // Defaults: hierarchical = true, parent = -1. … … 307 307 */ 308 308 public function test_get_pages_non_hierarchical_non_empty_child_of() { 309 $page_1 = self:: $factory->post->create( array( 'post_type' => 'page' ) );310 $page_2 = self:: $factory->post->create( array( 'post_type' => 'page' ) );311 $page_3 = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );312 $page_4 = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_3 ) );313 $page_5 = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) );309 $page_1 = self::factory()->post->create( array( 'post_type' => 'page' ) ); 310 $page_2 = self::factory()->post->create( array( 'post_type' => 'page' ) ); 311 $page_3 = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) ); 312 $page_4 = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $page_3 ) ); 313 $page_5 = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $page_1 ) ); 314 314 315 315 $pages = get_pages( array( 'hierarchical' => false, 'child_of' => $page_1 ) ); … … 339 339 register_post_type( $type, array( 'hierarchical' => true, 'public' => true ) ); 340 340 341 $posts = self:: $factory->post->create_many( 2, array( 'post_type' => $type ) );341 $posts = self::factory()->post->create_many( 2, array( 'post_type' => $type ) ); 342 342 $post_id = reset( $posts ); 343 343 … … 361 361 362 362 function test_exclude_tree() { 363 $post_id1 = self:: $factory->post->create( array( 'post_type' => 'page' ) );364 $post_id2 = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $post_id1 ) );365 $post_id3 = self:: $factory->post->create( array( 'post_type' => 'page' ) );366 $post_id4 = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $post_id3 ) );363 $post_id1 = self::factory()->post->create( array( 'post_type' => 'page' ) ); 364 $post_id2 = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $post_id1 ) ); 365 $post_id3 = self::factory()->post->create( array( 'post_type' => 'page' ) ); 366 $post_id4 = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $post_id3 ) ); 367 367 368 368 $all = get_pages(); … … 385 385 $this->assertCount( 0, $exclude5 ); 386 386 387 $post_id5 = self:: $factory->post->create( array( 'post_type' => 'page' ) );388 $post_id6 = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $post_id5 ) );387 $post_id5 = self::factory()->post->create( array( 'post_type' => 'page' ) ); 388 $post_id6 = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $post_id5 ) ); 389 389 390 390 $exclude6 = get_pages( array( 'exclude_tree' => array( $post_id1, $post_id3 ) ) ); -
trunk/tests/phpunit/tests/post/getPostClass.php
r35225 r35242 10 10 public function setUp() { 11 11 parent::setUp(); 12 $this->post_id = self:: $factory->post->create();12 $this->post_id = self::factory()->post->create(); 13 13 } 14 14 … … 23 23 24 24 public function test_with_categories() { 25 $cats = self:: $factory->category->create_many( 2 );25 $cats = self::factory()->category->create_many( 2 ); 26 26 wp_set_post_terms( $this->post_id, $cats, 'category' ); 27 27 … … 58 58 */ 59 59 public function test_with_utf8_category_slugs() { 60 $cat_id1 = self:: $factory->category->create( array( 'name' => 'Первая рубрика' ) );61 $cat_id2 = self:: $factory->category->create( array( 'name' => 'Вторая рубрика' ) );62 $cat_id3 = self:: $factory->category->create( array( 'name' => '25кадр' ) );60 $cat_id1 = self::factory()->category->create( array( 'name' => 'Первая рубрика' ) ); 61 $cat_id2 = self::factory()->category->create( array( 'name' => 'Вторая рубрика' ) ); 62 $cat_id3 = self::factory()->category->create( array( 'name' => '25кадр' ) ); 63 63 wp_set_post_terms( $this->post_id, array( $cat_id1, $cat_id2, $cat_id3 ), 'category' ); 64 64 … … 74 74 */ 75 75 public function test_with_utf8_tag_slugs() { 76 $tag_id1 = self:: $factory->tag->create( array( 'name' => 'Первая метка' ) );77 $tag_id2 = self:: $factory->tag->create( array( 'name' => 'Вторая метка' ) );78 $tag_id3 = self:: $factory->tag->create( array( 'name' => '25кадр' ) );76 $tag_id1 = self::factory()->tag->create( array( 'name' => 'Первая метка' ) ); 77 $tag_id2 = self::factory()->tag->create( array( 'name' => 'Вторая метка' ) ); 78 $tag_id3 = self::factory()->tag->create( array( 'name' => '25кадр' ) ); 79 79 wp_set_post_terms( $this->post_id, array( $tag_id1, $tag_id2, $tag_id3 ), 'post_tag' ); 80 80 … … 91 91 public function test_with_utf8_term_slugs() { 92 92 register_taxonomy( 'wptests_tax', 'post' ); 93 $term_id1 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Первая метка' ) );94 $term_id2 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Вторая метка' ) );95 $term_id3 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => '25кадр' ) );93 $term_id1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Первая метка' ) ); 94 $term_id2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Вторая метка' ) ); 95 $term_id3 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => '25кадр' ) ); 96 96 wp_set_post_terms( $this->post_id, array( $term_id1, $term_id2, $term_id3 ), 'wptests_tax' ); 97 97 -
trunk/tests/phpunit/tests/post/getPostsByAuthorSql.php
r35225 r35242 60 60 public function test_public_only_true_should_not_allow_any_private_posts_for_loggedin_user(){ 61 61 $current_user = get_current_user_id(); 62 $u = self:: $factory->user->create();62 $u = self::factory()->user->create(); 63 63 wp_set_current_user( $u ); 64 64 … … 71 71 public function test_public_only_should_default_to_false(){ 72 72 $current_user = get_current_user_id(); 73 $u = self:: $factory->user->create();73 $u = self::factory()->user->create(); 74 74 wp_set_current_user( $u ); 75 75 … … 81 81 public function test_public_only_false_should_allow_current_user_access_to_own_private_posts_when_current_user_matches_post_author(){ 82 82 $current_user = get_current_user_id(); 83 $u = self:: $factory->user->create();83 $u = self::factory()->user->create(); 84 84 wp_set_current_user( $u ); 85 85 … … 92 92 public function test_public_only_false_should_not_allow_access_to_private_posts_if_current_user_is_not_post_author(){ 93 93 $current_user = get_current_user_id(); 94 $u1 = self:: $factory->user->create();95 $u2 = self:: $factory->user->create();94 $u1 = self::factory()->user->create(); 95 $u2 = self::factory()->user->create(); 96 96 wp_set_current_user( $u1 ); 97 97 … … 104 104 public function test_public_only_false_should_allow_current_user_access_to_own_private_posts_when_post_author_is_not_provided(){ 105 105 $current_user = get_current_user_id(); 106 $u = self:: $factory->user->create();106 $u = self::factory()->user->create(); 107 107 wp_set_current_user( $u ); 108 108 … … 116 116 public function test_administrator_should_have_access_to_private_posts_when_public_only_is_false(){ 117 117 $current_user = get_current_user_id(); 118 $u = self:: $factory->user->create( array( 'role' => 'administrator' ) );118 $u = self::factory()->user->create( array( 'role' => 'administrator' ) ); 119 119 wp_set_current_user( $u ); 120 120 … … 131 131 register_post_type( 'baz', array( 'capabilities' => array( 'read_private_posts' => 'read_private_baz' ) ) ); 132 132 $current_user = get_current_user_id(); 133 $u = self:: $factory->user->create( array( 'role' => 'editor' ) );133 $u = self::factory()->user->create( array( 'role' => 'editor' ) ); 134 134 $editor_role = get_role('editor'); 135 135 $editor_role->add_cap( 'read_private_baz' ); -
trunk/tests/phpunit/tests/post/listPages.php
r35225 r35242 28 28 $wpdb->query( 'TRUNCATE ' . $wpdb->prefix . 'posts' ); 29 29 $pages = array(); 30 self:: $factory->user->create();31 $pages[] = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 1' ) );32 $pages[] = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 2' ) );33 $pages[] = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 3', 'post_author' => '2' ) );30 self::factory()->user->create(); 31 $pages[] = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 1' ) ); 32 $pages[] = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 2' ) ); 33 $pages[] = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'Parent 3', 'post_author' => '2' ) ); 34 34 35 35 foreach ( $pages as $page ) { 36 $this->pages[$page] = self:: $factory->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 1' ) );37 $this->pages[$page] = self:: $factory->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 2' ) );38 $this->pages[$page] = self:: $factory->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 3' ) );36 $this->pages[$page] = self::factory()->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 1' ) ); 37 $this->pages[$page] = self::factory()->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 2' ) ); 38 $this->pages[$page] = self::factory()->post->create( array( 'post_parent' => $page, 'post_type' => 'page', 'post_title' => 'Child 3' ) ); 39 39 } 40 40 } -
trunk/tests/phpunit/tests/post/meta.php
r35225 r35242 9 9 parent::setUp(); 10 10 11 $this->author = new WP_User( self:: $factory->user->create( array( 'role' => 'editor' ) ) );11 $this->author = new WP_User( self::factory()->user->create( array( 'role' => 'editor' ) ) ); 12 12 13 13 $post = array( -
trunk/tests/phpunit/tests/post/nav-menu.php
r35225 r35242 17 17 18 18 function test_wp_get_associated_nav_menu_items() { 19 $tag_id = self:: $factory->tag->create();20 $cat_id = self:: $factory->category->create();21 $post_id = self:: $factory->post->create();22 $post_2_id = self:: $factory->post->create();23 $page_id = self:: $factory->post->create( array( 'post_type' => 'page' ) );19 $tag_id = self::factory()->tag->create(); 20 $cat_id = self::factory()->category->create(); 21 $post_id = self::factory()->post->create(); 22 $post_2_id = self::factory()->post->create(); 23 $page_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 24 24 25 25 $tag_insert = wp_update_nav_menu_item( $this->menu_id, 0, array( … … 120 120 public function test_wp_get_nav_menu_items_with_taxonomy_term() { 121 121 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) ); 122 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );123 $child_terms = self:: $factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax', 'parent' => $t ) );122 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 123 $child_terms = self::factory()->term->create_many( 2, array( 'taxonomy' => 'wptests_tax', 'parent' => $t ) ); 124 124 125 125 $term_menu_item = wp_update_nav_menu_item( $this->menu_id, 0, array( -
trunk/tests/phpunit/tests/post/objects.php
r35225 r35242 7 7 8 8 function test_get_post() { 9 $id = self:: $factory->post->create();9 $id = self::factory()->post->create(); 10 10 11 11 $post = get_post( $id ); … … 68 68 69 69 function test_get_post_ancestors() { 70 $parent_id = self:: $factory->post->create();71 $child_id = self:: $factory->post->create();72 $grandchild_id = self:: $factory->post->create();70 $parent_id = self::factory()->post->create(); 71 $child_id = self::factory()->post->create(); 72 $grandchild_id = self::factory()->post->create(); 73 73 $updated = wp_update_post( array( 'ID' => $child_id, 'post_parent' => $parent_id ) ); 74 74 $this->assertEquals( $updated, $child_id ); … … 100 100 101 101 function test_get_post_category_property() { 102 $post_id = self:: $factory->post->create();102 $post_id = self::factory()->post->create(); 103 103 $post = get_post( $post_id ); 104 104 … … 119 119 120 120 function test_get_tags_input_property() { 121 $post_id = self:: $factory->post->create();121 $post_id = self::factory()->post->create(); 122 122 $post = get_post( $post_id ); 123 123 … … 136 136 137 137 function test_get_page_template_property() { 138 $post_id = self:: $factory->post->create();138 $post_id = self::factory()->post->create(); 139 139 $post = get_post( $post_id ); 140 140 … … 156 156 157 157 function test_get_post_filter() { 158 $post = get_post( self:: $factory->post->create( array(158 $post = get_post( self::factory()->post->create( array( 159 159 'post_title' => "Mary's home" 160 160 ) ) ); … … 179 179 180 180 function test_get_post_identity() { 181 $post = get_post( self:: $factory->post->create() );181 $post = get_post( self::factory()->post->create() ); 182 182 183 183 $post->foo = 'bar'; … … 188 188 189 189 function test_get_post_array() { 190 $id = self:: $factory->post->create();190 $id = self::factory()->post->create(); 191 191 192 192 $post = get_post( $id, ARRAY_A ); … … 203 203 global $wpdb; 204 204 205 $id = self:: $factory->post->create();205 $id = self::factory()->post->create(); 206 206 wp_cache_delete( $id, 'posts' ); 207 207 -
trunk/tests/phpunit/tests/post/output.php
r35225 r35242 42 42 EOF; 43 43 44 $post_id = self:: $factory->post->create( compact( 'post_content' ) );44 $post_id = self::factory()->post->create( compact( 'post_content' ) ); 45 45 46 46 $expected = <<<EOF … … 77 77 EOF; 78 78 79 $post_id = self:: $factory->post->create( compact( 'post_content' ) );79 $post_id = self::factory()->post->create( compact( 'post_content' ) ); 80 80 $this->go_to( get_permalink( $post_id ) ); 81 81 $this->assertTrue( is_single() ); … … 115 115 EOF; 116 116 117 $post_id = self:: $factory->post->create( compact( 'post_content' ) );117 $post_id = self::factory()->post->create( compact( 'post_content' ) ); 118 118 $this->go_to( get_permalink( $post_id ) ); 119 119 $this->assertTrue( is_single() ); … … 137 137 EOF; 138 138 139 $post_id = self:: $factory->post->create( compact( 'post_content' ) );139 $post_id = self::factory()->post->create( compact( 'post_content' ) ); 140 140 $this->go_to( get_permalink( $post_id ) ); 141 141 $this->assertTrue( is_single() ); … … 161 161 EOF; 162 162 163 $post_id = self:: $factory->post->create( compact( 'post_content' ) );163 $post_id = self::factory()->post->create( compact( 'post_content' ) ); 164 164 $this->go_to( get_permalink( $post_id ) ); 165 165 $this->assertTrue( is_single() ); -
trunk/tests/phpunit/tests/post/query.php
r35225 r35242 12 12 $q = new WP_Query(); 13 13 14 $term_id = self:: $factory->category->create( array( 'slug' => 'woo', 'name' => 'WOO!' ) );15 $term_id2 = self:: $factory->category->create( array( 'slug' => 'hoo', 'name' => 'HOO!' ) );16 $post_id = self:: $factory->post->create();14 $term_id = self::factory()->category->create( array( 'slug' => 'woo', 'name' => 'WOO!' ) ); 15 $term_id2 = self::factory()->category->create( array( 'slug' => 'hoo', 'name' => 'HOO!' ) ); 16 $post_id = self::factory()->post->create(); 17 17 18 18 wp_set_post_categories( $post_id, $term_id ); … … 42 42 */ 43 43 function test_empty_category__in() { 44 $cat_id = self:: $factory->category->create();45 $post_id = self:: $factory->post->create();44 $cat_id = self::factory()->category->create(); 45 $post_id = self::factory()->post->create(); 46 46 wp_set_post_categories( $post_id, $cat_id ); 47 47 … … 72 72 function test_the_posts_filter() { 73 73 // Create posts and clear their caches. 74 $post_ids = self:: $factory->post->create_many( 4 );74 $post_ids = self::factory()->post->create_many( 4 ); 75 75 foreach ( $post_ids as $post_id ) 76 76 clean_post_cache( $post_id ); … … 116 116 117 117 function test_post__in_ordering() { 118 $post_id1 = self:: $factory->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) );119 $post_id2 = self:: $factory->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) );120 $post_id3 = self:: $factory->post->create( array(118 $post_id1 = self::factory()->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) ); 119 $post_id2 = self::factory()->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) ); 120 $post_id3 = self::factory()->post->create( array( 121 121 'post_type' => 'page', 122 122 'post_parent' => $post_id2, 123 123 'menu_order' => rand( 1, 100 ) 124 124 ) ); 125 $post_id4 = self:: $factory->post->create( array(125 $post_id4 = self::factory()->post->create( array( 126 126 'post_type' => 'page', 127 127 'post_parent' => $post_id2, 128 128 'menu_order' => rand( 1, 100 ) 129 129 ) ); 130 $post_id5 = self:: $factory->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) );130 $post_id5 = self::factory()->post->create( array( 'post_type' => 'page', 'menu_order' => rand( 1, 100 ) ) ); 131 131 132 132 $ordered = array( $post_id2, $post_id4, $post_id3, $post_id1, $post_id5 ); … … 141 141 142 142 function test_post__in_attachment_ordering() { 143 $post_id = self:: $factory->post->create();143 $post_id = self::factory()->post->create(); 144 144 $att_ids = array(); 145 145 $file = DIR_TESTDATA . '/images/canola.jpg'; 146 $att_ids[1] = self:: $factory->attachment->create_object( $file, $post_id, array(147 'post_mime_type' => 'image/jpeg', 148 'menu_order' => rand( 1, 100 ) 149 ) ); 150 $att_ids[2] = self:: $factory->attachment->create_object( $file, $post_id, array(151 'post_mime_type' => 'image/jpeg', 152 'menu_order' => rand( 1, 100 ) 153 ) ); 154 $att_ids[3] = self:: $factory->attachment->create_object( $file, $post_id, array(155 'post_mime_type' => 'image/jpeg', 156 'menu_order' => rand( 1, 100 ) 157 ) ); 158 $att_ids[4] = self:: $factory->attachment->create_object( $file, $post_id, array(159 'post_mime_type' => 'image/jpeg', 160 'menu_order' => rand( 1, 100 ) 161 ) ); 162 $att_ids[5] = self:: $factory->attachment->create_object( $file, $post_id, array(146 $att_ids[1] = self::factory()->attachment->create_object( $file, $post_id, array( 147 'post_mime_type' => 'image/jpeg', 148 'menu_order' => rand( 1, 100 ) 149 ) ); 150 $att_ids[2] = self::factory()->attachment->create_object( $file, $post_id, array( 151 'post_mime_type' => 'image/jpeg', 152 'menu_order' => rand( 1, 100 ) 153 ) ); 154 $att_ids[3] = self::factory()->attachment->create_object( $file, $post_id, array( 155 'post_mime_type' => 'image/jpeg', 156 'menu_order' => rand( 1, 100 ) 157 ) ); 158 $att_ids[4] = self::factory()->attachment->create_object( $file, $post_id, array( 159 'post_mime_type' => 'image/jpeg', 160 'menu_order' => rand( 1, 100 ) 161 ) ); 162 $att_ids[5] = self::factory()->attachment->create_object( $file, $post_id, array( 163 163 'post_mime_type' => 'image/jpeg', 164 164 'menu_order' => rand( 1, 100 ) … … 312 312 $q = new WP_Query(); 313 313 314 $post_ids[0] = self:: $factory->post->create( array( 'post_title' => 'woo', 'post_date' => '2015-07-23 00:00:00' ) );315 $post_ids[1] = self:: $factory->post->create( array( 'post_title' => 'hoo', 'post_date' => '2015-07-23 00:00:00' ) );316 $post_ids[2] = self:: $factory->post->create( array( 'post_title' => 'test', 'post_date' => '2015-07-23 00:00:00' ) );317 $post_ids[3] = self:: $factory->post->create( array( 'post_title' => 'me', 'post_date' => '2015-07-23 00:00:00' ) );314 $post_ids[0] = self::factory()->post->create( array( 'post_title' => 'woo', 'post_date' => '2015-07-23 00:00:00' ) ); 315 $post_ids[1] = self::factory()->post->create( array( 'post_title' => 'hoo', 'post_date' => '2015-07-23 00:00:00' ) ); 316 $post_ids[2] = self::factory()->post->create( array( 'post_title' => 'test', 'post_date' => '2015-07-23 00:00:00' ) ); 317 $post_ids[3] = self::factory()->post->create( array( 'post_title' => 'me', 'post_date' => '2015-07-23 00:00:00' ) ); 318 318 319 319 $requested = array( $post_ids[0], $post_ids[3] ); -
trunk/tests/phpunit/tests/post/revisions.php
r35225 r35242 145 145 */ 146 146 function test_revision_view_caps_post() { 147 $post_id = self:: $factory->post->create( array( 'post_type' => 'post', 'post_author' => self::$editor_user_id ) );147 $post_id = self::factory()->post->create( array( 'post_type' => 'post', 'post_author' => self::$editor_user_id ) ); 148 148 wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) ); 149 149 … … 167 167 */ 168 168 function test_revision_restore_caps_post() { 169 $post_id = self:: $factory->post->create( array( 'post_type' => 'post', 'post_author' => self::$editor_user_id ) );169 $post_id = self::factory()->post->create( array( 'post_type' => 'post', 'post_author' => self::$editor_user_id ) ); 170 170 wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) ); 171 171 … … 187 187 */ 188 188 function test_revision_diff_caps_post() { 189 $post_id = self:: $factory->post->create( array( 'post_type' => 'post', 'post_author' => self::$editor_user_id ) );189 $post_id = self::factory()->post->create( array( 'post_type' => 'post', 'post_author' => self::$editor_user_id ) ); 190 190 wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) ); 191 191 wp_update_post( array( 'post_content' => 'This content is even better', 'ID' => $post_id ) ); … … 215 215 ) ); 216 216 217 $post_id = self:: $factory->post->create( array( 'post_type' => $this->post_type, 'post_author' => self::$editor_user_id ) );217 $post_id = self::factory()->post->create( array( 'post_type' => $this->post_type, 'post_author' => self::$editor_user_id ) ); 218 218 wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) ); 219 219 … … 248 248 249 249 //create a post as Editor 250 $post_id = self:: $factory->post->create( array( 'post_type' => $this->post_type, 'post_author' => self::$editor_user_id ) );250 $post_id = self::factory()->post->create( array( 'post_type' => $this->post_type, 'post_author' => self::$editor_user_id ) ); 251 251 wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) ); 252 252 … … 283 283 wp_set_current_user( self::$editor_user_id ); 284 284 285 $post_id = self:: $factory->post->create( array( 'post_type' => $this->post_type, 'post_status' => 'draft' ) );285 $post_id = self::factory()->post->create( array( 'post_type' => $this->post_type, 'post_status' => 'draft' ) ); 286 286 wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) ); 287 287 … … 315 315 ) ); 316 316 317 $post_id = self:: $factory->post->create( array( 'post_type' => $this->post_type, 'post_author' => self::$editor_user_id ) );317 $post_id = self::factory()->post->create( array( 'post_type' => $this->post_type, 'post_author' => self::$editor_user_id ) ); 318 318 wp_update_post( array( 'post_content' => 'This content is much better', 'ID' => $post_id ) ); 319 319 wp_update_post( array( 'post_content' => 'This content is even better', 'ID' => $post_id ) ); … … 338 338 global $wpdb; 339 339 340 $post = self:: $factory->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post', 'post_content' => 'some_content' ) );340 $post = self::factory()->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post', 'post_content' => 'some_content' ) ); 341 341 342 342 $post = (array) $post; … … 366 366 */ 367 367 function test_wp_get_post_revisions_should_order_by_ID_when_post_date_matches() { 368 $post = self:: $factory->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post', 'post_content' => 'some_content' ) );368 $post = self::factory()->post->create_and_get( array( 'post_title' => 'some-post', 'post_type' => 'post', 'post_content' => 'some_content' ) ); 369 369 370 370 $post = (array) $post; -
trunk/tests/phpunit/tests/post/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 ); … … 34 34 */ 35 35 function test_edit_post() { 36 $id = self:: $factory->post->create();36 $id = self::factory()->post->create(); 37 37 38 38 $_POST = array(); … … 103 103 */ 104 104 function test_wp_update_post() { 105 $id = self:: $factory->post->create();105 $id = self::factory()->post->create(); 106 106 107 107 wp_update_post(array( -
trunk/tests/phpunit/tests/post/template.php
r35225 r35242 9 9 $contents = array( 'One', 'Two', 'Three' ); 10 10 $content = join( '<!--nextpage-->', $contents ); 11 $post_id = self:: $factory->post->create( array( 'post_content' => $content ) );11 $post_id = self::factory()->post->create( array( 'post_content' => $content ) ); 12 12 13 13 $this->go_to( '?p=' . $post_id ); … … 82 82 83 83 $bump = ' '; 84 $page_id = self:: $factory->post->create( array( 'post_type' => 'page' ) );85 $child_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id ) );86 $grandchild_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_parent' => $child_id ) );84 $page_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 85 $child_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $page_id ) ); 86 $grandchild_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $child_id ) ); 87 87 88 88 $title1 = get_post( $page_id )->post_title; … … 144 144 */ 145 145 public function test_wp_dropdown_pages_value_field_should_default_to_ID() { 146 $p = self:: $factory->post->create( array(146 $p = self::factory()->post->create( array( 147 147 'post_type' => 'page', 148 148 ) ); … … 160 160 */ 161 161 public function test_wp_dropdown_pages_value_field_ID() { 162 $p = self:: $factory->post->create( array(162 $p = self::factory()->post->create( array( 163 163 'post_type' => 'page', 164 164 ) ); … … 176 176 */ 177 177 public function test_wp_dropdown_pages_value_field_post_name() { 178 $p = self:: $factory->post->create( array(178 $p = self::factory()->post->create( array( 179 179 'post_type' => 'page', 180 180 'post_name' => 'foo', … … 193 193 */ 194 194 public function test_wp_dropdown_pages_value_field_should_fall_back_on_ID_when_an_invalid_value_is_provided() { 195 $p = self:: $factory->post->create( array(195 $p = self::factory()->post->create( array( 196 196 'post_type' => 'page', 197 197 'post_name' => 'foo', … … 210 210 */ 211 211 public function test_wp_dropdown_pages_should_not_contain_class_attribute_when_no_class_is_passed() { 212 $p = self:: $factory->post->create( array(212 $p = self::factory()->post->create( array( 213 213 'post_type' => 'page', 214 214 'post_name' => 'foo', … … 226 226 */ 227 227 public function test_wp_dropdown_pages_should_obey_class_parameter() { 228 $p = self:: $factory->post->create( array(228 $p = self::factory()->post->create( array( 229 229 'post_type' => 'page', 230 230 'post_name' => 'foo', … … 243 243 */ 244 244 public function test_get_page_template_slug_by_id() { 245 $page_id = self:: $factory->post->create( array(245 $page_id = self::factory()->post->create( array( 246 246 'post_type' => 'page', 247 247 ) ); … … 260 260 */ 261 261 public function test_get_page_template_slug_from_loop() { 262 $page_id = self:: $factory->post->create( array(262 $page_id = self::factory()->post->create( array( 263 263 'post_type' => 'page', 264 264 ) ); … … 274 274 */ 275 275 public function test_get_page_template_slug_non_page() { 276 $post_id = self:: $factory->post->create( array(276 $post_id = self::factory()->post->create( array( 277 277 'post_type' => 'post', 278 278 ) ); … … 289 289 */ 290 290 public function test_wp_page_menu_wp_nav_menu_fallback() { 291 $pages = self:: $factory->post->create_many( 3, array( 'post_type' => 'page' ) );291 $pages = self::factory()->post->create_many( 3, array( 'post_type' => 'page' ) ); 292 292 293 293 // No menus + wp_nav_menu() falls back to wp_page_menu(). -
trunk/tests/phpunit/tests/post/wpUniquePostSlug.php
r35225 r35242 9 9 */ 10 10 public function test_non_latin_slugs() { 11 $author_id = self:: $factory->user->create( array( 'role' => 'editor' ) );11 $author_id = self::factory()->user->create( array( 'role' => 'editor' ) ); 12 12 13 13 $inputs = array( … … 50 50 'post_status' => 'publish', 51 51 ); 52 $one = self:: $factory->post->create( $args );52 $one = self::factory()->post->create( $args ); 53 53 $args['post_type'] = 'post-type-2'; 54 $two = self:: $factory->post->create( $args );54 $two = self::factory()->post->create( $args ); 55 55 56 56 $this->assertEquals( 'some-slug', get_post( $one )->post_name ); … … 75 75 'post_status' => 'publish', 76 76 ); 77 $one = self:: $factory->post->create( $args );77 $one = self::factory()->post->create( $args ); 78 78 $args['post_name'] = 'some-slug-2'; 79 $two = self:: $factory->post->create( $args );79 $two = self::factory()->post->create( $args ); 80 80 81 81 $this->assertEquals( 'some-slug', get_post( $one )->post_name ); … … 98 98 'post_status' => 'publish', 99 99 ); 100 $one = self:: $factory->post->create( $args );100 $one = self::factory()->post->create( $args ); 101 101 102 102 $args = array( … … 105 105 'post_name' => 'image' 106 106 ); 107 $attachment = self:: $factory->attachment->create_object( 'image.jpg', $one, $args );107 $attachment = self::factory()->attachment->create_object( 'image.jpg', $one, $args ); 108 108 109 109 $args = array( … … 113 113 'post_parent' => $one 114 114 ); 115 $two = self:: $factory->post->create( $args );115 $two = self::factory()->post->create( $args ); 116 116 117 117 $this->assertEquals( 'some-slug', get_post( $one )->post_name ); … … 129 129 */ 130 130 public function test_whitelisted_post_statuses_should_not_be_forced_to_be_unique( $status ) { 131 $p1 = self:: $factory->post->create( array(132 'post_type' => 'post', 133 'post_name' => 'foo', 134 ) ); 135 136 $p2 = self:: $factory->post->create( array(131 $p1 = self::factory()->post->create( array( 132 'post_type' => 'post', 133 'post_name' => 'foo', 134 ) ); 135 136 $p2 = self::factory()->post->create( array( 137 137 'post_type' => 'post', 138 138 ) ); … … 152 152 153 153 public function test_revisions_should_not_be_forced_to_be_unique() { 154 $p1 = self:: $factory->post->create( array(155 'post_type' => 'post', 156 'post_name' => 'foo', 157 ) ); 158 159 $p2 = self:: $factory->post->create( array(154 $p1 = self::factory()->post->create( array( 155 'post_type' => 'post', 156 'post_name' => 'foo', 157 ) ); 158 159 $p2 = self::factory()->post->create( array( 160 160 'post_type' => 'post', 161 161 ) ); … … 172 172 $this->set_permalink_structure( '/%postname%/' ); 173 173 174 $p = self:: $factory->post->create( array(174 $p = self::factory()->post->create( array( 175 175 'post_type' => 'post', 176 176 'post_name' => 'foo', … … 187 187 $this->set_permalink_structure( '/%postname%/' ); 188 188 189 $p = self:: $factory->post->create( array(189 $p = self::factory()->post->create( array( 190 190 'post_type' => 'post', 191 191 'post_name' => 'foo', … … 203 203 $this->set_permalink_structure( '/%year%/%postname%/' ); 204 204 205 $p = self:: $factory->post->create( array(205 $p = self::factory()->post->create( array( 206 206 'post_type' => 'post', 207 207 'post_name' => 'foo', … … 218 218 $this->set_permalink_structure( '/%year%/%postname%/' ); 219 219 220 $p = self:: $factory->post->create( array(220 $p = self::factory()->post->create( array( 221 221 'post_type' => 'post', 222 222 'post_name' => 'foo', … … 233 233 $this->set_permalink_structure( '/%year%/foo/%postname%/' ); 234 234 235 $p = self:: $factory->post->create( array(235 $p = self::factory()->post->create( array( 236 236 'post_type' => 'post', 237 237 'post_name' => 'foo', … … 248 248 $this->set_permalink_structure( '/%year%/%postname%/' ); 249 249 250 $p = self:: $factory->post->create( array(250 $p = self::factory()->post->create( array( 251 251 'post_type' => 'post', 252 252 'post_name' => 'foo', … … 263 263 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 264 264 265 $p = self:: $factory->post->create( array(265 $p = self::factory()->post->create( array( 266 266 'post_type' => 'post', 267 267 'post_name' => 'foo', … … 278 278 $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); 279 279 280 $p = self:: $factory->post->create( array(280 $p = self::factory()->post->create( array( 281 281 'post_type' => 'post', 282 282 'post_name' => 'foo', … … 293 293 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 294 294 295 $p = self:: $factory->post->create( array(295 $p = self::factory()->post->create( array( 296 296 'post_type' => 'post', 297 297 'post_name' => 'foo', -
trunk/tests/phpunit/tests/query.php
r35225 r35242 15 15 */ 16 16 function test_nested_loop_reset_postdata() { 17 $post_id = self:: $factory->post->create();18 $nested_post_id = self:: $factory->post->create();17 $post_id = self::factory()->post->create(); 18 $nested_post_id = self::factory()->post->create(); 19 19 20 20 $first_query = new WP_Query( array( 'post__in' => array( $post_id ) ) ); … … 44 44 */ 45 45 function test_pre_posts_per_page() { 46 self:: $factory->post->create_many( 10 );46 self::factory()->post->create_many( 10 ); 47 47 48 48 add_action( 'pre_get_posts', array( $this, 'filter_posts_per_page' ) ); … … 62 62 function test_tag_queried_object() { 63 63 $slug = 'tag-slug-26627'; 64 self:: $factory->tag->create( array( 'slug' => $slug ) );64 self::factory()->tag->create( array( 'slug' => $slug ) ); 65 65 $tag = get_term_by( 'slug', $slug, 'post_tag' ); 66 66 … … 95 95 remove_action( 'pre_get_posts', array( $this, 'pre_get_posts_tax_category_tax_query' ) ); 96 96 register_taxonomy( 'wptests_tax', 'post' ); 97 $terms = self:: $factory->term->create_many( 2, array(97 $terms = self::factory()->term->create_many( 2, array( 98 98 'taxonomy' => 'wptests_tax', 99 99 ) ); 100 100 101 $posts = self:: $factory->post->create_many( 2 );101 $posts = self::factory()->post->create_many( 2 ); 102 102 103 103 wp_set_object_terms( $posts[0], array( $terms[0] ), 'wptests_tax' ); … … 131 131 132 132 public function test_cat_querystring_single_term() { 133 $c1 = self:: $factory->category->create( array(133 $c1 = self::factory()->category->create( array( 134 134 'name' => 'Test Category 1', 135 135 'slug' => 'test1', 136 136 ) ); 137 $c2 = self:: $factory->category->create( array(137 $c2 = self::factory()->category->create( array( 138 138 'name' => 'Test Category 2', 139 139 'slug' => 'test2', 140 140 ) ); 141 141 142 $p1 = self:: $factory->post->create();143 $p2 = self:: $factory->post->create();144 $p3 = self:: $factory->post->create();142 $p1 = self::factory()->post->create(); 143 $p2 = self::factory()->post->create(); 144 $p3 = self::factory()->post->create(); 145 145 146 146 wp_set_object_terms( $p1, $c1, 'category' ); … … 160 160 161 161 public function test_category_querystring_multiple_terms_comma_separated() { 162 $c1 = self:: $factory->category->create( array(162 $c1 = self::factory()->category->create( array( 163 163 'name' => 'Test Category 1', 164 164 'slug' => 'test1', 165 165 ) ); 166 $c2 = self:: $factory->category->create( array(166 $c2 = self::factory()->category->create( array( 167 167 'name' => 'Test Category 2', 168 168 'slug' => 'test2', 169 169 ) ); 170 $c3 = self:: $factory->category->create( array(170 $c3 = self::factory()->category->create( array( 171 171 'name' => 'Test Category 3', 172 172 'slug' => 'test3', 173 173 ) ); 174 174 175 $p1 = self:: $factory->post->create();176 $p2 = self:: $factory->post->create();177 $p3 = self:: $factory->post->create();178 $p4 = self:: $factory->post->create();175 $p1 = self::factory()->post->create(); 176 $p2 = self::factory()->post->create(); 177 $p3 = self::factory()->post->create(); 178 $p4 = self::factory()->post->create(); 179 179 180 180 wp_set_object_terms( $p1, $c1, 'category' ); … … 198 198 */ 199 199 public function test_category_querystring_multiple_terms_formatted_as_array() { 200 $c1 = self:: $factory->category->create( array(200 $c1 = self::factory()->category->create( array( 201 201 'name' => 'Test Category 1', 202 202 'slug' => 'test1', 203 203 ) ); 204 $c2 = self:: $factory->category->create( array(204 $c2 = self::factory()->category->create( array( 205 205 'name' => 'Test Category 2', 206 206 'slug' => 'test2', 207 207 ) ); 208 $c3 = self:: $factory->category->create( array(208 $c3 = self::factory()->category->create( array( 209 209 'name' => 'Test Category 3', 210 210 'slug' => 'test3', 211 211 ) ); 212 212 213 $p1 = self:: $factory->post->create();214 $p2 = self:: $factory->post->create();215 $p3 = self:: $factory->post->create();216 $p4 = self:: $factory->post->create();213 $p1 = self::factory()->post->create(); 214 $p2 = self::factory()->post->create(); 215 $p3 = self::factory()->post->create(); 216 $p4 = self::factory()->post->create(); 217 217 218 218 wp_set_object_terms( $p1, $c1, 'category' ); … … 234 234 235 235 public function test_tag_querystring_single_term() { 236 $t1 = self:: $factory->tag->create_and_get( array(236 $t1 = self::factory()->tag->create_and_get( array( 237 237 'name' => 'Test Tag 1', 238 238 'slug' => 'test1', 239 239 ) ); 240 $t2 = self:: $factory->tag->create_and_get( array(240 $t2 = self::factory()->tag->create_and_get( array( 241 241 'name' => 'Test Tag 2', 242 242 'slug' => 'test2', 243 243 ) ); 244 244 245 $p1 = self:: $factory->post->create();246 $p2 = self:: $factory->post->create();247 $p3 = self:: $factory->post->create();245 $p1 = self::factory()->post->create(); 246 $p2 = self::factory()->post->create(); 247 $p3 = self::factory()->post->create(); 248 248 249 249 wp_set_object_terms( $p1, $t1->slug, 'post_tag' ); … … 263 263 264 264 public function test_tag_querystring_multiple_terms_comma_separated() { 265 $c1 = self:: $factory->tag->create_and_get( array(265 $c1 = self::factory()->tag->create_and_get( array( 266 266 'name' => 'Test Tag 1', 267 267 'slug' => 'test1', 268 268 ) ); 269 $c2 = self:: $factory->tag->create_and_get( array(269 $c2 = self::factory()->tag->create_and_get( array( 270 270 'name' => 'Test Tag 2', 271 271 'slug' => 'test2', 272 272 ) ); 273 $c3 = self:: $factory->tag->create_and_get( array(273 $c3 = self::factory()->tag->create_and_get( array( 274 274 'name' => 'Test Tag 3', 275 275 'slug' => 'test3', 276 276 ) ); 277 277 278 $p1 = self:: $factory->post->create();279 $p2 = self:: $factory->post->create();280 $p3 = self:: $factory->post->create();281 $p4 = self:: $factory->post->create();278 $p1 = self::factory()->post->create(); 279 $p2 = self::factory()->post->create(); 280 $p3 = self::factory()->post->create(); 281 $p4 = self::factory()->post->create(); 282 282 283 283 wp_set_object_terms( $p1, $c1->slug, 'post_tag' ); … … 301 301 */ 302 302 public function test_tag_querystring_multiple_terms_formatted_as_array() { 303 $c1 = self:: $factory->tag->create_and_get( array(303 $c1 = self::factory()->tag->create_and_get( array( 304 304 'name' => 'Test Tag 1', 305 305 'slug' => 'test1', 306 306 ) ); 307 $c2 = self:: $factory->tag->create_and_get( array(307 $c2 = self::factory()->tag->create_and_get( array( 308 308 'name' => 'Test Tag 2', 309 309 'slug' => 'test2', 310 310 ) ); 311 $c3 = self:: $factory->tag->create_and_get( array(311 $c3 = self::factory()->tag->create_and_get( array( 312 312 'name' => 'Test Tag 3', 313 313 'slug' => 'test3', 314 314 ) ); 315 315 316 $p1 = self:: $factory->post->create();317 $p2 = self:: $factory->post->create();318 $p3 = self:: $factory->post->create();319 $p4 = self:: $factory->post->create();316 $p1 = self::factory()->post->create(); 317 $p2 = self::factory()->post->create(); 318 $p3 = self::factory()->post->create(); 319 $p4 = self::factory()->post->create(); 320 320 321 321 wp_set_object_terms( $p1, $c1->slug, 'post_tag' ); … … 342 342 wp_insert_term( 'test3', 'test_tax_cat' ); 343 343 344 $p1 = self:: $factory->post->create();345 $p2 = self:: $factory->post->create();346 $p3 = self:: $factory->post->create();344 $p1 = self::factory()->post->create(); 345 $p2 = self::factory()->post->create(); 346 $p3 = self::factory()->post->create(); 347 347 348 348 wp_set_object_terms( $p1, 'test1', 'test_tax_cat' ); … … 366 366 wp_insert_term( 'test3', 'test_tax_cat' ); 367 367 368 $p1 = self:: $factory->post->create();369 $p2 = self:: $factory->post->create();370 $p3 = self:: $factory->post->create();371 $p4 = self:: $factory->post->create();368 $p1 = self::factory()->post->create(); 369 $p2 = self::factory()->post->create(); 370 $p3 = self::factory()->post->create(); 371 $p4 = self::factory()->post->create(); 372 372 373 373 wp_set_object_terms( $p1, 'test1', 'test_tax_cat' ); … … 395 395 wp_insert_term( 'test3', 'test_tax_cat' ); 396 396 397 $p1 = self:: $factory->post->create();398 $p2 = self:: $factory->post->create();399 $p3 = self:: $factory->post->create();400 $p4 = self:: $factory->post->create();397 $p1 = self::factory()->post->create(); 398 $p2 = self::factory()->post->create(); 399 $p3 = self::factory()->post->create(); 400 $p4 = self::factory()->post->create(); 401 401 402 402 wp_set_object_terms( $p1, 'test1', 'test_tax_cat' ); … … 418 418 */ 419 419 public function test_pages_dont_404_when_queried_post_id_is_modified() { 420 $post_id = self:: $factory->post->create( array( 'post_title' => 'A Test Page', 'post_type' => 'page' ) );420 $post_id = self::factory()->post->create( array( 'post_title' => 'A Test Page', 'post_type' => 'page' ) ); 421 421 422 422 add_action( 'parse_query', array( $this, 'filter_parse_query_to_modify_queried_post_id' ) ); … … 439 439 register_post_type( 'guide', array( 'name' => 'Guide', 'public' => true, 'hierarchical' => true ) ); 440 440 $wp_rewrite->flush_rules(); 441 $post_id = self:: $factory->post->create( array( 'post_title' => 'A Test Guide', 'post_type' => 'guide' ) );441 $post_id = self::factory()->post->create( array( 'post_title' => 'A Test Guide', 'post_type' => 'guide' ) ); 442 442 443 443 add_action( 'parse_query', array( $this, 'filter_parse_query_to_modify_queried_post_id' ) ); -
trunk/tests/phpunit/tests/query/conditionals.php
r35225 r35242 46 46 47 47 function test_permalink() { 48 $post_id = self:: $factory->post->create( array( 'post_title' => 'hello-world' ) );48 $post_id = self::factory()->post->create( array( 'post_title' => 'hello-world' ) ); 49 49 $this->go_to( get_permalink( $post_id ) ); 50 50 $this->assertQueryTrue('is_single', 'is_singular'); … … 52 52 53 53 function test_post_comments_feed() { 54 $post_id = self:: $factory->post->create( array( 'post_title' => 'hello-world' ) );55 self:: $factory->comment->create_post_comments( $post_id, 2 );54 $post_id = self::factory()->post->create( array( 'post_title' => 'hello-world' ) ); 55 self::factory()->comment->create_post_comments( $post_id, 2 ); 56 56 $this->go_to( get_post_comments_feed_link( $post_id ) ); 57 57 $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed'); … … 60 60 61 61 function test_post_comments_feed_with_no_comments() { 62 $post_id = self:: $factory->post->create( array( 'post_title' => 'hello-world' ) );62 $post_id = self::factory()->post->create( array( 'post_title' => 'hello-world' ) ); 63 63 $this->go_to( get_post_comments_feed_link( $post_id ) ); 64 64 $this->assertQueryTrue('is_feed', 'is_single', 'is_singular', 'is_comment_feed'); … … 66 66 67 67 function test_page() { 68 $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about' ) );68 $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'about' ) ); 69 69 $this->go_to( get_permalink( $page_id ) ); 70 70 $this->assertQueryTrue('is_page','is_singular'); … … 72 72 73 73 function test_parent_page() { 74 $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );74 $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) ); 75 75 $this->go_to( get_permalink( $page_id ) ); 76 76 … … 79 79 80 80 function test_child_page_1() { 81 $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );82 $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );81 $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) ); 82 $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) ); 83 83 $this->go_to( get_permalink( $page_id ) ); 84 84 … … 87 87 88 88 function test_child_page_2() { 89 $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );90 $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );91 $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );89 $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) ); 90 $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) ); 91 $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) ); 92 92 $this->go_to( get_permalink( $page_id ) ); 93 93 … … 98 98 function test_page_trackback() { 99 99 $page_ids = array(); 100 $page_ids[] = $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );101 $page_ids[] = $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );102 $page_ids[] = $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );100 $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) ); 101 $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) ); 102 $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) ); 103 103 foreach ( $page_ids as $page_id ) { 104 104 $url = get_permalink( $page_id ); … … 117 117 function test_page_feed() { 118 118 $page_ids = array(); 119 $page_ids[] = $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );120 $page_ids[] = $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );121 $page_ids[] = $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );119 $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) ); 120 $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) ); 121 $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) ); 122 122 foreach ( $page_ids as $page_id ) { 123 self:: $factory->comment->create_post_comments( $page_id, 2 );123 self::factory()->comment->create_post_comments( $page_id, 2 ); 124 124 $url = get_permalink( $page_id ); 125 125 $this->go_to("{$url}feed/"); … … 136 136 function test_page_feed_with_no_comments() { 137 137 $page_ids = array(); 138 $page_ids[] = $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );139 $page_ids[] = $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );140 $page_ids[] = $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );138 $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) ); 139 $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) ); 140 $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) ); 141 141 foreach ( $page_ids as $page_id ) { 142 142 $url = get_permalink( $page_id ); … … 155 155 function test_page_feed_atom() { 156 156 $page_ids = array(); 157 $page_ids[] = $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) );158 $page_ids[] = $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) );159 $page_ids[] = $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) );157 $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'parent-page' ) ); 158 $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-1', 'post_parent' => $page_id ) ); 159 $page_ids[] = $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'child-page-2', 'post_parent' => $page_id ) ); 160 160 foreach ( $page_ids as $page_id ) { 161 self:: $factory->comment->create_post_comments( $page_id, 2 );161 self::factory()->comment->create_post_comments( $page_id, 2 ); 162 162 163 163 $url = get_permalink( $page_id ); … … 175 175 // '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]' 176 176 function test_page_page_2() { 177 $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );177 $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) ); 178 178 $this->go_to("/about/page/2/"); 179 179 … … 188 188 // '(about)/page/?([0-9]{1,})/?$' => 'index.php?pagename=$matches[1]&paged=$matches[2]' 189 189 function test_page_page_2_no_slash() { 190 $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );190 $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) ); 191 191 $this->go_to("/about/page2/"); 192 192 … … 202 202 // '(about)(/[0-9]+)?/?$' => 'index.php?pagename=$matches[1]&page=$matches[2]' 203 203 function test_pagination_of_posts_page() { 204 $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) );204 $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_title' => 'about', 'post_content' => 'Page 1 <!--nextpage--> Page 2' ) ); 205 205 update_option( 'show_on_front', 'page' ); 206 206 update_option( 'page_for_posts', $page_id ); … … 224 224 // '(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]', 225 225 function test_main_feed_2() { 226 self:: $factory->post->create(); // @test_404226 self::factory()->post->create(); // @test_404 227 227 $feeds = array('feed', 'rdf', 'rss', 'rss2', 'atom'); 228 228 … … 242 242 243 243 function test_main_feed() { 244 self:: $factory->post->create(); // @test_404244 self::factory()->post->create(); // @test_404 245 245 $types = array('rss2', 'rss', 'atom'); 246 246 foreach ($types as $type) { … … 253 253 function test_paged() { 254 254 update_option( 'posts_per_page', 2 ); 255 self:: $factory->post->create_many( 5 );255 self::factory()->post->create_many( 5 ); 256 256 for ( $i = 2; $i <= 3; $i++ ) { 257 257 $this->go_to("/page/{$i}/"); … … 263 263 // 'comments/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?&feed=$matches[1]&withcomments=1', 264 264 function test_main_comments_feed() { 265 $post_id = self:: $factory->post->create( array( 'post_title' => 'hello-world' ) );266 self:: $factory->comment->create_post_comments( $post_id, 2 );265 $post_id = self::factory()->post->create( array( 'post_title' => 'hello-world' ) ); 266 self::factory()->comment->create_post_comments( $post_id, 2 ); 267 267 268 268 // check the url as generated by get_post_comments_feed_link() … … 307 307 function test_search_paged() { 308 308 update_option( 'posts_per_page', 2 ); 309 self:: $factory->post->create_many( 3, array( 'post_title' => 'test' ) );309 self::factory()->post->create_many( 3, array( 'post_title' => 'test' ) ); 310 310 $this->go_to('/search/test/page/2/'); 311 311 $this->assertQueryTrue('is_search', 'is_paged'); … … 329 329 // 'category/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?category_name=$matches[1]&feed=$matches[2]', 330 330 function test_category_feed() { 331 self:: $factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) );331 self::factory()->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) ); 332 332 // check the long form 333 333 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); … … 348 348 function test_category_paged() { 349 349 update_option( 'posts_per_page', 2 ); 350 self:: $factory->post->create_many( 3 );350 self::factory()->post->create_many( 3 ); 351 351 $this->go_to('/category/uncategorized/page/2/'); 352 352 $this->assertQueryTrue('is_archive', 'is_category', 'is_paged'); … … 355 355 // 'category/(.+?)/?$' => 'index.php?category_name=$matches[1]', 356 356 function test_category() { 357 self:: $factory->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) );357 self::factory()->term->create( array( 'name' => 'cat-a', 'taxonomy' => 'category' ) ); 358 358 $this->go_to('/category/cat-a/'); 359 359 $this->assertQueryTrue('is_archive', 'is_category'); … … 363 363 // 'tag/(.+?)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?tag=$matches[1]&feed=$matches[2]', 364 364 function test_tag_feed() { 365 self:: $factory->term->create( array( 'name' => 'tag-a', 'taxonomy' => 'post_tag' ) );365 self::factory()->term->create( array( 'name' => 'tag-a', 'taxonomy' => 'post_tag' ) ); 366 366 // check the long form 367 367 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); … … 382 382 function test_tag_paged() { 383 383 update_option( 'posts_per_page', 2 ); 384 $post_ids = self:: $factory->post->create_many( 3 );384 $post_ids = self::factory()->post->create_many( 3 ); 385 385 foreach ( $post_ids as $post_id ) 386 self:: $factory->term->add_post_terms( $post_id, 'tag-a', 'post_tag' );386 self::factory()->term->add_post_terms( $post_id, 'tag-a', 'post_tag' ); 387 387 $this->go_to('/tag/tag-a/page/2/'); 388 388 $this->assertQueryTrue('is_archive', 'is_tag', 'is_paged'); … … 391 391 // 'tag/(.+?)/?$' => 'index.php?tag=$matches[1]', 392 392 function test_tag() { 393 $term_id = self:: $factory->term->create( array( 'name' => 'Tag Named A', 'slug' => 'tag-a', 'taxonomy' => 'post_tag' ) );393 $term_id = self::factory()->term->create( array( 'name' => 'Tag Named A', 'slug' => 'tag-a', 'taxonomy' => 'post_tag' ) ); 394 394 $this->go_to('/tag/tag-a/'); 395 395 $this->assertQueryTrue('is_archive', 'is_tag'); … … 410 410 // 'author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?author_name=$matches[1]&feed=$matches[2]', 411 411 function test_author_feed() { 412 self:: $factory->user->create( array( 'user_login' => 'user-a' ) );412 self::factory()->user->create( array( 'user_login' => 'user-a' ) ); 413 413 // check the long form 414 414 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); … … 429 429 function test_author_paged() { 430 430 update_option( 'posts_per_page', 2 ); 431 $user_id = self:: $factory->user->create( array( 'user_login' => 'user-a' ) );432 self:: $factory->post->create_many( 3, array( 'post_author' => $user_id ) );431 $user_id = self::factory()->user->create( array( 'user_login' => 'user-a' ) ); 432 self::factory()->post->create_many( 3, array( 'post_author' => $user_id ) ); 433 433 $this->go_to('/author/user-a/page/2/'); 434 434 $this->assertQueryTrue('is_archive', 'is_author', 'is_paged'); … … 437 437 // 'author/([^/]+)/?$' => 'index.php?author_name=$matches[1]', 438 438 function test_author() { 439 $user_id = self:: $factory->user->create( array( 'user_login' => 'user-a' ) );440 self:: $factory->post->create( array( 'post_author' => $user_id ) );439 $user_id = self::factory()->user->create( array( 'user_login' => 'user-a' ) ); 440 self::factory()->post->create( array( 'post_author' => $user_id ) ); 441 441 $this->go_to('/author/user-a/'); 442 442 $this->assertQueryTrue('is_archive', 'is_author'); … … 444 444 445 445 function test_author_with_no_posts() { 446 $user_id = self:: $factory->user->create( array( 'user_login' => 'user-a' ) );446 $user_id = self::factory()->user->create( array( 'user_login' => 'user-a' ) ); 447 447 $this->go_to('/author/user-a/'); 448 448 $this->assertQueryTrue('is_archive', 'is_author'); … … 452 452 // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]', 453 453 function test_ymd_feed() { 454 self:: $factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );454 self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 455 455 // check the long form 456 456 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); … … 471 471 function test_ymd_paged() { 472 472 update_option( 'posts_per_page', 2 ); 473 self:: $factory->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );473 self::factory()->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) ); 474 474 $this->go_to('/2007/09/04/page/2/'); 475 475 $this->assertQueryTrue('is_archive', 'is_day', 'is_date', 'is_paged'); … … 478 478 // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]', 479 479 function test_ymd() { 480 self:: $factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );480 self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 481 481 $this->go_to('/2007/09/04/'); 482 482 $this->assertQueryTrue('is_archive', 'is_day', 'is_date'); … … 486 486 // '([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]', 487 487 function test_ym_feed() { 488 self:: $factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );488 self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 489 489 // check the long form 490 490 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); … … 505 505 function test_ym_paged() { 506 506 update_option( 'posts_per_page', 2 ); 507 self:: $factory->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );507 self::factory()->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) ); 508 508 $this->go_to('/2007/09/page/2/'); 509 509 $this->assertQueryTrue('is_archive', 'is_date', 'is_month', 'is_paged'); … … 512 512 // '([0-9]{4})/([0-9]{1,2})/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]', 513 513 function test_ym() { 514 self:: $factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );514 self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 515 515 $this->go_to('/2007/09/'); 516 516 $this->assertQueryTrue('is_archive', 'is_date', 'is_month'); … … 520 520 // '([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&feed=$matches[2]', 521 521 function test_y_feed() { 522 self:: $factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );522 self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 523 523 // check the long form 524 524 $types = array('feed', 'rdf', 'rss', 'rss2', 'atom'); … … 539 539 function test_y_paged() { 540 540 update_option( 'posts_per_page', 2 ); 541 self:: $factory->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) );541 self::factory()->post->create_many( 3, array( 'post_date' => '2007-09-04 00:00:00' ) ); 542 542 $this->go_to('/2007/page/2/'); 543 543 $this->assertQueryTrue('is_archive', 'is_date', 'is_year', 'is_paged'); … … 546 546 // '([0-9]{4})/?$' => 'index.php?year=$matches[1]', 547 547 function test_y() { 548 self:: $factory->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) );548 self::factory()->post->create( array( 'post_date' => '2007-09-04 00:00:00' ) ); 549 549 $this->go_to('/2007/'); 550 550 $this->assertQueryTrue('is_archive', 'is_date', 'is_year'); … … 553 553 // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&tb=1', 554 554 function test_post_trackback() { 555 $post_id = self:: $factory->post->create();555 $post_id = self::factory()->post->create(); 556 556 $permalink = get_permalink( $post_id ); 557 557 $this->go_to("{$permalink}trackback/"); … … 562 562 // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]', 563 563 function test_post_comment_feed() { 564 $post_id = self:: $factory->post->create();564 $post_id = self::factory()->post->create(); 565 565 $permalink = get_permalink( $post_id ); 566 566 … … 581 581 // '([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$' => 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&page=$matches[5]', 582 582 function test_post_paged_short() { 583 $post_id = self:: $factory->post->create( array(583 $post_id = self::factory()->post->create( array( 584 584 'post_date' => '2007-09-04 00:00:00', 585 585 'post_title' => 'a-post-with-multiple-pages', … … 594 594 // '[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$' => 'index.php?attachment=$matches[1]', 595 595 function test_post_attachment() { 596 $post_id = self:: $factory->post->create( array( 'post_type' => 'attachment' ) );596 $post_id = self::factory()->post->create( array( 'post_type' => 'attachment' ) ); 597 597 $permalink = get_attachment_link( $post_id ); 598 598 $this->go_to($permalink); … … 630 630 ) ); 631 631 632 $tag_id = self:: $factory->tag->create( array( 'slug' => 'tag-slug' ) );633 $post_id = self:: $factory->post->create( array( 'post_type' => $cpt_name ) );632 $tag_id = self::factory()->tag->create( array( 'slug' => 'tag-slug' ) ); 633 $post_id = self::factory()->post->create( array( 'post_type' => $cpt_name ) ); 634 634 wp_set_object_terms( $post_id, $tag_id, 'post_tag' ); 635 635 … … 664 664 'public' => true 665 665 ) ); 666 self:: $factory->post->create( array( 'post_type' => $cpt_name ) );666 self::factory()->post->create( array( 'post_type' => $cpt_name ) ); 667 667 668 668 $this->go_to( "/$cpt_name/" ); … … 684 684 685 685 function test_is_single() { 686 $post_id = self:: $factory->post->create();686 $post_id = self::factory()->post->create(); 687 687 $this->go_to( "/?p=$post_id" ); 688 688 … … 715 715 716 716 // Create parent and child posts 717 $parent_id = self:: $factory->post->create( array(717 $parent_id = self::factory()->post->create( array( 718 718 'post_type' => $post_type, 719 719 'post_name' => 'foo' 720 720 ) ); 721 721 722 $post_id = self:: $factory->post->create( array(722 $post_id = self::factory()->post->create( array( 723 723 'post_type' => $post_type, 724 724 'post_name' => 'bar', … … 751 751 */ 752 752 public function test_is_single_with_slug_that_begins_with_a_number_that_clashes_with_another_post_id() { 753 $p1 = self:: $factory->post->create();753 $p1 = self::factory()->post->create(); 754 754 755 755 $p2_name = $p1 . '-post'; 756 $p2 = self:: $factory->post->create( array(756 $p2 = self::factory()->post->create( array( 757 757 'slug' => $p2_name, 758 758 ) ); … … 769 769 770 770 function test_is_page() { 771 $post_id = self:: $factory->post->create( array( 'post_type' => 'page' ) );771 $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 772 772 $this->go_to( "/?page_id=$post_id" ); 773 773 … … 789 789 */ 790 790 function test_is_page_with_parent() { 791 $parent_id = self:: $factory->post->create( array(791 $parent_id = self::factory()->post->create( array( 792 792 'post_type' => 'page', 793 793 'post_name' => 'foo', 794 794 ) ); 795 $post_id = self:: $factory->post->create( array(795 $post_id = self::factory()->post->create( array( 796 796 'post_type' => 'page', 797 797 'post_name' => 'bar', … … 819 819 820 820 function test_is_attachment() { 821 $post_id = self:: $factory->post->create( array( 'post_type' => 'attachment' ) );821 $post_id = self::factory()->post->create( array( 'post_type' => 'attachment' ) ); 822 822 $this->go_to( "/?attachment_id=$post_id" ); 823 823 … … 840 840 */ 841 841 public function test_is_attachment_with_slug_that_begins_with_a_number_that_clashes_with_a_page_ID() { 842 $p1 = self:: $factory->post->create( array( 'post_type' => 'attachment' ) );842 $p1 = self::factory()->post->create( array( 'post_type' => 'attachment' ) ); 843 843 844 844 $p2_name = $p1 . '-attachment'; 845 $p2 = self:: $factory->post->create( array(845 $p2 = self::factory()->post->create( array( 846 846 'post_type' => 'attachment', 847 847 'post_name' => $p2_name, … … 862 862 */ 863 863 public function test_is_author_with_nicename_that_begins_with_a_number_that_clashes_with_another_author_id() { 864 $u1 = self:: $factory->user->create();864 $u1 = self::factory()->user->create(); 865 865 866 866 $u2_name = $u1 . '_user'; 867 $u2 = self:: $factory->user->create( array(867 $u2 = self::factory()->user->create( array( 868 868 'user_nicename' => $u2_name, 869 869 ) ); … … 883 883 */ 884 884 public function test_is_category_with_slug_that_begins_with_a_number_that_clashes_with_another_category_id() { 885 $c1 = self:: $factory->category->create();885 $c1 = self::factory()->category->create(); 886 886 887 887 $c2_name = $c1 . '-category'; 888 $c2 = self:: $factory->category->create( array(888 $c2 = self::factory()->category->create( array( 889 889 'slug' => $c2_name, 890 890 ) ); … … 904 904 */ 905 905 public function test_is_tag_with_slug_that_begins_with_a_number_that_clashes_with_another_tag_id() { 906 $t1 = self:: $factory->tag->create();906 $t1 = self::factory()->tag->create(); 907 907 908 908 $t2_name = $t1 . '-tag'; 909 $t2 = self:: $factory->tag->create( array(909 $t2 = self::factory()->tag->create( array( 910 910 'slug' => $t2_name, 911 911 ) ); … … 925 925 */ 926 926 public function test_is_page_with_page_id_zero_and_random_page_slug() { 927 $post_id = self:: $factory->post->create( array( 'post_type' => 'page' ) );927 $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 928 928 $this->go_to( "/?page_id=$post_id" ); 929 929 … … 947 947 */ 948 948 public function test_is_page_with_page_slug_that_begins_with_a_number_that_clashes_with_a_page_ID() { 949 $p1 = self:: $factory->post->create( array( 'post_type' => 'page' ) );949 $p1 = self::factory()->post->create( array( 'post_type' => 'page' ) ); 950 950 951 951 $p2_name = $p1 . '-page'; 952 $p2 = self:: $factory->post->create( array(952 $p2 = self::factory()->post->create( array( 953 953 'post_type' => 'page', 954 954 'post_name' => $p2_name, … … 966 966 967 967 function test_is_page_template() { 968 $post_id = self:: $factory->post->create( array( 'post_type' => 'page' ) );968 $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 969 969 update_post_meta($post_id, '_wp_page_template', 'example.php'); 970 970 $this->go_to( "/?page_id=$post_id" ); … … 976 976 */ 977 977 function test_is_page_template_default() { 978 $post_id = self:: $factory->post->create( array( 'post_type' => 'page' ) );978 $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 979 979 $this->go_to( "/?page_id=$post_id" ); 980 980 $this->assertTrue( is_page_template( 'default' ) ); … … 986 986 */ 987 987 function test_is_page_template_array() { 988 $post_id = self:: $factory->post->create( array( 'post_type' => 'page' ) );988 $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 989 989 update_post_meta($post_id, '_wp_page_template', 'example.php'); 990 990 $this->go_to( "/?page_id=$post_id" ); -
trunk/tests/phpunit/tests/query/dateQuery.php
r35225 r35242 34 34 35 35 public function test_date_query_before_array() { 36 $p1 = self:: $factory->post->create( array( 'post_date' => '2007-09-24 07:17:23',) );37 $p2 = self:: $factory->post->create( array( 'post_date' => '2008-03-29 07:17:23',) );38 $p3 = self:: $factory->post->create( array( 'post_date' => '2008-07-15 07:17:23',) );39 $p4 = self:: $factory->post->create( array( 'post_date' => '2009-06-11 07:17:23',) );36 $p1 = self::factory()->post->create( array( 'post_date' => '2007-09-24 07:17:23',) ); 37 $p2 = self::factory()->post->create( array( 'post_date' => '2008-03-29 07:17:23',) ); 38 $p3 = self::factory()->post->create( array( 'post_date' => '2008-07-15 07:17:23',) ); 39 $p4 = self::factory()->post->create( array( 'post_date' => '2009-06-11 07:17:23',) ); 40 40 41 41 $posts = $this->_get_query_result( array( … … 58 58 */ 59 59 public function test_date_query_before_array_test_defaulting() { 60 $p1 = self:: $factory->post->create( array( 'post_date' => '2007-09-24 07:17:23',) );61 $p2 = self:: $factory->post->create( array( 'post_date' => '2008-03-29 07:17:23',) );60 $p1 = self::factory()->post->create( array( 'post_date' => '2007-09-24 07:17:23',) ); 61 $p2 = self::factory()->post->create( array( 'post_date' => '2008-03-29 07:17:23',) ); 62 62 63 63 $posts = $this->_get_query_result( array( … … 75 75 76 76 public function test_date_query_before_string() { 77 $p1 = self:: $factory->post->create( array( 'post_date' => '2007-09-24 07:17:23',) );78 $p2 = self:: $factory->post->create( array( 'post_date' => '2008-03-29 07:17:23',) );79 $p3 = self:: $factory->post->create( array( 'post_date' => '2008-07-15 07:17:23',) );80 $p4 = self:: $factory->post->create( array( 'post_date' => '2009-06-11 07:17:23',) );77 $p1 = self::factory()->post->create( array( 'post_date' => '2007-09-24 07:17:23',) ); 78 $p2 = self::factory()->post->create( array( 'post_date' => '2008-03-29 07:17:23',) ); 79 $p3 = self::factory()->post->create( array( 'post_date' => '2008-07-15 07:17:23',) ); 80 $p4 = self::factory()->post->create( array( 'post_date' => '2009-06-11 07:17:23',) ); 81 81 82 82 $posts = $this->_get_query_result( array( … … 92 92 93 93 public function test_date_query_after_array() { 94 $p1 = self:: $factory->post->create( array( 'post_date' => '2009-10-18 10:42:29', ) );95 $p2 = self:: $factory->post->create( array( 'post_date' => '2009-12-18 10:42:29', ) );96 $p3 = self:: $factory->post->create( array( 'post_date' => '2010-06-11 07:17:23', ) );94 $p1 = self::factory()->post->create( array( 'post_date' => '2009-10-18 10:42:29', ) ); 95 $p2 = self::factory()->post->create( array( 'post_date' => '2009-12-18 10:42:29', ) ); 96 $p3 = self::factory()->post->create( array( 'post_date' => '2010-06-11 07:17:23', ) ); 97 97 98 98 $posts = $this->_get_query_result( array( … … 116 116 */ 117 117 public function test_date_query_after_array_test_defaulting() { 118 $p1 = self:: $factory->post->create( array( 'post_date' => '2008-12-18 10:42:29', ) );119 $p2 = self:: $factory->post->create( array( 'post_date' => '2009-01-18 10:42:29', ) );118 $p1 = self::factory()->post->create( array( 'post_date' => '2008-12-18 10:42:29', ) ); 119 $p2 = self::factory()->post->create( array( 'post_date' => '2009-01-18 10:42:29', ) ); 120 120 121 121 $posts = $this->_get_query_result( array( … … 133 133 134 134 public function test_date_query_after_string() { 135 $p1 = self:: $factory->post->create( array( 'post_date' => '2009-12-18 09:42:29', ) );136 $p2 = self:: $factory->post->create( array( 'post_date' => '2009-12-18 10:42:29', ) );137 $p3 = self:: $factory->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) );135 $p1 = self::factory()->post->create( array( 'post_date' => '2009-12-18 09:42:29', ) ); 136 $p2 = self::factory()->post->create( array( 'post_date' => '2009-12-18 10:42:29', ) ); 137 $p3 = self::factory()->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) ); 138 138 139 139 $posts = $this->_get_query_result( array( … … 149 149 150 150 public function test_date_query_after_string_inclusive() { 151 $p1 = self:: $factory->post->create( array( 'post_date' => '2009-12-18 09:42:29', ) );152 $p2 = self:: $factory->post->create( array( 'post_date' => '2009-12-18 10:42:29', ) );153 $p3 = self:: $factory->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) );151 $p1 = self::factory()->post->create( array( 'post_date' => '2009-12-18 09:42:29', ) ); 152 $p2 = self::factory()->post->create( array( 'post_date' => '2009-12-18 10:42:29', ) ); 153 $p3 = self::factory()->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) ); 154 154 155 155 $posts = $this->_get_query_result( array( … … 169 169 */ 170 170 public function test_date_query_inclusive_between_dates() { 171 $p1 = self:: $factory->post->create( array( 'post_date' => '2006-12-18 09:42:29', ) );172 $p2 = self:: $factory->post->create( array( 'post_date' => '2007-01-18 10:42:29', ) );173 $p3 = self:: $factory->post->create( array( 'post_date' => '2007-12-19 10:42:29', ) );174 $p4 = self:: $factory->post->create( array( 'post_date' => '2008-12-19 10:42:29', ) );175 $p5 = self:: $factory->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) );171 $p1 = self::factory()->post->create( array( 'post_date' => '2006-12-18 09:42:29', ) ); 172 $p2 = self::factory()->post->create( array( 'post_date' => '2007-01-18 10:42:29', ) ); 173 $p3 = self::factory()->post->create( array( 'post_date' => '2007-12-19 10:42:29', ) ); 174 $p4 = self::factory()->post->create( array( 'post_date' => '2008-12-19 10:42:29', ) ); 175 $p5 = self::factory()->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) ); 176 176 177 177 $posts = $this->_get_query_result( array( … … 196 196 */ 197 197 public function test_beforeafter_with_date_string_Y() { 198 $p1 = self:: $factory->post->create( array(198 $p1 = self::factory()->post->create( array( 199 199 'post_date' => '2008-05-06 13:00:00', 200 200 ) ); 201 $p2 = self:: $factory->post->create( array(201 $p2 = self::factory()->post->create( array( 202 202 'post_date' => '2007-05-07 13:00:00', 203 203 ) ); … … 229 229 */ 230 230 public function test_beforeafter_with_date_string_Y_inclusive() { 231 $p1 = self:: $factory->post->create( array(231 $p1 = self::factory()->post->create( array( 232 232 'post_date' => '2008-05-06 13:00:00', 233 233 ) ); 234 $p2 = self:: $factory->post->create( array(234 $p2 = self::factory()->post->create( array( 235 235 'post_date' => '2007-05-07 13:00:00', 236 236 ) ); … … 264 264 */ 265 265 public function test_beforeafter_with_date_string_Ym() { 266 $p1 = self:: $factory->post->create( array(266 $p1 = self::factory()->post->create( array( 267 267 'post_date' => '2008-05-06 13:00:00', 268 268 ) ); 269 $p2 = self:: $factory->post->create( array(269 $p2 = self::factory()->post->create( array( 270 270 'post_date' => '2008-04-07 13:00:00', 271 271 ) ); … … 297 297 */ 298 298 public function test_beforeafter_with_date_string_Ym_inclusive() { 299 $p1 = self:: $factory->post->create( array(299 $p1 = self::factory()->post->create( array( 300 300 'post_date' => '2008-05-06 13:00:00', 301 301 ) ); 302 $p2 = self:: $factory->post->create( array(302 $p2 = self::factory()->post->create( array( 303 303 'post_date' => '2008-04-07 13:00:00', 304 304 ) ); … … 332 332 */ 333 333 public function test_beforeafter_with_date_string_Ymd() { 334 $p1 = self:: $factory->post->create( array(334 $p1 = self::factory()->post->create( array( 335 335 'post_date' => '2008-05-06 13:00:00', 336 336 ) ); 337 $p2 = self:: $factory->post->create( array(337 $p2 = self::factory()->post->create( array( 338 338 'post_date' => '2008-05-05 13:00:00', 339 339 ) ); … … 365 365 */ 366 366 public function test_beforeafter_with_date_string_Ymd_inclusive() { 367 $p1 = self:: $factory->post->create( array(367 $p1 = self::factory()->post->create( array( 368 368 'post_date' => '2008-05-06 13:00:00', 369 369 ) ); 370 $p2 = self:: $factory->post->create( array(370 $p2 = self::factory()->post->create( array( 371 371 'post_date' => '2008-05-05 13:00:00', 372 372 ) ); … … 400 400 */ 401 401 public function test_beforeafter_with_date_string_YmdHi() { 402 $p1 = self:: $factory->post->create( array(402 $p1 = self::factory()->post->create( array( 403 403 'post_date' => '2008-05-06 14:05:00', 404 404 ) ); 405 $p2 = self:: $factory->post->create( array(405 $p2 = self::factory()->post->create( array( 406 406 'post_date' => '2008-05-06 14:04:00', 407 407 ) ); … … 433 433 */ 434 434 public function test_beforeafter_with_date_string_YmdHi_inclusive() { 435 $p1 = self:: $factory->post->create( array(435 $p1 = self::factory()->post->create( array( 436 436 'post_date' => '2008-05-06 14:05:00', 437 437 ) ); 438 $p2 = self:: $factory->post->create( array(438 $p2 = self::factory()->post->create( array( 439 439 'post_date' => '2008-05-06 14:04:00', 440 440 ) ); … … 468 468 */ 469 469 public function test_beforeafter_with_date_string_YmdHis() { 470 $p1 = self:: $factory->post->create( array(470 $p1 = self::factory()->post->create( array( 471 471 'post_date' => '2008-05-06 14:05:15', 472 472 ) ); 473 $p2 = self:: $factory->post->create( array(473 $p2 = self::factory()->post->create( array( 474 474 'post_date' => '2008-05-06 14:05:14', 475 475 ) ); … … 501 501 */ 502 502 public function test_beforeafter_with_date_string_YmdHis_inclusive() { 503 $p1 = self:: $factory->post->create( array(503 $p1 = self::factory()->post->create( array( 504 504 'post_date' => '2008-05-06 14:04:15', 505 505 ) ); 506 $p2 = self:: $factory->post->create( array(506 $p2 = self::factory()->post->create( array( 507 507 'post_date' => '2008-05-06 14:04:14', 508 508 ) ); … … 536 536 */ 537 537 public function test_beforeafter_with_date_string_non_parseable() { 538 $p1 = self:: $factory->post->create( array(538 $p1 = self::factory()->post->create( array( 539 539 'post_date' => '2008-05-06 14:05:15', 540 540 ) ); 541 $p2 = self:: $factory->post->create( array(541 $p2 = self::factory()->post->create( array( 542 542 'post_date' => '2008-05-06 14:05:14', 543 543 ) ); … … 565 565 566 566 public function test_date_query_year() { 567 $p1 = self:: $factory->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) );568 $p2 = self:: $factory->post->create( array( 'post_date' => '2010-12-19 10:42:29', ) );567 $p1 = self::factory()->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) ); 568 $p2 = self::factory()->post->create( array( 'post_date' => '2010-12-19 10:42:29', ) ); 569 569 $posts = $this->_get_query_result( array( 570 570 'date_query' => array( … … 579 579 580 580 public function test_date_query_month() { 581 $p1 = self:: $factory->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) );582 $p2 = self:: $factory->post->create( array( 'post_date' => '2010-11-19 10:42:29', ) );581 $p1 = self::factory()->post->create( array( 'post_date' => '2009-12-19 10:42:29', ) ); 582 $p2 = self::factory()->post->create( array( 'post_date' => '2010-11-19 10:42:29', ) ); 583 583 $posts = $this->_get_query_result( array( 584 584 'date_query' => array( … … 593 593 594 594 public function test_date_query_week() { 595 $p1 = self:: $factory->post->create( array( 'post_date' => '2009-01-02 10:42:29', ) );596 $p2 = self:: $factory->post->create( array( 'post_date' => '2010-03-19 10:42:29', ) );595 $p1 = self::factory()->post->create( array( 'post_date' => '2009-01-02 10:42:29', ) ); 596 $p2 = self::factory()->post->create( array( 'post_date' => '2010-03-19 10:42:29', ) ); 597 597 $posts = $this->_get_query_result( array( 598 598 'date_query' => array( … … 607 607 608 608 public function test_date_query_day() { 609 $p1 = self:: $factory->post->create( array( 'post_date' => '2009-01-17 10:42:29', ) );610 $p2 = self:: $factory->post->create( array( 'post_date' => '2009-01-18 10:42:29', ) );609 $p1 = self::factory()->post->create( array( 'post_date' => '2009-01-17 10:42:29', ) ); 610 $p2 = self::factory()->post->create( array( 'post_date' => '2009-01-18 10:42:29', ) ); 611 611 612 612 $posts = $this->_get_query_result( array( … … 622 622 623 623 public function test_date_query_dayofweek() { 624 $p1 = self:: $factory->post->create( array( 'post_date' => '2014-10-21 10:42:29', ) );625 $p2 = self:: $factory->post->create( array( 'post_date' => '2014-10-20 10:42:29', ) );624 $p1 = self::factory()->post->create( array( 'post_date' => '2014-10-21 10:42:29', ) ); 625 $p2 = self::factory()->post->create( array( 'post_date' => '2014-10-20 10:42:29', ) ); 626 626 627 627 $posts = $this->_get_query_result( array( … … 640 640 */ 641 641 public function test_date_query_dayofweek_iso() { 642 $p1 = self:: $factory->post->create( array( 'post_date' => '2014-10-31 10:42:29', ) );643 $p2 = self:: $factory->post->create( array( 'post_date' => '2014-10-30 10:42:29', ) );642 $p1 = self::factory()->post->create( array( 'post_date' => '2014-10-31 10:42:29', ) ); 643 $p2 = self::factory()->post->create( array( 'post_date' => '2014-10-30 10:42:29', ) ); 644 644 645 645 $posts = $this->_get_query_result( array( … … 655 655 656 656 public function test_date_query_hour() { 657 $p1 = self:: $factory->post->create( array( 'post_date' => '2014-10-21 13:42:29', ) );658 $p2 = self:: $factory->post->create( array( 'post_date' => '2014-10-21 12:42:29', ) );657 $p1 = self::factory()->post->create( array( 'post_date' => '2014-10-21 13:42:29', ) ); 658 $p2 = self::factory()->post->create( array( 'post_date' => '2014-10-21 12:42:29', ) ); 659 659 660 660 $posts = $this->_get_query_result( array( … … 674 674 public function test_date_query_hour_should_not_ignore_0() { 675 675 return; 676 $p1 = self:: $factory->post->create( array( 'post_date' => '2014-10-21 00:42:29', ) );677 $p2 = self:: $factory->post->create( array( 'post_date' => '2014-10-21 01:42:29', ) );676 $p1 = self::factory()->post->create( array( 'post_date' => '2014-10-21 00:42:29', ) ); 677 $p2 = self::factory()->post->create( array( 'post_date' => '2014-10-21 01:42:29', ) ); 678 678 679 679 $posts = $this->_get_query_result( array( … … 689 689 690 690 public function test_date_query_minute() { 691 $p1 = self:: $factory->post->create( array( 'post_date' => '2014-10-21 10:56:29', ) );692 $p2 = self:: $factory->post->create( array( 'post_date' => '2014-10-21 10:42:29', ) );691 $p1 = self::factory()->post->create( array( 'post_date' => '2014-10-21 10:56:29', ) ); 692 $p2 = self::factory()->post->create( array( 'post_date' => '2014-10-21 10:42:29', ) ); 693 693 694 694 $posts = $this->_get_query_result( array( … … 704 704 705 705 public function test_date_query_second() { 706 $p1 = self:: $factory->post->create( array( 'post_date' => '2014-10-21 10:42:21', ) );707 $p2 = self:: $factory->post->create( array( 'post_date' => '2014-10-21 10:42:29', ) );706 $p1 = self::factory()->post->create( array( 'post_date' => '2014-10-21 10:42:21', ) ); 707 $p2 = self::factory()->post->create( array( 'post_date' => '2014-10-21 10:42:29', ) ); 708 708 709 709 $posts = $this->_get_query_result( array( … … 719 719 720 720 public function test_date_query_between_two_times() { 721 $p1 = self:: $factory->post->create( array( 'post_date' => '2005-12-18 08:42:29', ) );722 $p2 = self:: $factory->post->create( array( 'post_date' => '2006-12-18 09:00:29', ) );723 $p3 = self:: $factory->post->create( array( 'post_date' => '2007-12-18 10:42:29', ) );724 $p4 = self:: $factory->post->create( array( 'post_date' => '2008-12-18 17:00:29', ) );725 $p5 = self:: $factory->post->create( array( 'post_date' => '2009-12-18 18:42:29', ) );721 $p1 = self::factory()->post->create( array( 'post_date' => '2005-12-18 08:42:29', ) ); 722 $p2 = self::factory()->post->create( array( 'post_date' => '2006-12-18 09:00:29', ) ); 723 $p3 = self::factory()->post->create( array( 'post_date' => '2007-12-18 10:42:29', ) ); 724 $p4 = self::factory()->post->create( array( 'post_date' => '2008-12-18 17:00:29', ) ); 725 $p5 = self::factory()->post->create( array( 'post_date' => '2009-12-18 18:42:29', ) ); 726 726 727 727 $posts = $this->_get_query_result( array( … … 744 744 745 745 public function test_date_query_relation_or() { 746 $p1 = self:: $factory->post->create( array( 'post_date' => '2006-12-18 14:42:29', ) );747 $p2 = self:: $factory->post->create( array( 'post_date' => '2007-01-18 10:42:29', ) );748 $p3 = self:: $factory->post->create( array( 'post_date' => '2007-12-19 10:34:29', ) );746 $p1 = self::factory()->post->create( array( 'post_date' => '2006-12-18 14:42:29', ) ); 747 $p2 = self::factory()->post->create( array( 'post_date' => '2007-01-18 10:42:29', ) ); 748 $p3 = self::factory()->post->create( array( 'post_date' => '2007-12-19 10:34:29', ) ); 749 749 750 750 $posts = $this->_get_query_result( array( … … 764 764 765 765 public function test_date_query_compare_greater_than_or_equal_to() { 766 $p1 = self:: $factory->post->create( array( 'post_date' => '2006-12-18 13:42:29', ) );767 $p2 = self:: $factory->post->create( array( 'post_date' => '2007-01-18 14:34:29', ) );768 $p3 = self:: $factory->post->create( array( 'post_date' => '2007-12-19 14:37:29', ) );769 $p4 = self:: $factory->post->create( array( 'post_date' => '2007-12-19 15:34:29', ) );766 $p1 = self::factory()->post->create( array( 'post_date' => '2006-12-18 13:42:29', ) ); 767 $p2 = self::factory()->post->create( array( 'post_date' => '2007-01-18 14:34:29', ) ); 768 $p3 = self::factory()->post->create( array( 'post_date' => '2007-12-19 14:37:29', ) ); 769 $p4 = self::factory()->post->create( array( 'post_date' => '2007-12-19 15:34:29', ) ); 770 770 771 771 $posts = $this->_get_query_result( array( … … 785 785 global $wpdb; 786 786 787 $p1 = self:: $factory->post->create( array( 'post_date' => '2006-05-18 13:42:29', ) );788 $p2 = self:: $factory->post->create( array( 'post_date' => '2007-09-18 14:34:29', ) );789 $p3 = self:: $factory->post->create( array( 'post_date' => '2007-01-18 14:34:29', ) );787 $p1 = self::factory()->post->create( array( 'post_date' => '2006-05-18 13:42:29', ) ); 788 $p2 = self::factory()->post->create( array( 'post_date' => '2007-09-18 14:34:29', ) ); 789 $p3 = self::factory()->post->create( array( 'post_date' => '2007-01-18 14:34:29', ) ); 790 790 791 791 $posts = $this->_get_query_result( array( … … 805 805 global $wpdb; 806 806 807 $p1 = self:: $factory->post->create( array( 'post_date' => '2014-10-01 13:42:29', ) );808 $p2 = self:: $factory->post->create( array( 'post_date' => '2014-10-22 14:34:29', ) );809 $p3 = self:: $factory->post->create( array( 'post_date' => '2014-10-15 14:34:29', ) );807 $p1 = self::factory()->post->create( array( 'post_date' => '2014-10-01 13:42:29', ) ); 808 $p2 = self::factory()->post->create( array( 'post_date' => '2014-10-22 14:34:29', ) ); 809 $p3 = self::factory()->post->create( array( 'post_date' => '2014-10-15 14:34:29', ) ); 810 810 811 811 $posts = $this->_get_query_result( array( … … 826 826 */ 827 827 public function test_date_query_with_taxonomy_join() { 828 $p1 = self:: $factory->post->create( array(828 $p1 = self::factory()->post->create( array( 829 829 'post_date' => '2013-04-27 01:01:01', 830 830 ) ); 831 $p2 = self:: $factory->post->create( array(831 $p2 = self::factory()->post->create( array( 832 832 'post_date' => '2013-03-21 01:01:01', 833 833 ) ); … … 858 858 */ 859 859 public function test_date_query_one_nested_query() { 860 $p1 = self:: $factory->post->create( array( 'post_date' => '2004-10-01 13:42:29', ) );861 $p2 = self:: $factory->post->create( array( 'post_date' => '2004-01-22 14:34:29', ) );862 $p3 = self:: $factory->post->create( array( 'post_date' => '1984-10-15 14:34:29', ) );863 $p4 = self:: $factory->post->create( array( 'post_date' => '1985-10-15 14:34:29', ) );860 $p1 = self::factory()->post->create( array( 'post_date' => '2004-10-01 13:42:29', ) ); 861 $p2 = self::factory()->post->create( array( 'post_date' => '2004-01-22 14:34:29', ) ); 862 $p3 = self::factory()->post->create( array( 'post_date' => '1984-10-15 14:34:29', ) ); 863 $p4 = self::factory()->post->create( array( 'post_date' => '1985-10-15 14:34:29', ) ); 864 864 $posts = $this->_get_query_result( array( 865 865 'date_query' => array( … … 887 887 */ 888 888 public function test_date_query_one_nested_query_multiple_columns_relation_and() { 889 $p1 = self:: $factory->post->create( array(889 $p1 = self::factory()->post->create( array( 890 890 'post_date' => '2012-03-05 15:30:55', 891 891 ) ); 892 892 $this->update_post_modified( $p1, '2014-11-03 14:43:00' ); 893 893 894 $p2 = self:: $factory->post->create( array(894 $p2 = self::factory()->post->create( array( 895 895 'post_date' => '2012-05-05 15:30:55', 896 896 ) ); 897 897 $this->update_post_modified( $p2, '2014-10-03 14:43:00' ); 898 898 899 $p3 = self:: $factory->post->create( array(899 $p3 = self::factory()->post->create( array( 900 900 'post_date' => '2013-05-05 15:30:55', 901 901 ) ); 902 902 $this->update_post_modified( $p3, '2014-10-03 14:43:00' ); 903 903 904 $p4 = self:: $factory->post->create( array(904 $p4 = self::factory()->post->create( array( 905 905 'post_date' => '2012-02-05 15:30:55', 906 906 ) ); … … 938 938 */ 939 939 public function test_date_query_nested_query_multiple_columns_mixed_relations() { 940 $p1 = self:: $factory->post->create( array(940 $p1 = self::factory()->post->create( array( 941 941 'post_date' => '2012-03-05 15:30:55', 942 942 ) ); 943 943 $this->update_post_modified( $p1, '2014-11-03 14:43:00' ); 944 944 945 $p2 = self:: $factory->post->create( array(945 $p2 = self::factory()->post->create( array( 946 946 'post_date' => '2012-05-05 15:30:55', 947 947 ) ); 948 948 $this->update_post_modified( $p2, '2014-10-03 14:43:00' ); 949 949 950 $p3 = self:: $factory->post->create( array(950 $p3 = self::factory()->post->create( array( 951 951 'post_date' => '2013-05-05 15:30:55', 952 952 ) ); 953 953 $this->update_post_modified( $p3, '2014-10-03 14:43:00' ); 954 954 955 $p4 = self:: $factory->post->create( array(955 $p4 = self::factory()->post->create( array( 956 956 'post_date' => '2012-02-05 15:30:55', 957 957 ) ); 958 958 $this->update_post_modified( $p4, '2012-12-03 14:43:00' ); 959 959 960 $p5 = self:: $factory->post->create( array(960 $p5 = self::factory()->post->create( array( 961 961 'post_date' => '2014-02-05 15:30:55', 962 962 ) ); -
trunk/tests/phpunit/tests/query/isTerm.php
r35225 r35242 38 38 flush_rewrite_rules(); 39 39 40 $this->tag_id = self:: $factory->tag->create( array( 'slug' => 'tag-slug' ) );41 $this->cat_id = self:: $factory->category->create( array( 'slug' => 'cat-slug' ) );42 $this->tax_id = self:: $factory->term->create( array( 'taxonomy' => 'testtax', 'slug' => 'tax-slug' ) );43 $this->tax_id2 = self:: $factory->term->create( array( 'taxonomy' => 'testtax', 'slug' => 'tax-slug2' ) );44 $this->post_id = self:: $factory->post->create();40 $this->tag_id = self::factory()->tag->create( array( 'slug' => 'tag-slug' ) ); 41 $this->cat_id = self::factory()->category->create( array( 'slug' => 'cat-slug' ) ); 42 $this->tax_id = self::factory()->term->create( array( 'taxonomy' => 'testtax', 'slug' => 'tax-slug' ) ); 43 $this->tax_id2 = self::factory()->term->create( array( 'taxonomy' => 'testtax', 'slug' => 'tax-slug2' ) ); 44 $this->post_id = self::factory()->post->create(); 45 45 wp_set_object_terms( $this->post_id, $this->cat_id, 'category' ); 46 46 wp_set_object_terms( $this->post_id, array( $this->tax_id, $this->tax_id2 ), 'testtax' ); … … 246 246 247 247 register_taxonomy( 'testtax2', 'post' ); 248 $testtax2_term_id = self:: $factory->term->create( array(248 $testtax2_term_id = self::factory()->term->create( array( 249 249 'taxonomy' => 'testtax2', 250 250 'slug' => 'testtax2-slug', -
trunk/tests/phpunit/tests/query/metaQuery.php
r35225 r35242 7 7 class Tests_Query_MetaQuery extends WP_UnitTestCase { 8 8 public function test_meta_query_no_key() { 9 $p1 = self:: $factory->post->create();10 $p2 = self:: $factory->post->create();11 $p3 = self:: $factory->post->create();9 $p1 = self::factory()->post->create(); 10 $p2 = self::factory()->post->create(); 11 $p3 = self::factory()->post->create(); 12 12 13 13 add_post_meta( $p1, 'foo', 'bar' ); … … 31 31 32 32 public function test_meta_query_no_value() { 33 $p1 = self:: $factory->post->create();34 $p2 = self:: $factory->post->create();35 $p3 = self:: $factory->post->create();33 $p1 = self::factory()->post->create(); 34 $p2 = self::factory()->post->create(); 35 $p3 = self::factory()->post->create(); 36 36 37 37 add_post_meta( $p1, 'foo', 'bar' ); … … 55 55 56 56 public function test_meta_query_single_query_compare_default() { 57 $p1 = self:: $factory->post->create();58 $p2 = self:: $factory->post->create();57 $p1 = self::factory()->post->create(); 58 $p2 = self::factory()->post->create(); 59 59 60 60 add_post_meta( $p1, 'foo', 'bar' ); … … 77 77 78 78 public function test_meta_query_single_query_compare_equals() { 79 $p1 = self:: $factory->post->create();80 $p2 = self:: $factory->post->create();79 $p1 = self::factory()->post->create(); 80 $p2 = self::factory()->post->create(); 81 81 82 82 add_post_meta( $p1, 'foo', 'bar' ); … … 100 100 101 101 public function test_meta_query_single_query_compare_not_equals() { 102 $p1 = self:: $factory->post->create();103 $p2 = self:: $factory->post->create();104 $p3 = self:: $factory->post->create();102 $p1 = self::factory()->post->create(); 103 $p2 = self::factory()->post->create(); 104 $p3 = self::factory()->post->create(); 105 105 106 106 add_post_meta( $p1, 'foo', 'bar' ); … … 125 125 126 126 public function test_meta_query_single_query_compare_arithmetic_comparisons() { 127 $p1 = self:: $factory->post->create();128 $p2 = self:: $factory->post->create();129 $p3 = self:: $factory->post->create();127 $p1 = self::factory()->post->create(); 128 $p2 = self::factory()->post->create(); 129 $p3 = self::factory()->post->create(); 130 130 131 131 add_post_meta( $p1, 'foo', '1' ); … … 203 203 204 204 public function test_meta_query_single_query_compare_like() { 205 $p1 = self:: $factory->post->create();206 $p2 = self:: $factory->post->create();205 $p1 = self::factory()->post->create(); 206 $p2 = self::factory()->post->create(); 207 207 208 208 add_post_meta( $p1, 'foo', 'bar' ); … … 226 226 227 227 public function test_meta_query_single_query_compare_not_like() { 228 $p1 = self:: $factory->post->create();229 $p2 = self:: $factory->post->create();230 $p3 = self:: $factory->post->create();228 $p1 = self::factory()->post->create(); 229 $p2 = self::factory()->post->create(); 230 $p3 = self::factory()->post->create(); 231 231 232 232 add_post_meta( $p1, 'foo', 'bar' ); … … 251 251 252 252 public function test_meta_query_single_query_compare_between_not_between() { 253 $p1 = self:: $factory->post->create();254 $p2 = self:: $factory->post->create();255 $p3 = self:: $factory->post->create();253 $p1 = self::factory()->post->create(); 254 $p2 = self::factory()->post->create(); 255 $p3 = self::factory()->post->create(); 256 256 257 257 add_post_meta( $p1, 'foo', '1' ); … … 295 295 296 296 public function test_meta_query_single_query_compare_regexp_rlike() { 297 $p1 = self:: $factory->post->create();298 $p2 = self:: $factory->post->create();297 $p1 = self::factory()->post->create(); 298 $p2 = self::factory()->post->create(); 299 299 300 300 add_post_meta( $p1, 'foo', 'bar' ); … … 336 336 337 337 public function test_meta_query_single_query_compare_not_regexp() { 338 $p1 = self:: $factory->post->create();339 $p2 = self:: $factory->post->create();338 $p1 = self::factory()->post->create(); 339 $p2 = self::factory()->post->create(); 340 340 341 341 add_post_meta( $p1, 'foo', 'bar' ); … … 360 360 361 361 public function test_meta_query_relation_default() { 362 $p1 = self:: $factory->post->create();363 $p2 = self:: $factory->post->create();364 $p3 = self:: $factory->post->create();362 $p1 = self::factory()->post->create(); 363 $p2 = self::factory()->post->create(); 364 $p3 = self::factory()->post->create(); 365 365 366 366 add_post_meta( $p1, 'foo', 'foo value 1' ); … … 390 390 391 391 public function test_meta_query_relation_or() { 392 $post_id = self:: $factory->post->create();392 $post_id = self::factory()->post->create(); 393 393 add_post_meta( $post_id, 'foo', rand_str() ); 394 394 add_post_meta( $post_id, 'foo', rand_str() ); 395 $post_id2 = self:: $factory->post->create();395 $post_id2 = self::factory()->post->create(); 396 396 add_post_meta( $post_id2, 'bar', 'val2' ); 397 $post_id3 = self:: $factory->post->create();397 $post_id3 = self::factory()->post->create(); 398 398 add_post_meta( $post_id3, 'baz', rand_str() ); 399 $post_id4 = self:: $factory->post->create();399 $post_id4 = self::factory()->post->create(); 400 400 add_post_meta( $post_id4, 'froo', rand_str() ); 401 $post_id5 = self:: $factory->post->create();401 $post_id5 = self::factory()->post->create(); 402 402 add_post_meta( $post_id5, 'tango', 'val2' ); 403 $post_id6 = self:: $factory->post->create();403 $post_id6 = self::factory()->post->create(); 404 404 add_post_meta( $post_id6, 'bar', 'val1' ); 405 405 … … 431 431 432 432 public function test_meta_query_relation_and() { 433 $post_id = self:: $factory->post->create();433 $post_id = self::factory()->post->create(); 434 434 add_post_meta( $post_id, 'foo', rand_str() ); 435 435 add_post_meta( $post_id, 'foo', rand_str() ); 436 $post_id2 = self:: $factory->post->create();436 $post_id2 = self::factory()->post->create(); 437 437 add_post_meta( $post_id2, 'bar', 'val2' ); 438 438 add_post_meta( $post_id2, 'foo', rand_str() ); 439 $post_id3 = self:: $factory->post->create();439 $post_id3 = self::factory()->post->create(); 440 440 add_post_meta( $post_id3, 'baz', rand_str() ); 441 $post_id4 = self:: $factory->post->create();441 $post_id4 = self::factory()->post->create(); 442 442 add_post_meta( $post_id4, 'froo', rand_str() ); 443 $post_id5 = self:: $factory->post->create();443 $post_id5 = self::factory()->post->create(); 444 444 add_post_meta( $post_id5, 'tango', 'val2' ); 445 $post_id6 = self:: $factory->post->create();445 $post_id6 = self::factory()->post->create(); 446 446 add_post_meta( $post_id6, 'bar', 'val1' ); 447 447 add_post_meta( $post_id6, 'foo', rand_str() ); 448 $post_id7 = self:: $factory->post->create();448 $post_id7 = self::factory()->post->create(); 449 449 add_post_meta( $post_id7, 'foo', rand_str() ); 450 450 add_post_meta( $post_id7, 'froo', rand_str() ); … … 500 500 */ 501 501 public function test_meta_query_compare_exists() { 502 $posts = self:: $factory->post->create_many( 3 );502 $posts = self::factory()->post->create_many( 3 ); 503 503 add_post_meta( $posts[0], 'foo', 'bar' ); 504 504 add_post_meta( $posts[2], 'foo', 'baz' ); … … 521 521 */ 522 522 public function test_meta_query_compare_exists_with_value_should_convert_to_equals() { 523 $posts = self:: $factory->post->create_many( 3 );523 $posts = self::factory()->post->create_many( 3 ); 524 524 add_post_meta( $posts[0], 'foo', 'bar' ); 525 525 add_post_meta( $posts[2], 'foo', 'baz' ); … … 543 543 */ 544 544 public function test_meta_query_compare_not_exists_should_ignore_value() { 545 $posts = self:: $factory->post->create_many( 3 );545 $posts = self::factory()->post->create_many( 3 ); 546 546 add_post_meta( $posts[0], 'foo', 'bar' ); 547 547 add_post_meta( $posts[2], 'foo', 'baz' ); … … 565 565 */ 566 566 public function test_meta_query_compare_not_exists() { 567 $post_id = self:: $factory->post->create();567 $post_id = self::factory()->post->create(); 568 568 add_post_meta( $post_id, 'foo', rand_str() ); 569 $post_id2 = self:: $factory->post->create();569 $post_id2 = self::factory()->post->create(); 570 570 add_post_meta( $post_id2, 'bar', rand_str() ); 571 $post_id3 = self:: $factory->post->create();571 $post_id3 = self::factory()->post->create(); 572 572 add_post_meta( $post_id3, 'bar', rand_str() ); 573 $post_id4 = self:: $factory->post->create();573 $post_id4 = self::factory()->post->create(); 574 574 add_post_meta( $post_id4, 'baz', rand_str() ); 575 $post_id5 = self:: $factory->post->create();575 $post_id5 = self::factory()->post->create(); 576 576 add_post_meta( $post_id5, 'foo', rand_str() ); 577 577 … … 637 637 */ 638 638 public function test_meta_query_compare_not_exists_with_another_condition_relation_or() { 639 $posts = self:: $factory->post->create_many( 4 );639 $posts = self::factory()->post->create_many( 4 ); 640 640 update_post_meta( $posts[0], 'color', 'orange' ); 641 641 update_post_meta( $posts[1], 'color', 'blue' ); … … 673 673 */ 674 674 public function test_meta_query_relation_or_compare_equals() { 675 $posts = self:: $factory->post->create_many( 4 );675 $posts = self::factory()->post->create_many( 4 ); 676 676 add_post_meta( $posts[0], 'color', 'orange' ); 677 677 add_post_meta( $posts[1], 'color', 'blue' ); … … 706 706 */ 707 707 public function test_meta_query_relation_or_compare_equals_different_keys() { 708 $posts = self:: $factory->post->create_many( 4 );708 $posts = self::factory()->post->create_many( 4 ); 709 709 add_post_meta( $posts[0], 'color', 'orange' ); 710 710 add_post_meta( $posts[1], 'color', 'blue' ); … … 739 739 */ 740 740 public function test_meta_query_relation_or_compare_equals_and_in() { 741 $posts = self:: $factory->post->create_many( 4 );741 $posts = self::factory()->post->create_many( 4 ); 742 742 add_post_meta( $posts[0], 'color', 'orange' ); 743 743 add_post_meta( $posts[1], 'color', 'blue' ); … … 772 772 */ 773 773 public function test_meta_query_relation_or_compare_equals_and_like() { 774 $posts = self:: $factory->post->create_many( 4 );774 $posts = self::factory()->post->create_many( 4 ); 775 775 add_post_meta( $posts[0], 'color', 'orange' ); 776 776 add_post_meta( $posts[1], 'color', 'blue' ); … … 805 805 */ 806 806 public function test_meta_query_relation_or_compare_equals_and_between() { 807 $posts = self:: $factory->post->create_many( 4 );807 $posts = self::factory()->post->create_many( 4 ); 808 808 add_post_meta( $posts[0], 'number_of_colors', '2' ); 809 809 add_post_meta( $posts[1], 'number_of_colors', '5' ); … … 839 839 */ 840 840 public function test_meta_query_relation_and_compare_in_same_keys() { 841 $posts = self:: $factory->post->create_many( 4 );841 $posts = self::factory()->post->create_many( 4 ); 842 842 add_post_meta( $posts[0], 'color', 'orange' ); 843 843 add_post_meta( $posts[1], 'color', 'blue' ); … … 874 874 */ 875 875 public function test_meta_query_relation_and_compare_in_different_keys() { 876 $posts = self:: $factory->post->create_many( 4 );876 $posts = self::factory()->post->create_many( 4 ); 877 877 add_post_meta( $posts[0], 'color', 'orange' ); 878 878 add_post_meta( $posts[1], 'color', 'blue' ); … … 909 909 */ 910 910 public function test_meta_query_relation_and_compare_not_equals() { 911 $posts = self:: $factory->post->create_many( 4 );911 $posts = self::factory()->post->create_many( 4 ); 912 912 add_post_meta( $posts[0], 'color', 'orange' ); 913 913 add_post_meta( $posts[1], 'color', 'blue' ); … … 943 943 */ 944 944 public function test_meta_query_relation_and_compare_not_equals_different_keys() { 945 $posts = self:: $factory->post->create_many( 4 );945 $posts = self::factory()->post->create_many( 4 ); 946 946 947 947 // !shallot, but orange. … … 984 984 */ 985 985 public function test_meta_query_relation_and_compare_not_equals_not_in() { 986 $posts = self:: $factory->post->create_many( 4 );986 $posts = self::factory()->post->create_many( 4 ); 987 987 add_post_meta( $posts[0], 'color', 'orange' ); 988 988 add_post_meta( $posts[1], 'color', 'blue' ); … … 1018 1018 */ 1019 1019 public function test_meta_query_relation_and_compare_not_equals_and_not_like() { 1020 $posts = self:: $factory->post->create_many( 4 );1020 $posts = self::factory()->post->create_many( 4 ); 1021 1021 add_post_meta( $posts[0], 'color', 'orange' ); 1022 1022 add_post_meta( $posts[1], 'color', 'blue' ); … … 1052 1052 */ 1053 1053 public function test_meta_query_decimal_results() { 1054 $post_1 = self:: $factory->post->create();1055 $post_2 = self:: $factory->post->create();1056 $post_3 = self:: $factory->post->create();1057 $post_4 = self:: $factory->post->create();1054 $post_1 = self::factory()->post->create(); 1055 $post_2 = self::factory()->post->create(); 1056 $post_3 = self::factory()->post->create(); 1057 $post_4 = self::factory()->post->create(); 1058 1058 1059 1059 update_post_meta( $post_1, 'decimal_value', '-0.3' ); … … 1227 1227 */ 1228 1228 public function test_meta_query_with_orderby_meta_value_relation_or() { 1229 $posts = self:: $factory->post->create_many( 4 );1229 $posts = self::factory()->post->create_many( 4 ); 1230 1230 update_post_meta( $posts[0], 'foo', 5 ); 1231 1231 update_post_meta( $posts[1], 'foo', 6 ); … … 1266 1266 */ 1267 1267 public function test_meta_query_with_orderby_meta_value_relation_and() { 1268 $posts = self:: $factory->post->create_many( 4 );1268 $posts = self::factory()->post->create_many( 4 ); 1269 1269 update_post_meta( $posts[0], 'foo', 5 ); 1270 1270 update_post_meta( $posts[1], 'foo', 6 ); … … 1309 1309 */ 1310 1310 public function test_meta_query_nested() { 1311 $p1 = self:: $factory->post->create();1312 $p2 = self:: $factory->post->create();1313 $p3 = self:: $factory->post->create();1311 $p1 = self::factory()->post->create(); 1312 $p2 = self::factory()->post->create(); 1313 $p3 = self::factory()->post->create(); 1314 1314 1315 1315 add_post_meta( $p1, 'foo', 'bar' ); … … 1350 1350 */ 1351 1351 public function test_meta_query_nested_two_levels_deep() { 1352 $p1 = self:: $factory->post->create();1353 $p2 = self:: $factory->post->create();1354 $p3 = self:: $factory->post->create();1352 $p1 = self::factory()->post->create(); 1353 $p2 = self::factory()->post->create(); 1354 $p3 = self::factory()->post->create(); 1355 1355 1356 1356 add_post_meta( $p1, 'foo', 'bar' ); … … 1395 1395 1396 1396 public function test_meta_between_not_between() { 1397 $post_id = self:: $factory->post->create();1397 $post_id = self::factory()->post->create(); 1398 1398 add_post_meta( $post_id, 'time', 500 ); 1399 $post_id2 = self:: $factory->post->create();1399 $post_id2 = self::factory()->post->create(); 1400 1400 add_post_meta( $post_id2, 'time', 1001 ); 1401 $post_id3 = self:: $factory->post->create();1401 $post_id3 = self::factory()->post->create(); 1402 1402 add_post_meta( $post_id3, 'time', 0 ); 1403 $post_id4 = self:: $factory->post->create();1403 $post_id4 = self::factory()->post->create(); 1404 1404 add_post_meta( $post_id4, 'time', 1 ); 1405 $post_id5 = self:: $factory->post->create();1405 $post_id5 = self::factory()->post->create(); 1406 1406 add_post_meta( $post_id5, 'time', 1000 ); 1407 1407 … … 1444 1444 public function test_meta_default_compare() { 1445 1445 // compare should default to IN when meta_value is an array 1446 $post_id = self:: $factory->post->create();1446 $post_id = self::factory()->post->create(); 1447 1447 add_post_meta( $post_id, 'foo', 'bar' ); 1448 $post_id2 = self:: $factory->post->create();1448 $post_id2 = self::factory()->post->create(); 1449 1449 add_post_meta( $post_id2, 'bar', 'baz' ); 1450 $post_id3 = self:: $factory->post->create();1450 $post_id3 = self::factory()->post->create(); 1451 1451 add_post_meta( $post_id3, 'foo', 'baz' ); 1452 $post_id4 = self:: $factory->post->create();1452 $post_id4 = self::factory()->post->create(); 1453 1453 add_post_meta( $post_id4, 'baz', 'bar' ); 1454 $post_id5 = self:: $factory->post->create();1454 $post_id5 = self::factory()->post->create(); 1455 1455 add_post_meta( $post_id5, 'foo', rand_str() ); 1456 1456 … … 1483 1483 */ 1484 1484 public function test_duplicate_posts_when_no_key() { 1485 $post_id = self:: $factory->post->create();1485 $post_id = self::factory()->post->create(); 1486 1486 add_post_meta( $post_id, 'city', 'Lorem' ); 1487 1487 add_post_meta( $post_id, 'address', '123 Lorem St.' ); 1488 $post_id2 = self:: $factory->post->create();1488 $post_id2 = self::factory()->post->create(); 1489 1489 add_post_meta( $post_id2, 'city', 'Lorem' ); 1490 $post_id3 = self:: $factory->post->create();1490 $post_id3 = self::factory()->post->create(); 1491 1491 add_post_meta( $post_id3, 'city', 'Loren' ); 1492 1492 … … 1514 1514 */ 1515 1515 public function test_empty_meta_value() { 1516 $post_id = self:: $factory->post->create();1516 $post_id = self::factory()->post->create(); 1517 1517 add_post_meta( $post_id, 'foo', '0' ); 1518 1518 add_post_meta( $post_id, 'bar', 0 ); 1519 $post_id2 = self:: $factory->post->create();1519 $post_id2 = self::factory()->post->create(); 1520 1520 add_post_meta( $post_id2, 'foo', 1 ); 1521 $post_id3 = self:: $factory->post->create();1521 $post_id3 = self::factory()->post->create(); 1522 1522 add_post_meta( $post_id3, 'baz', 0 ); 1523 $post_id4 = self:: $factory->post->create();1523 $post_id4 = self::factory()->post->create(); 1524 1524 add_post_meta( $post_id4, 'baz', 0 ); 1525 $post_id5 = self:: $factory->post->create();1525 $post_id5 = self::factory()->post->create(); 1526 1526 add_post_meta( $post_id5, 'baz', 0 ); 1527 1527 add_post_meta( $post_id5, 'bar', '0' ); 1528 $post_id6 = self:: $factory->post->create();1528 $post_id6 = self::factory()->post->create(); 1529 1529 add_post_meta( $post_id6, 'baz', 0 ); 1530 1530 … … 1578 1578 */ 1579 1579 public function test_orderby_clause_key() { 1580 $posts = self:: $factory->post->create_many( 3 );1580 $posts = self::factory()->post->create_many( 3 ); 1581 1581 add_post_meta( $posts[0], 'foo', 'aaa' ); 1582 1582 add_post_meta( $posts[1], 'foo', 'zzz' ); … … 1602 1602 */ 1603 1603 public function test_orderby_clause_key_as_secondary_sort() { 1604 $p1 = self:: $factory->post->create( array(1604 $p1 = self::factory()->post->create( array( 1605 1605 'post_date' => '2015-01-28 03:00:00', 1606 1606 ) ); 1607 $p2 = self:: $factory->post->create( array(1607 $p2 = self::factory()->post->create( array( 1608 1608 'post_date' => '2015-01-28 05:00:00', 1609 1609 ) ); 1610 $p3 = self:: $factory->post->create( array(1610 $p3 = self::factory()->post->create( array( 1611 1611 'post_date' => '2015-01-28 03:00:00', 1612 1612 ) ); … … 1637 1637 */ 1638 1638 public function test_orderby_more_than_one_clause_key() { 1639 $posts = self:: $factory->post->create_many( 3 );1639 $posts = self::factory()->post->create_many( 3 ); 1640 1640 1641 1641 add_post_meta( $posts[0], 'foo', 'jjj' ); -
trunk/tests/phpunit/tests/query/postStatus.php
r35225 r35242 212 212 register_post_type( 'foo_pt' ); 213 213 register_post_status( 'foo_ps', array( 'public' => false ) ); 214 $p = self:: $factory->post->create( array( 'post_status' => 'foo_ps' ) );214 $p = self::factory()->post->create( array( 'post_status' => 'foo_ps' ) ); 215 215 216 216 $q = new WP_Query( array( … … 224 224 register_post_type( 'foo_pt' ); 225 225 register_post_status( 'foo_ps', array( 'public' => false, 'protected' => true ) ); 226 $p = self:: $factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$editor_user_id ) );226 $p = self::factory()->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$editor_user_id ) ); 227 227 228 228 wp_set_current_user( self::$author_user_id ); … … 238 238 register_post_type( 'foo_pt' ); 239 239 register_post_status( 'foo_ps', array( 'public' => false, 'protected' => true ) ); 240 $p = self:: $factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$author_user_id ) );240 $p = self::factory()->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$author_user_id ) ); 241 241 242 242 wp_set_current_user( self::$editor_user_id ); … … 252 252 register_post_type( 'foo_pt' ); 253 253 register_post_status( 'foo_ps', array( 'public' => false, 'private' => true ) ); 254 $p = self:: $factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$editor_user_id ) );254 $p = self::factory()->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$editor_user_id ) ); 255 255 256 256 wp_set_current_user( self::$author_user_id ); … … 266 266 register_post_type( 'foo_pt' ); 267 267 register_post_status( 'foo_ps', array( 'public' => false, 'private' => true ) ); 268 $p = self:: $factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$author_user_id ) );268 $p = self::factory()->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$author_user_id ) ); 269 269 270 270 wp_set_current_user( self::$editor_user_id ); … … 280 280 register_post_type( 'foo_pt' ); 281 281 register_post_status( 'foo_ps', array( 'public' => false ) ); 282 $p = self:: $factory->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$author_user_id ) );282 $p = self::factory()->post->create( array( 'post_status' => 'foo_ps', 'post_author' => self::$author_user_id ) ); 283 283 284 284 wp_set_current_user( self::$editor_user_id ); … … 295 295 */ 296 296 public function test_specific_post_should_be_returned_if_trash_is_one_of_the_requested_post_statuses() { 297 $p1 = self:: $factory->post->create( array( 'post_status' => 'trash' ) );298 $p2 = self:: $factory->post->create( array( 'post_status' => 'publish' ) );297 $p1 = self::factory()->post->create( array( 'post_status' => 'trash' ) ); 298 $p2 = self::factory()->post->create( array( 'post_status' => 'publish' ) ); 299 299 300 300 $q = new WP_Query( array( -
trunk/tests/phpunit/tests/query/results.php
r35225 r35242 457 457 */ 458 458 function test_query_author_vars() { 459 $author_1 = self:: $factory->user->create( array( 'user_login' => 'admin1', 'user_pass' => rand_str(), 'role' => 'author' ) );460 $post_1 = self:: $factory->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_1, 'post_date' => '2007-01-01 00:00:00' ) );461 462 $author_2 = self:: $factory->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) );463 $post_2 = self:: $factory->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_2, 'post_date' => '2007-01-01 00:00:00' ) );464 465 $author_3 = self:: $factory->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) );466 $post_3 = self:: $factory->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_3, 'post_date' => '2007-01-01 00:00:00' ) );467 468 $author_4 = self:: $factory->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) );469 $post_4 = self:: $factory->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_4, 'post_date' => '2007-01-01 00:00:00' ) );459 $author_1 = self::factory()->user->create( array( 'user_login' => 'admin1', 'user_pass' => rand_str(), 'role' => 'author' ) ); 460 $post_1 = self::factory()->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_1, 'post_date' => '2007-01-01 00:00:00' ) ); 461 462 $author_2 = self::factory()->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) ); 463 $post_2 = self::factory()->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_2, 'post_date' => '2007-01-01 00:00:00' ) ); 464 465 $author_3 = self::factory()->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) ); 466 $post_3 = self::factory()->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_3, 'post_date' => '2007-01-01 00:00:00' ) ); 467 468 $author_4 = self::factory()->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) ); 469 $post_4 = self::factory()->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_4, 'post_date' => '2007-01-01 00:00:00' ) ); 470 470 471 471 $posts = $this->q->query( array( … … 624 624 */ 625 625 function test_post_password() { 626 $one = (string) self:: $factory->post->create( array( 'post_password' => '' ) );627 $two = (string) self:: $factory->post->create( array( 'post_password' => 'burrito' ) );628 $three = (string) self:: $factory->post->create( array( 'post_password' => 'burrito' ) );626 $one = (string) self::factory()->post->create( array( 'post_password' => '' ) ); 627 $two = (string) self::factory()->post->create( array( 'post_password' => 'burrito' ) ); 628 $three = (string) self::factory()->post->create( array( 'post_password' => 'burrito' ) ); 629 629 630 630 $args = array( 'post__in' => array( $one, $two, $three ), 'fields' => 'ids' ); … … 666 666 register_post_type( 'handbook', array( 'hierarchical' => true ) ); 667 667 668 $post_1 = self:: $factory->post->create( array( 'post_title' => 'Getting Started', 'post_type' => 'handbook' ) );669 $post_2 = self:: $factory->post->create( array( 'post_title' => 'Contributing to the WordPress Codex', 'post_type' => 'handbook' ) );670 $post_3 = self:: $factory->post->create( array( 'post_title' => 'Getting Started', 'post_parent' => $post_2, 'post_type' => 'handbook' ) );668 $post_1 = self::factory()->post->create( array( 'post_title' => 'Getting Started', 'post_type' => 'handbook' ) ); 669 $post_2 = self::factory()->post->create( array( 'post_title' => 'Contributing to the WordPress Codex', 'post_type' => 'handbook' ) ); 670 $post_3 = self::factory()->post->create( array( 'post_title' => 'Getting Started', 'post_parent' => $post_2, 'post_type' => 'handbook' ) ); 671 671 672 672 $result = $this->q->query( array( 'handbook' => 'getting-started', 'post_type' => 'handbook' ) ); … … 680 680 register_post_type( 'handbook', array( 'hierarchical' => true ) ); 681 681 682 $post_1 = self:: $factory->post->create( array( 'post_title' => 'Contributing to the WordPress Codex', 'post_type' => 'handbook' ) );683 $post_2 = self:: $factory->post->create( array( 'post_title' => 'Getting Started', 'post_parent' => $post_1, 'post_type' => 'handbook' ) );682 $post_1 = self::factory()->post->create( array( 'post_title' => 'Contributing to the WordPress Codex', 'post_type' => 'handbook' ) ); 683 $post_2 = self::factory()->post->create( array( 'post_title' => 'Getting Started', 'post_parent' => $post_1, 'post_type' => 'handbook' ) ); 684 684 685 685 $this->assertContains( 'contributing-to-the-wordpress-codex/getting-started', get_permalink( $post_2 ) ); … … 691 691 function test_title() { 692 692 $title = 'Tacos are Cool'; 693 $post_id = self:: $factory->post->create( array(693 $post_id = self::factory()->post->create( array( 694 694 'post_title' => $title, 695 695 'post_type' => 'post', -
trunk/tests/phpunit/tests/query/search.php
r35225 r35242 32 32 function test_search_order_title_relevance() { 33 33 foreach ( range( 1, 7 ) as $i ) 34 self:: $factory->post->create( array( 'post_content' => $i . rand_str() . ' about', 'post_type' => $this->post_type ) );35 $post_id = self:: $factory->post->create( array( 'post_title' => 'About', 'post_type' => $this->post_type ) );34 self::factory()->post->create( array( 'post_content' => $i . rand_str() . ' about', 'post_type' => $this->post_type ) ); 35 $post_id = self::factory()->post->create( array( 'post_title' => 'About', 'post_type' => $this->post_type ) ); 36 36 37 37 $posts = $this->get_search_results( 'About' ); … … 64 64 */ 65 65 public function test_s_should_exclude_term_prefixed_with_dash() { 66 $p1 = self:: $factory->post->create( array(66 $p1 = self::factory()->post->create( array( 67 67 'post_status' => 'publish', 68 68 'post_content' => 'This post has foo but also bar', 69 69 ) ); 70 $p2 = self:: $factory->post->create( array(70 $p2 = self::factory()->post->create( array( 71 71 'post_status' => 'publish', 72 72 'post_content' => 'This post has only foo', … … 85 85 */ 86 86 public function test_s_should_exclude_first_term_if_prefixed_with_dash() { 87 $p1 = self:: $factory->post->create( array(87 $p1 = self::factory()->post->create( array( 88 88 'post_status' => 'publish', 89 89 'post_content' => 'This post has foo but also bar', 90 90 ) ); 91 $p2 = self:: $factory->post->create( array(91 $p2 = self::factory()->post->create( array( 92 92 'post_status' => 'publish', 93 93 'post_content' => 'This post has only bar', … … 106 106 */ 107 107 public function test_s_should_not_exclude_for_dashes_in_the_middle_of_words() { 108 $p1 = self:: $factory->post->create( array(108 $p1 = self::factory()->post->create( array( 109 109 'post_status' => 'publish', 110 110 'post_content' => 'This post has foo but also bar', 111 111 ) ); 112 $p2 = self:: $factory->post->create( array(112 $p2 = self::factory()->post->create( array( 113 113 'post_status' => 'publish', 114 114 'post_content' => 'This post has only bar', 115 115 ) ); 116 $p3 = self:: $factory->post->create( array(116 $p3 = self::factory()->post->create( array( 117 117 'post_status' => 'publish', 118 118 'post_content' => 'This post has only foo-bar', -
trunk/tests/phpunit/tests/query/setupPostdata.php
r35225 r35242 40 40 41 41 public function test_id() { 42 $p = self:: $factory->post->create_and_get();42 $p = self::factory()->post->create_and_get(); 43 43 setup_postdata( $p ); 44 44 … … 51 51 */ 52 52 public function test_setup_by_id() { 53 $p = self:: $factory->post->create_and_get();53 $p = self::factory()->post->create_and_get(); 54 54 setup_postdata( $p->ID ); 55 55 … … 73 73 */ 74 74 public function test_setup_by_postish_object() { 75 $p = self:: $factory->post->create();75 $p = self::factory()->post->create(); 76 76 77 77 $post = new stdClass(); … … 83 83 84 84 public function test_authordata() { 85 $u = self:: $factory->user->create_and_get();86 $p = self:: $factory->post->create_and_get( array(85 $u = self::factory()->user->create_and_get(); 86 $p = self::factory()->post->create_and_get( array( 87 87 'post_author' => $u->ID, 88 88 ) ); … … 94 94 95 95 public function test_currentday() { 96 $p = self:: $factory->post->create_and_get( array(96 $p = self::factory()->post->create_and_get( array( 97 97 'post_date' => '1980-09-09 06:30:00', 98 98 ) ); … … 103 103 104 104 public function test_currentmonth() { 105 $p = self:: $factory->post->create_and_get( array(105 $p = self::factory()->post->create_and_get( array( 106 106 'post_date' => '1980-09-09 06:30:00', 107 107 ) ); … … 112 112 113 113 public function test_secondary_query_post_vars() { 114 $users = self:: $factory->user->create_many( 2 );115 116 $post1 = self:: $factory->post->create_and_get( array(114 $users = self::factory()->user->create_many( 2 ); 115 116 $post1 = self::factory()->post->create_and_get( array( 117 117 'post_author' => $users[0], 118 118 'post_date' => '2012-02-02 02:00:00', 119 119 ) ); 120 120 121 $post2 = self:: $factory->post->create_and_get( array(121 $post2 = self::factory()->post->create_and_get( array( 122 122 'post_author' => $users[1], 123 123 'post_date' => '2013-03-03 03:00:00', … … 158 158 159 159 public function test_single_page() { 160 $post = self:: $factory->post->create_and_get( array(160 $post = self::factory()->post->create_and_get( array( 161 161 'post_content' => 'Page 0', 162 162 ) ); … … 169 169 170 170 public function test_multi_page() { 171 $post = self:: $factory->post->create_and_get( array(171 $post = self::factory()->post->create_and_get( array( 172 172 'post_content' => 'Page 0<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3', 173 173 ) ); … … 183 183 */ 184 184 public function test_nextpage_at_start_of_content() { 185 $post = self:: $factory->post->create_and_get( array(185 $post = self::factory()->post->create_and_get( array( 186 186 'post_content' => '<!--nextpage-->Page 1<!--nextpage-->Page 2<!--nextpage-->Page 3', 187 187 ) ); … … 194 194 195 195 public function test_trim_nextpage_linebreaks() { 196 $post = self:: $factory->post->create_and_get( array(196 $post = self::factory()->post->create_and_get( array( 197 197 'post_content' => "Page 0\n<!--nextpage-->\nPage 1\nhas a line break\n<!--nextpage-->Page 2<!--nextpage-->\n\nPage 3", 198 198 ) ); … … 206 206 */ 207 207 public function test_secondary_query_nextpage() { 208 $post1 = self:: $factory->post->create( array(208 $post1 = self::factory()->post->create( array( 209 209 'post_content' => 'Post 1 Page 1<!--nextpage-->Post 1 Page 2', 210 210 ) ); 211 $post2 = self:: $factory->post->create( array(211 $post2 = self::factory()->post->create( array( 212 212 'post_content' => 'Post 2 Page 1<!--nextpage-->Post 2 Page 2', 213 213 ) ); … … 238 238 239 239 public function test_page_from_wp_query() { 240 $page = self:: $factory->post->create_and_get( array(240 $page = self::factory()->post->create_and_get( array( 241 241 'post_type' => 'page', 242 242 ) ); … … 251 251 252 252 public function test_page_when_on_page() { 253 $page = self:: $factory->post->create_and_get( array(253 $page = self::factory()->post->create_and_get( array( 254 254 'post_type' => 'page', 255 255 ) ); … … 264 264 */ 265 265 public function test_secondary_query_page() { 266 $post = self:: $factory->post->create_and_get();266 $post = self::factory()->post->create_and_get(); 267 267 $this->go_to( '/?page=3' ); 268 268 setup_postdata( $post ); … … 272 272 273 273 // Secondary loop. 274 $posts = self:: $factory->post->create_many( 5 );274 $posts = self::factory()->post->create_many( 5 ); 275 275 $q = new WP_Query( array( 276 276 'page' => 4, … … 295 295 */ 296 296 public function test_more_when_on_setup_post() { 297 $post = self:: $factory->post->create_and_get();297 $post = self::factory()->post->create_and_get(); 298 298 $this->go_to( get_permalink( $post ) ); 299 299 setup_postdata( $post ); … … 308 308 */ 309 309 public function test_more_when_on_single() { 310 $post1 = self:: $factory->post->create_and_get();311 $post2 = self:: $factory->post->create_and_get();310 $post1 = self::factory()->post->create_and_get(); 311 $post2 = self::factory()->post->create_and_get(); 312 312 $this->go_to( get_permalink( $post1 ) ); 313 313 setup_postdata( $post2 ); … … 322 322 */ 323 323 public function test_more_when_on_page() { 324 $post = self:: $factory->post->create_and_get();325 $page = self:: $factory->post->create_and_get( array(324 $post = self::factory()->post->create_and_get(); 325 $page = self::factory()->post->create_and_get( array( 326 326 'post_type' => 'page', 327 327 ) ); … … 336 336 */ 337 337 public function test_more_when_on_feed() { 338 $post = self:: $factory->post->create_and_get();338 $post = self::factory()->post->create_and_get(); 339 339 $this->go_to( '/?feed=rss' ); 340 340 setup_postdata( $post ); … … 348 348 */ 349 349 public function test_secondary_query_more() { 350 $post = self:: $factory->post->create_and_get();350 $post = self::factory()->post->create_and_get(); 351 351 $this->go_to( get_permalink( $post ) ); 352 352 setup_postdata( $post ); … … 380 380 */ 381 381 function test_setup_postdata_loop() { 382 $post_id = self:: $factory->post->create( array( 'post_content' => 'global post' ) );382 $post_id = self::factory()->post->create( array( 'post_content' => 'global post' ) ); 383 383 $GLOBALS['wp_query']->post = $GLOBALS['post'] = get_post( $post_id ); 384 384 385 $ids = self:: $factory->post->create_many(5);385 $ids = self::factory()->post->create_many(5); 386 386 foreach ( $ids as $id ) { 387 387 $page = get_post( $id ); -
trunk/tests/phpunit/tests/query/taxQuery.php
r35225 r35242 7 7 class Tests_Query_TaxQuery extends WP_UnitTestCase { 8 8 public function test_tax_query_single_query_single_term_field_slug() { 9 $t = self:: $factory->term->create( array(9 $t = self::factory()->term->create( array( 10 10 'taxonomy' => 'category', 11 11 'slug' => 'foo', 12 12 'name' => 'Foo', 13 13 ) ); 14 $p1 = self:: $factory->post->create();15 $p2 = self:: $factory->post->create();14 $p1 = self::factory()->post->create(); 15 $p2 = self::factory()->post->create(); 16 16 17 17 wp_set_post_terms( $p1, $t, 'category' ); … … 34 34 35 35 public function test_tax_query_single_query_single_term_field_name() { 36 $t = self:: $factory->term->create( array(36 $t = self::factory()->term->create( array( 37 37 'taxonomy' => 'category', 38 38 'slug' => 'foo', 39 39 'name' => 'Foo', 40 40 ) ); 41 $p1 = self:: $factory->post->create();42 $p2 = self:: $factory->post->create();41 $p1 = self::factory()->post->create(); 42 $p2 = self::factory()->post->create(); 43 43 44 44 wp_set_post_terms( $p1, $t, 'category' ); … … 66 66 register_taxonomy( 'wptests_tax', 'post' ); 67 67 68 $t = self:: $factory->term->create( array(68 $t = self::factory()->term->create( array( 69 69 'taxonomy' => 'wptests_tax', 70 70 'slug' => 'foo', 71 71 'name' => 'Foo Bar', 72 72 ) ); 73 $p1 = self:: $factory->post->create();74 $p2 = self:: $factory->post->create();73 $p1 = self::factory()->post->create(); 74 $p2 = self::factory()->post->create(); 75 75 76 76 wp_set_object_terms( $p1, $t, 'wptests_tax' ); … … 91 91 92 92 public function test_tax_query_single_query_single_term_field_term_taxonomy_id() { 93 $t = self:: $factory->term->create( array(93 $t = self::factory()->term->create( array( 94 94 'taxonomy' => 'category', 95 95 'slug' => 'foo', 96 96 'name' => 'Foo', 97 97 ) ); 98 $p1 = self:: $factory->post->create();99 $p2 = self:: $factory->post->create();98 $p1 = self::factory()->post->create(); 99 $p2 = self::factory()->post->create(); 100 100 101 101 $tt_ids = wp_set_post_terms( $p1, $t, 'category' ); … … 118 118 119 119 public function test_tax_query_single_query_single_term_field_term_id() { 120 $t = self:: $factory->term->create( array(120 $t = self::factory()->term->create( array( 121 121 'taxonomy' => 'category', 122 122 'slug' => 'foo', 123 123 'name' => 'Foo', 124 124 ) ); 125 $p1 = self:: $factory->post->create();126 $p2 = self:: $factory->post->create();125 $p1 = self::factory()->post->create(); 126 $p2 = self::factory()->post->create(); 127 127 128 128 wp_set_post_terms( $p1, $t, 'category' ); … … 145 145 146 146 public function test_tax_query_single_query_single_term_operator_in() { 147 $t = self:: $factory->term->create( array(147 $t = self::factory()->term->create( array( 148 148 'taxonomy' => 'category', 149 149 'slug' => 'foo', 150 150 'name' => 'Foo', 151 151 ) ); 152 $p1 = self:: $factory->post->create();153 $p2 = self:: $factory->post->create();152 $p1 = self::factory()->post->create(); 153 $p2 = self::factory()->post->create(); 154 154 155 155 wp_set_post_terms( $p1, $t, 'category' ); … … 173 173 174 174 public function test_tax_query_single_query_single_term_operator_not_in() { 175 $t = self:: $factory->term->create( array(175 $t = self::factory()->term->create( array( 176 176 'taxonomy' => 'category', 177 177 'slug' => 'foo', 178 178 'name' => 'Foo', 179 179 ) ); 180 $p1 = self:: $factory->post->create();181 $p2 = self:: $factory->post->create();180 $p1 = self::factory()->post->create(); 181 $p2 = self::factory()->post->create(); 182 182 183 183 wp_set_post_terms( $p1, $t, 'category' ); … … 201 201 202 202 public function test_tax_query_single_query_single_term_operator_and() { 203 $t = self:: $factory->term->create( array(203 $t = self::factory()->term->create( array( 204 204 'taxonomy' => 'category', 205 205 'slug' => 'foo', 206 206 'name' => 'Foo', 207 207 ) ); 208 $p1 = self:: $factory->post->create();209 $p2 = self:: $factory->post->create();208 $p1 = self::factory()->post->create(); 209 $p2 = self::factory()->post->create(); 210 210 211 211 wp_set_post_terms( $p1, $t, 'category' ); … … 229 229 230 230 public function test_tax_query_single_query_multiple_terms_operator_in() { 231 $t1 = self:: $factory->term->create( array(231 $t1 = self::factory()->term->create( array( 232 232 'taxonomy' => 'category', 233 233 'slug' => 'foo', 234 234 'name' => 'Foo', 235 235 ) ); 236 $t2 = self:: $factory->term->create( array(236 $t2 = self::factory()->term->create( array( 237 237 'taxonomy' => 'category', 238 238 'slug' => 'bar', 239 239 'name' => 'Bar', 240 240 ) ); 241 $p1 = self:: $factory->post->create();242 $p2 = self:: $factory->post->create();243 $p3 = self:: $factory->post->create();241 $p1 = self::factory()->post->create(); 242 $p2 = self::factory()->post->create(); 243 $p3 = self::factory()->post->create(); 244 244 245 245 wp_set_post_terms( $p1, $t1, 'category' ); … … 264 264 265 265 public function test_tax_query_single_query_multiple_terms_operator_not_in() { 266 $t1 = self:: $factory->term->create( array(266 $t1 = self::factory()->term->create( array( 267 267 'taxonomy' => 'category', 268 268 'slug' => 'foo', 269 269 'name' => 'Foo', 270 270 ) ); 271 $t2 = self:: $factory->term->create( array(271 $t2 = self::factory()->term->create( array( 272 272 'taxonomy' => 'category', 273 273 'slug' => 'bar', 274 274 'name' => 'Bar', 275 275 ) ); 276 $p1 = self:: $factory->post->create();277 $p2 = self:: $factory->post->create();278 $p3 = self:: $factory->post->create();276 $p1 = self::factory()->post->create(); 277 $p2 = self::factory()->post->create(); 278 $p3 = self::factory()->post->create(); 279 279 280 280 wp_set_post_terms( $p1, $t1, 'category' ); … … 302 302 */ 303 303 public function test_tax_query_single_query_multiple_queries_operator_not_in() { 304 $t1 = self:: $factory->term->create( array(304 $t1 = self::factory()->term->create( array( 305 305 'taxonomy' => 'category', 306 306 'slug' => 'foo', 307 307 'name' => 'Foo', 308 308 ) ); 309 $t2 = self:: $factory->term->create( array(309 $t2 = self::factory()->term->create( array( 310 310 'taxonomy' => 'category', 311 311 'slug' => 'bar', 312 312 'name' => 'Bar', 313 313 ) ); 314 $p1 = self:: $factory->post->create();315 $p2 = self:: $factory->post->create();316 $p3 = self:: $factory->post->create();314 $p1 = self::factory()->post->create(); 315 $p2 = self::factory()->post->create(); 316 $p3 = self::factory()->post->create(); 317 317 318 318 wp_set_post_terms( $p1, $t1, 'category' ); … … 344 344 345 345 public function test_tax_query_single_query_multiple_terms_operator_and() { 346 $t1 = self:: $factory->term->create( array(346 $t1 = self::factory()->term->create( array( 347 347 'taxonomy' => 'category', 348 348 'slug' => 'foo', 349 349 'name' => 'Foo', 350 350 ) ); 351 $t2 = self:: $factory->term->create( array(351 $t2 = self::factory()->term->create( array( 352 352 'taxonomy' => 'category', 353 353 'slug' => 'bar', 354 354 'name' => 'Bar', 355 355 ) ); 356 $p1 = self:: $factory->post->create();357 $p2 = self:: $factory->post->create();358 $p3 = self:: $factory->post->create();356 $p1 = self::factory()->post->create(); 357 $p2 = self::factory()->post->create(); 358 $p3 = self::factory()->post->create(); 359 359 360 360 wp_set_object_terms( $p1, $t1, 'category' ); … … 385 385 register_taxonomy( 'wptests_tax2', 'post' ); 386 386 387 $t1 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );388 $t2 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );389 390 $p1 = self:: $factory->post->create();391 $p2 = self:: $factory->post->create();392 $p3 = self:: $factory->post->create();387 $t1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax1' ) ); 388 $t2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax2' ) ); 389 390 $p1 = self::factory()->post->create(); 391 $p2 = self::factory()->post->create(); 392 $p3 = self::factory()->post->create(); 393 393 394 394 wp_set_object_terms( $p1, array( $t1 ), 'wptests_tax1' ); … … 417 417 register_taxonomy( 'wptests_tax2', 'post' ); 418 418 419 $t1 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );420 $t2 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );421 422 $p1 = self:: $factory->post->create();423 $p2 = self:: $factory->post->create();424 $p3 = self:: $factory->post->create();419 $t1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax1' ) ); 420 $t2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax2' ) ); 421 422 $p1 = self::factory()->post->create(); 423 $p2 = self::factory()->post->create(); 424 $p3 = self::factory()->post->create(); 425 425 426 426 wp_set_object_terms( $p1, array( $t1 ), 'wptests_tax1' ); … … 449 449 register_taxonomy( 'wptests_tax2', 'post' ); 450 450 451 $t1 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );452 $t2 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );453 454 $p1 = self:: $factory->post->create();455 $p2 = self:: $factory->post->create();456 $p3 = self:: $factory->post->create();451 $t1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax1' ) ); 452 $t2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax2' ) ); 453 454 $p1 = self::factory()->post->create(); 455 $p2 = self::factory()->post->create(); 456 $p3 = self::factory()->post->create(); 457 457 458 458 wp_set_object_terms( $p1, array( $t1 ), 'wptests_tax1' ); … … 482 482 register_taxonomy( 'wptests_tax2', 'post' ); 483 483 484 $t1 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );485 $t2 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );486 487 $p1 = self:: $factory->post->create();488 $p2 = self:: $factory->post->create();489 $p3 = self:: $factory->post->create();484 $t1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax1' ) ); 485 $t2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax2' ) ); 486 487 $p1 = self::factory()->post->create(); 488 $p2 = self::factory()->post->create(); 489 $p3 = self::factory()->post->create(); 490 490 491 491 wp_set_object_terms( $p1, array( $t1 ), 'wptests_tax1' ); … … 507 507 508 508 public function test_tax_query_multiple_queries_relation_and() { 509 $t1 = self:: $factory->term->create( array(509 $t1 = self::factory()->term->create( array( 510 510 'taxonomy' => 'category', 511 511 'slug' => 'foo', 512 512 'name' => 'Foo', 513 513 ) ); 514 $t2 = self:: $factory->term->create( array(514 $t2 = self::factory()->term->create( array( 515 515 'taxonomy' => 'category', 516 516 'slug' => 'bar', 517 517 'name' => 'Bar', 518 518 ) ); 519 $p1 = self:: $factory->post->create();520 $p2 = self:: $factory->post->create();521 $p3 = self:: $factory->post->create();519 $p1 = self::factory()->post->create(); 520 $p2 = self::factory()->post->create(); 521 $p3 = self::factory()->post->create(); 522 522 523 523 wp_set_object_terms( $p1, $t1, 'category' ); … … 547 547 548 548 public function test_tax_query_multiple_queries_relation_or() { 549 $t1 = self:: $factory->term->create( array(549 $t1 = self::factory()->term->create( array( 550 550 'taxonomy' => 'category', 551 551 'slug' => 'foo', 552 552 'name' => 'Foo', 553 553 ) ); 554 $t2 = self:: $factory->term->create( array(554 $t2 = self::factory()->term->create( array( 555 555 'taxonomy' => 'category', 556 556 'slug' => 'bar', 557 557 'name' => 'Bar', 558 558 ) ); 559 $p1 = self:: $factory->post->create();560 $p2 = self:: $factory->post->create();561 $p3 = self:: $factory->post->create();559 $p1 = self::factory()->post->create(); 560 $p2 = self::factory()->post->create(); 561 $p3 = self::factory()->post->create(); 562 562 563 563 wp_set_object_terms( $p1, $t1, 'category' ); … … 587 587 588 588 public function test_tax_query_multiple_queries_different_taxonomies() { 589 $t1 = self:: $factory->term->create( array(589 $t1 = self::factory()->term->create( array( 590 590 'taxonomy' => 'post_tag', 591 591 'slug' => 'foo', 592 592 'name' => 'Foo', 593 593 ) ); 594 $t2 = self:: $factory->term->create( array(594 $t2 = self::factory()->term->create( array( 595 595 'taxonomy' => 'category', 596 596 'slug' => 'bar', 597 597 'name' => 'Bar', 598 598 ) ); 599 $p1 = self:: $factory->post->create();600 $p2 = self:: $factory->post->create();601 $p3 = self:: $factory->post->create();599 $p1 = self::factory()->post->create(); 600 $p2 = self::factory()->post->create(); 601 $p3 = self::factory()->post->create(); 602 602 603 603 wp_set_object_terms( $p1, $t1, 'post_tag' ); … … 633 633 register_taxonomy( 'bar', 'post' ); 634 634 635 $foo_term_1 = self:: $factory->term->create( array(635 $foo_term_1 = self::factory()->term->create( array( 636 636 'taxonomy' => 'foo', 637 637 ) ); 638 $foo_term_2 = self:: $factory->term->create( array(638 $foo_term_2 = self::factory()->term->create( array( 639 639 'taxonomy' => 'foo', 640 640 ) ); 641 $bar_term_1 = self:: $factory->term->create( array(641 $bar_term_1 = self::factory()->term->create( array( 642 642 'taxonomy' => 'bar', 643 643 ) ); 644 $bar_term_2 = self:: $factory->term->create( array(644 $bar_term_2 = self::factory()->term->create( array( 645 645 'taxonomy' => 'bar', 646 646 ) ); 647 647 648 $p1 = self:: $factory->post->create();649 $p2 = self:: $factory->post->create();650 $p3 = self:: $factory->post->create();648 $p1 = self::factory()->post->create(); 649 $p2 = self::factory()->post->create(); 650 $p3 = self::factory()->post->create(); 651 651 652 652 wp_set_object_terms( $p1, array( $foo_term_1 ), 'foo' ); … … 705 705 register_taxonomy( 'bar', 'post' ); 706 706 707 $foo_term_1 = self:: $factory->term->create( array(707 $foo_term_1 = self::factory()->term->create( array( 708 708 'taxonomy' => 'foo', 709 709 ) ); 710 $foo_term_2 = self:: $factory->term->create( array(710 $foo_term_2 = self::factory()->term->create( array( 711 711 'taxonomy' => 'foo', 712 712 ) ); 713 $bar_term_1 = self:: $factory->term->create( array(713 $bar_term_1 = self::factory()->term->create( array( 714 714 'taxonomy' => 'bar', 715 715 ) ); 716 $bar_term_2 = self:: $factory->term->create( array(716 $bar_term_2 = self::factory()->term->create( array( 717 717 'taxonomy' => 'bar', 718 718 ) ); 719 719 720 $p1 = self:: $factory->post->create();721 $p2 = self:: $factory->post->create();722 $p3 = self:: $factory->post->create();720 $p1 = self::factory()->post->create(); 721 $p2 = self::factory()->post->create(); 722 $p3 = self::factory()->post->create(); 723 723 724 724 wp_set_object_terms( $p1, array( $foo_term_1 ), 'foo' ); … … 769 769 register_taxonomy( 'bar', 'post' ); 770 770 771 $foo_term_1 = self:: $factory->term->create( array(771 $foo_term_1 = self::factory()->term->create( array( 772 772 'taxonomy' => 'foo', 773 773 ) ); 774 $foo_term_2 = self:: $factory->term->create( array(774 $foo_term_2 = self::factory()->term->create( array( 775 775 'taxonomy' => 'foo', 776 776 ) ); 777 $bar_term_1 = self:: $factory->term->create( array(777 $bar_term_1 = self::factory()->term->create( array( 778 778 'taxonomy' => 'bar', 779 779 ) ); 780 $bar_term_2 = self:: $factory->term->create( array(780 $bar_term_2 = self::factory()->term->create( array( 781 781 'taxonomy' => 'bar', 782 782 ) ); 783 783 784 $p1 = self:: $factory->post->create();785 $p2 = self:: $factory->post->create();786 $p3 = self:: $factory->post->create();787 $p4 = self:: $factory->post->create();784 $p1 = self::factory()->post->create(); 785 $p2 = self::factory()->post->create(); 786 $p3 = self::factory()->post->create(); 787 $p4 = self::factory()->post->create(); 788 788 789 789 wp_set_object_terms( $p1, array( $foo_term_1 ), 'foo' ); … … 841 841 // An empty tax query should return an empty array, not all posts. 842 842 843 self:: $factory->post->create_many( 2 );843 self::factory()->post->create_many( 2 ); 844 844 845 845 $query = new WP_Query( array( … … 874 874 // An empty tax query should return an empty array, not all posts. 875 875 876 self:: $factory->post->create_many( 2 );876 self::factory()->post->create_many( 2 ); 877 877 878 878 $query = new WP_Query( array( … … 902 902 903 903 public function test_tax_query_include_children() { 904 $cat_a = self:: $factory->term->create( array( 'taxonomy' => 'category', 'name' => 'Australia' ) );905 $cat_b = self:: $factory->term->create( array( 'taxonomy' => 'category', 'name' => 'Sydney', 'parent' => $cat_a ) );906 $cat_c = self:: $factory->term->create( array( 'taxonomy' => 'category', 'name' => 'East Syndney', 'parent' => $cat_b ) );907 $cat_d = self:: $factory->term->create( array( 'taxonomy' => 'category', 'name' => 'West Syndney', 'parent' => $cat_b ) );908 909 $post_a = self:: $factory->post->create( array( 'post_category' => array( $cat_a ) ) );910 $post_b = self:: $factory->post->create( array( 'post_category' => array( $cat_b ) ) );911 $post_c = self:: $factory->post->create( array( 'post_category' => array( $cat_c ) ) );912 $post_d = self:: $factory->post->create( array( 'post_category' => array( $cat_d ) ) );904 $cat_a = self::factory()->term->create( array( 'taxonomy' => 'category', 'name' => 'Australia' ) ); 905 $cat_b = self::factory()->term->create( array( 'taxonomy' => 'category', 'name' => 'Sydney', 'parent' => $cat_a ) ); 906 $cat_c = self::factory()->term->create( array( 'taxonomy' => 'category', 'name' => 'East Syndney', 'parent' => $cat_b ) ); 907 $cat_d = self::factory()->term->create( array( 'taxonomy' => 'category', 'name' => 'West Syndney', 'parent' => $cat_b ) ); 908 909 $post_a = self::factory()->post->create( array( 'post_category' => array( $cat_a ) ) ); 910 $post_b = self::factory()->post->create( array( 'post_category' => array( $cat_b ) ) ); 911 $post_c = self::factory()->post->create( array( 'post_category' => array( $cat_c ) ) ); 912 $post_d = self::factory()->post->create( array( 'post_category' => array( $cat_d ) ) ); 913 913 914 914 $posts = get_posts( array( … … 1010 1010 1011 1011 register_taxonomy_for_object_type( 'post_tag', 'attachment:image' ); 1012 $tag_id = self:: $factory->term->create( array( 'slug' => rand_str(), 'name' => rand_str() ) );1013 $image_id = self:: $factory->attachment->create_object( 'image.jpg', 0, array(1012 $tag_id = self::factory()->term->create( array( 'slug' => rand_str(), 'name' => rand_str() ) ); 1013 $image_id = self::factory()->attachment->create_object( 'image.jpg', 0, array( 1014 1014 'post_mime_type' => 'image/jpeg', 1015 1015 'post_type' => 'attachment' … … 1036 1036 1037 1037 public function test_tax_query_no_taxonomy() { 1038 $cat_id = self:: $factory->category->create( array( 'name' => 'alpha' ) );1039 self:: $factory->post->create( array( 'post_title' => 'alpha', 'post_category' => array( $cat_id ) ) );1038 $cat_id = self::factory()->category->create( array( 'name' => 'alpha' ) ); 1039 self::factory()->post->create( array( 'post_title' => 'alpha', 'post_category' => array( $cat_id ) ) ); 1040 1040 1041 1041 $response1 = new WP_Query( array( … … 1077 1077 $q = new WP_Query(); 1078 1078 1079 $posts = self:: $factory->post->create_many( 5 );1079 $posts = self::factory()->post->create_many( 5 ); 1080 1080 1081 1081 $cats = $tags = array(); … … 1156 1156 public function test_populate_taxonomy_query_var_from_tax_query() { 1157 1157 register_taxonomy( 'foo', 'post' ); 1158 $t = self:: $factory->term->create( array(1158 $t = self::factory()->term->create( array( 1159 1159 'taxonomy' => 'foo', 1160 1160 ) ); 1161 $c = self:: $factory->term->create( array(1161 $c = self::factory()->term->create( array( 1162 1162 'taxonomy' => 'category', 1163 1163 ) ); … … 1192 1192 register_taxonomy( 'foo', 'post' ); 1193 1193 register_taxonomy( 'foo1', 'post' ); 1194 $t = self:: $factory->term->create( array(1194 $t = self::factory()->term->create( array( 1195 1195 'taxonomy' => 'foo', 1196 1196 ) ); … … 1214 1214 public function test_populate_term_query_var_from_tax_query() { 1215 1215 register_taxonomy( 'foo', 'post' ); 1216 $t = self:: $factory->term->create( array(1216 $t = self::factory()->term->create( array( 1217 1217 'taxonomy' => 'foo', 1218 1218 'slug' => 'bar', … … 1236 1236 public function test_populate_term_id_query_var_from_tax_query() { 1237 1237 register_taxonomy( 'foo', 'post' ); 1238 $t = self:: $factory->term->create( array(1238 $t = self::factory()->term->create( array( 1239 1239 'taxonomy' => 'foo', 1240 1240 'slug' => 'bar', … … 1261 1261 public function test_populate_cat_category_name_query_var_from_tax_query() { 1262 1262 register_taxonomy( 'foo', 'post' ); 1263 $t = self:: $factory->term->create( array(1263 $t = self::factory()->term->create( array( 1264 1264 'taxonomy' => 'foo', 1265 1265 ) ); 1266 $c = self:: $factory->term->create( array(1266 $c = self::factory()->term->create( array( 1267 1267 'taxonomy' => 'category', 1268 1268 'slug' => 'bar', … … 1302 1302 public function test_populate_tag_id_query_var_from_tax_query() { 1303 1303 register_taxonomy( 'foo', 'post' ); 1304 $t = self:: $factory->term->create( array(1304 $t = self::factory()->term->create( array( 1305 1305 'taxonomy' => 'foo', 1306 1306 ) ); 1307 $tag = self:: $factory->term->create( array(1307 $tag = self::factory()->term->create( array( 1308 1308 'taxonomy' => 'post_tag', 1309 1309 'slug' => 'bar', -
trunk/tests/phpunit/tests/rest-api/rest-server.php
r35225 r35242 137 137 ) ); 138 138 139 $editor = self:: $factory->user->create( array( 'role' => 'editor' ) );139 $editor = self::factory()->user->create( array( 'role' => 'editor' ) ); 140 140 141 141 $request = new WP_REST_Request( 'GET', '/test-ns/test', array() ); -
trunk/tests/phpunit/tests/rewrite.php
r35225 r35242 86 86 function test_url_to_postid() { 87 87 88 $id = self:: $factory->post->create();89 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); 90 91 $id = self:: $factory->post->create( array( 'post_type' => 'page' ) );88 $id = self::factory()->post->create(); 89 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); 90 91 $id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 92 92 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); 93 93 } 94 94 95 95 function test_url_to_postid_set_url_scheme_https_to_http() { 96 $post_id = self:: $factory->post->create();96 $post_id = self::factory()->post->create(); 97 97 $permalink = get_permalink( $post_id ); 98 98 $this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'https' ) ) ); 99 99 100 $post_id = self:: $factory->post->create( array( 'post_type' => 'page' ) );100 $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 101 101 $permalink = get_permalink( $post_id ); 102 102 $this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'https' ) ) ); … … 110 110 $_SERVER['HTTPS'] = 'on'; 111 111 112 $post_id = self:: $factory->post->create();112 $post_id = self::factory()->post->create(); 113 113 $permalink = get_permalink( $post_id ); 114 114 $this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'http' ) ) ); 115 115 116 $post_id = self:: $factory->post->create( array( 'post_type' => 'page' ) );116 $post_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 117 117 $permalink = get_permalink( $post_id ); 118 118 $this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'http' ) ) ); … … 129 129 register_post_type( $post_type, array( 'public' => true ) ); 130 130 131 $id = self:: $factory->post->create( array( 'post_type' => $post_type ) );131 $id = self::factory()->post->create( array( 'post_type' => $post_type ) ); 132 132 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); 133 133 … … 137 137 function test_url_to_postid_hierarchical() { 138 138 139 $parent_id = self:: $factory->post->create( array( 'post_title' => 'Parent', 'post_type' => 'page' ) );140 $child_id = self:: $factory->post->create( array( 'post_title' => 'Child', 'post_type' => 'page', 'post_parent' => $parent_id ) );139 $parent_id = self::factory()->post->create( array( 'post_title' => 'Parent', 'post_type' => 'page' ) ); 140 $child_id = self::factory()->post->create( array( 'post_title' => 'Child', 'post_type' => 'page', 'post_parent' => $parent_id ) ); 141 141 142 142 $this->assertEquals( $parent_id, url_to_postid( get_permalink( $parent_id ) ) ); … … 146 146 function test_url_to_postid_hierarchical_with_matching_leaves() { 147 147 148 $parent_id = self:: $factory->post->create( array(148 $parent_id = self::factory()->post->create( array( 149 149 'post_name' => 'parent', 150 150 'post_type' => 'page', 151 151 ) ); 152 $child_id_1 = self:: $factory->post->create( array(152 $child_id_1 = self::factory()->post->create( array( 153 153 'post_name' => 'child1', 154 154 'post_type' => 'page', 155 155 'post_parent' => $parent_id, 156 156 ) ); 157 $child_id_2 = self:: $factory->post->create( array(157 $child_id_2 = self::factory()->post->create( array( 158 158 'post_name' => 'child2', 159 159 'post_type' => 'page', 160 160 'post_parent' => $parent_id, 161 161 ) ); 162 $grandchild_id_1 = self:: $factory->post->create( array(162 $grandchild_id_1 = self::factory()->post->create( array( 163 163 'post_name' => 'grandchild', 164 164 'post_type' => 'page', 165 165 'post_parent' => $child_id_1, 166 166 ) ); 167 $grandchild_id_2 = self:: $factory->post->create( array(167 $grandchild_id_2 = self::factory()->post->create( array( 168 168 'post_name' => 'grandchild', 169 169 'post_type' => 'page', … … 181 181 update_option( 'home', home_url( '/example/' ) ); 182 182 183 $id = self:: $factory->post->create( array( 'post_title' => 'Hi', 'post_type' => 'page', 'post_name' => 'examp' ) );183 $id = self::factory()->post->create( array( 'post_title' => 'Hi', 'post_type' => 'page', 'post_name' => 'examp' ) ); 184 184 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); 185 185 $this->assertEquals( $id, url_to_postid( site_url('/example/examp' ) ) ); … … 245 245 update_option( 'home', home_url('/example/') ); 246 246 247 $id = self:: $factory->post->create( array( 'post_title' => 'Hi', 'post_type' => 'page', 'post_name' => 'example' ) );247 $id = self::factory()->post->create( array( 'post_title' => 'Hi', 'post_type' => 'page', 'post_name' => 'example' ) ); 248 248 249 249 $this->assertEquals( $id, url_to_postid( get_permalink( $id ) ) ); … … 259 259 update_option( 'home', home_url( '/example' ) ); 260 260 261 self:: $factory->post->create( array( 'post_title' => 'Collision', 'post_type' => 'page', 'post_name' => 'collision' ) );261 self::factory()->post->create( array( 'post_title' => 'Collision', 'post_type' => 'page', 'post_name' => 'collision' ) ); 262 262 263 263 // This url should NOT return a post ID … … 278 278 } 279 279 280 $blog_id = self:: $factory->blog->create( array( 'path' => '/example' ) );280 $blog_id = self::factory()->blog->create( array( 'path' => '/example' ) ); 281 281 switch_to_blog( $blog_id ); 282 282 283 self:: $factory->post->create( array( 'post_title' => 'Collision ', 'post_type' => 'page' ) );283 self::factory()->post->create( array( 'post_title' => 'Collision ', 'post_type' => 'page' ) ); 284 284 285 285 // This url should NOT return a post ID … … 295 295 public function test_is_home_should_be_false_when_visiting_custom_endpoint_without_a_registered_query_var_and_page_on_front_is_set() { 296 296 297 $page_id = self:: $factory->post->create( array( 'post_type' => 'page' ) );297 $page_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 298 298 update_option( 'show_on_front', 'page' ); 299 299 update_option( 'page_on_front', $page_id ); … … 314 314 $this->set_permalink_structure( '/%postname%/' ); 315 315 316 $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_status' => 'trash' ) );317 $post_id = self:: $factory->post->create( array( 'post_title' => get_post( $page_id )->post_title ) );316 $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_status' => 'trash' ) ); 317 $post_id = self::factory()->post->create( array( 'post_title' => get_post( $page_id )->post_title ) ); 318 318 319 319 $this->assertEquals( $post_id, url_to_postid( get_permalink( $post_id ) ) ); … … 328 328 $this->set_permalink_structure( '/%postname%/' ); 329 329 330 $page_id = self:: $factory->post->create( array( 'post_type' => 'page', 'post_status' => 'trash' ) );331 $post_id = self:: $factory->post->create( array( 'post_title' => get_post( $page_id )->post_title ) );330 $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_status' => 'trash' ) ); 331 $post_id = self::factory()->post->create( array( 'post_title' => get_post( $page_id )->post_title ) ); 332 332 333 333 $this->go_to( get_permalink( $post_id ) ); -
trunk/tests/phpunit/tests/rewrite/numericSlugs.php
r35225 r35242 10 10 public function setUp() { 11 11 parent::setUp(); 12 $this->author_id = self:: $factory->user->create( array( 'role' => 'editor' ) );12 $this->author_id = self::factory()->user->create( array( 'role' => 'editor' ) ); 13 13 14 14 // Override the post/archive slug collision prevention in `wp_unique_post_slug()`. … … 24 24 $this->set_permalink_structure( '/%postname%/' ); 25 25 26 $id = self:: $factory->post->create( array(26 $id = self::factory()->post->create( array( 27 27 'post_author' => $this->author_id, 28 28 'post_status' => 'publish', … … 52 52 $this->set_permalink_structure( '/%postname%/' ); 53 53 54 $id = self:: $factory->post->create( array(54 $id = self::factory()->post->create( array( 55 55 'post_author' => $this->author_id, 56 56 'post_status' => 'publish', … … 77 77 $this->set_permalink_structure( '/%postname%/' ); 78 78 79 $id = self:: $factory->post->create( array(79 $id = self::factory()->post->create( array( 80 80 'post_author' => $this->author_id, 81 81 'post_status' => 'publish', … … 93 93 $this->set_permalink_structure( '/%postname%/' ); 94 94 95 $id = self:: $factory->post->create( array(95 $id = self::factory()->post->create( array( 96 96 'post_author' => $this->author_id, 97 97 'post_status' => 'publish', … … 107 107 $this->set_permalink_structure( '/%year%/%postname%/' ); 108 108 109 $id = self:: $factory->post->create( array(109 $id = self::factory()->post->create( array( 110 110 'post_author' => $this->author_id, 111 111 'post_status' => 'publish', … … 124 124 $this->set_permalink_structure( '/%year%/%postname%/' ); 125 125 126 $id = self:: $factory->post->create( array(126 $id = self::factory()->post->create( array( 127 127 'post_author' => $this->author_id, 128 128 'post_status' => 'publish', … … 139 139 $this->set_permalink_structure( '/%year%/%postname%/' ); 140 140 141 $id = self:: $factory->post->create( array(141 $id = self::factory()->post->create( array( 142 142 'post_author' => $this->author_id, 143 143 'post_status' => 'publish', … … 156 156 $this->set_permalink_structure( '/%year%/%postname%/' ); 157 157 158 $id = self:: $factory->post->create( array(158 $id = self::factory()->post->create( array( 159 159 'post_author' => $this->author_id, 160 160 'post_status' => 'publish', … … 171 171 $this->set_permalink_structure( '/%year%/%postname%/' ); 172 172 173 $id = self:: $factory->post->create( array(173 $id = self::factory()->post->create( array( 174 174 'post_author' => $this->author_id, 175 175 'post_status' => 'publish', … … 187 187 $this->set_permalink_structure( '/%year%/%postname%/' ); 188 188 189 $id = self:: $factory->post->create( array(189 $id = self::factory()->post->create( array( 190 190 'post_author' => $this->author_id, 191 191 'post_status' => 'publish', … … 201 201 $this->set_permalink_structure( '/%year%/%postname%/' ); 202 202 203 $id = self:: $factory->post->create( array(203 $id = self::factory()->post->create( array( 204 204 'post_author' => $this->author_id, 205 205 'post_status' => 'publish', … … 217 217 $this->set_permalink_structure( '/%year%/%postname%/' ); 218 218 219 $id = self:: $factory->post->create( array(219 $id = self::factory()->post->create( array( 220 220 'post_author' => $this->author_id, 221 221 'post_status' => 'publish', … … 231 231 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 232 232 233 $id = self:: $factory->post->create( array(233 $id = self::factory()->post->create( array( 234 234 'post_author' => $this->author_id, 235 235 'post_status' => 'publish', … … 248 248 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 249 249 250 $id = self:: $factory->post->create( array(250 $id = self::factory()->post->create( array( 251 251 'post_author' => $this->author_id, 252 252 'post_status' => 'publish', … … 263 263 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 264 264 265 $id = self:: $factory->post->create( array(265 $id = self::factory()->post->create( array( 266 266 'post_author' => $this->author_id, 267 267 'post_status' => 'publish', … … 279 279 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 280 280 281 $id = self:: $factory->post->create( array(281 $id = self::factory()->post->create( array( 282 282 'post_author' => $this->author_id, 283 283 'post_status' => 'publish', … … 293 293 $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); 294 294 295 $id = self:: $factory->post->create( array(295 $id = self::factory()->post->create( array( 296 296 'post_author' => $this->author_id, 297 297 'post_status' => 'publish', … … 315 315 316 316 // Make sure a post is published in 2013/02, to avoid 404s. 317 self:: $factory->post->create( array(317 self::factory()->post->create( array( 318 318 'post_author' => $this->author_id, 319 319 'post_status' => 'publish', … … 323 323 ) ); 324 324 325 $id = self:: $factory->post->create( array(325 $id = self::factory()->post->create( array( 326 326 'post_author' => $this->author_id, 327 327 'post_status' => 'publish', … … 343 343 344 344 // Make sure a post is published on 2015/01/01, to avoid 404s. 345 self:: $factory->post->create( array(345 self::factory()->post->create( array( 346 346 'post_author' => $this->author_id, 347 347 'post_status' => 'publish', … … 351 351 ) ); 352 352 353 $id = self:: $factory->post->create( array(353 $id = self::factory()->post->create( array( 354 354 'post_author' => $this->author_id, 355 355 'post_status' => 'publish', … … 370 370 $this->set_permalink_structure( '/%year%/%postname%/' ); 371 371 372 $id = self:: $factory->post->create( array(372 $id = self::factory()->post->create( array( 373 373 'post_author' => $this->author_id, 374 374 'post_status' => 'publish', … … 386 386 $this->set_permalink_structure( '/%year%/%postname%/' ); 387 387 388 $id = self:: $factory->post->create( array(388 $id = self::factory()->post->create( array( 389 389 'post_author' => $this->author_id, 390 390 'post_status' => 'publish', … … 402 402 $this->set_permalink_structure( '/%year%/%postname%/' ); 403 403 404 $id = self:: $factory->post->create( array(404 $id = self::factory()->post->create( array( 405 405 'post_author' => $this->author_id, 406 406 'post_status' => 'publish', … … 419 419 $this->set_permalink_structure( '/%year%/%postname%/' ); 420 420 421 $id = self:: $factory->post->create( array(421 $id = self::factory()->post->create( array( 422 422 'post_author' => $this->author_id, 423 423 'post_status' => 'publish', -
trunk/tests/phpunit/tests/rewrite/oldSlugRedirect.php
r35225 r35242 13 13 parent::setUp(); 14 14 15 $this->post_id = self:: $factory->post->create( array(15 $this->post_id = self::factory()->post->create( array( 16 16 'post_title' => 'Foo Bar', 17 17 'post_name' => 'foo-bar', … … 100 100 public function test_old_slug_redirect_attachment() { 101 101 $file = DIR_TESTDATA . '/images/canola.jpg'; 102 $attachment_id = self:: $factory->attachment->create_object( $file, $this->post_id, array(102 $attachment_id = self::factory()->attachment->create_object( $file, $this->post_id, array( 103 103 'post_mime_type' => 'image/jpeg', 104 104 'post_name' => 'my-attachment', -
trunk/tests/phpunit/tests/taxonomy.php
r35225 r35242 35 35 36 36 function test_get_the_taxonomies() { 37 $post_id = self:: $factory->post->create();37 $post_id = self::factory()->post->create(); 38 38 39 39 $taxes = get_the_taxonomies( $post_id ); … … 41 41 $this->assertEquals( array( 'category' ), array_keys( $taxes ) ); 42 42 43 $id = self:: $factory->tag->create();43 $id = self::factory()->tag->create(); 44 44 wp_set_post_tags( $post_id, array( $id ) ); 45 45 … … 54 54 */ 55 55 public function test_get_the_taxonomies_term_template() { 56 $post_id = self:: $factory->post->create();56 $post_id = self::factory()->post->create(); 57 57 58 58 $taxes = get_the_taxonomies( $post_id, array( 'term_template' => '%2$s' ) ); … … 65 65 66 66 function test_the_taxonomies() { 67 $post_id = self:: $factory->post->create();67 $post_id = self::factory()->post->create(); 68 68 69 69 ob_start(); … … 80 80 */ 81 81 function test_the_taxonomies_term_template() { 82 $post_id = self:: $factory->post->create();82 $post_id = self::factory()->post->create(); 83 83 84 84 $output = get_echo( 'the_taxonomies', array( array( 'post' => $post_id, 'term_template' => '%2$s' ) ) ); … … 263 263 264 264 public function test_get_objects_in_term_should_return_objects_ids() { 265 $tag_id = self:: $factory->tag->create();266 $cat_id = self:: $factory->category->create();265 $tag_id = self::factory()->tag->create(); 266 $cat_id = self::factory()->category->create(); 267 267 $posts_with_tag = array(); 268 268 $posts_with_category = array(); 269 269 270 270 for ( $i = 0; $i < 3; $i++ ) { 271 $post_id = self:: $factory->post->create();271 $post_id = self::factory()->post->create(); 272 272 wp_set_post_tags( $post_id, array( $tag_id ) ); 273 273 $posts_with_tag[] = $post_id; … … 275 275 276 276 for ( $i = 0; $i < 3; $i++ ) { 277 $post_id = self:: $factory->post->create();277 $post_id = self::factory()->post->create(); 278 278 wp_set_post_categories( $post_id, array( $cat_id ) ); 279 279 $posts_with_category[] = $post_id; … … 281 281 282 282 for ( $i = 0; $i < 3; $i++ ) { 283 self:: $factory->post->create();283 self::factory()->post->create(); 284 284 } 285 285 … … 296 296 */ 297 297 function test_in_category() { 298 $post = self:: $factory->post->create_and_get();298 $post = self::factory()->post->create_and_get(); 299 299 300 300 // in_category() returns false when first parameter is empty() … … 347 347 public function test_get_ancestors_taxonomy_non_hierarchical() { 348 348 register_taxonomy( 'wptests_tax', 'post' ); 349 $t = self:: $factory->term->create( array(349 $t = self::factory()->term->create( array( 350 350 'taxonomy' => 'wptests_tax', 351 351 ) ); … … 359 359 'hierarchical' => true, 360 360 ) ); 361 $t1 = self:: $factory->term->create( array(362 'taxonomy' => 'wptests_tax', 363 ) ); 364 $t2 = self:: $factory->term->create( array(361 $t1 = self::factory()->term->create( array( 362 'taxonomy' => 'wptests_tax', 363 ) ); 364 $t2 = self::factory()->term->create( array( 365 365 'taxonomy' => 'wptests_tax', 366 366 'parent' => $t1, 367 367 ) ); 368 $t3 = self:: $factory->term->create( array(368 $t3 = self::factory()->term->create( array( 369 369 'taxonomy' => 'wptests_tax', 370 370 'parent' => $t2, 371 371 ) ); 372 $t4 = self:: $factory->term->create( array(372 $t4 = self::factory()->term->create( array( 373 373 'taxonomy' => 'wptests_tax', 374 374 'parent' => $t1, … … 381 381 public function test_get_ancestors_post_type_non_hierarchical() { 382 382 register_post_type( 'wptests_pt' ); 383 $p = self:: $factory->post->create( array(383 $p = self::factory()->post->create( array( 384 384 'taxonomy' => 'wptests_pt', 385 385 ) ); … … 392 392 'hierarchical' => true, 393 393 ) ); 394 $p1 = self:: $factory->post->create( array(394 $p1 = self::factory()->post->create( array( 395 395 'post_type' => 'wptests_pt', 396 396 ) ); 397 $p2 = self:: $factory->post->create( array(397 $p2 = self::factory()->post->create( array( 398 398 'post_type' => 'wptests_pt', 399 399 'post_parent' => $p1, 400 400 ) ); 401 $p3 = self:: $factory->post->create( array(401 $p3 = self::factory()->post->create( array( 402 402 'post_type' => 'wptests_pt', 403 403 'post_parent' => $p2, 404 404 ) ); 405 $p4 = self:: $factory->post->create( array(405 $p4 = self::factory()->post->create( array( 406 406 'post_type' => 'wptests_pt', 407 407 'post_parent' => $p1, … … 419 419 'hierarchical' => true, 420 420 ) ); 421 $p1 = self:: $factory->post->create( array(421 $p1 = self::factory()->post->create( array( 422 422 'post_type' => 'wptests_conflict', 423 423 ) ); 424 $p2 = self:: $factory->post->create( array(424 $p2 = self::factory()->post->create( array( 425 425 'post_type' => 'wptests_conflict', 426 426 'post_parent' => $p1, … … 430 430 'hierarchical' => true, 431 431 ) ); 432 $t1 = self:: $factory->term->create( array(432 $t1 = self::factory()->term->create( array( 433 433 'taxonomy' => 'wptests_conflict', 434 434 ) ); 435 $t2 = self:: $factory->term->create( array(435 $t2 = self::factory()->term->create( array( 436 436 'taxonomy' => 'wptests_conflict', 437 437 'parent' => $t1, … … 452 452 ) ); 453 453 454 $t = self:: $factory->term->create_and_get( array(455 'taxonomy' => 'wptests_tax', 456 ) ); 457 458 $p = self:: $factory->post->create();454 $t = self::factory()->term->create_and_get( array( 455 'taxonomy' => 'wptests_tax', 456 ) ); 457 458 $p = self::factory()->post->create(); 459 459 wp_set_object_terms( $p, $t->slug, 'wptests_tax' ); 460 460 … … 472 472 ) ); 473 473 474 $t = self:: $factory->term->create_and_get( array(475 'taxonomy' => 'wptests_tax', 476 ) ); 477 478 $p = self:: $factory->post->create();474 $t = self::factory()->term->create_and_get( array( 475 'taxonomy' => 'wptests_tax', 476 ) ); 477 478 $p = self::factory()->post->create(); 479 479 wp_set_object_terms( $p, $t->slug, 'wptests_tax' ); 480 480 -
trunk/tests/phpunit/tests/term.php
r35225 r35242 24 24 ) ); 25 25 26 $parent = self:: $factory->term->create( array(27 'taxonomy' => 'wptests_tax', 28 ) ); 29 30 $child = self:: $factory->term->create( array(26 $parent = self::factory()->term->create( array( 27 'taxonomy' => 'wptests_tax', 28 ) ); 29 30 $child = self::factory()->term->create( array( 31 31 'taxonomy' => 'wptests_tax', 32 32 'parent' => $parent, … … 227 227 register_taxonomy( 'wptests_tax', 'post' ); 228 228 $p = self::$post_ids[0]; 229 $t1 = self:: $factory->term->create( array(230 'taxonomy' => 'wptests_tax', 231 ) ); 232 $t2 = self:: $factory->term->create( array(229 $t1 = self::factory()->term->create( array( 230 'taxonomy' => 'wptests_tax', 231 ) ); 232 $t2 = self::factory()->term->create( array( 233 233 'taxonomy' => 'wptests_tax', 234 234 ) ); … … 248 248 register_taxonomy( 'wptests_tax', 'post' ); 249 249 $p = self::$post_ids[0]; 250 $t1 = self:: $factory->term->create( array(251 'taxonomy' => 'wptests_tax', 252 ) ); 253 $t2 = self:: $factory->term->create( array(250 $t1 = self::factory()->term->create( array( 251 'taxonomy' => 'wptests_tax', 252 ) ); 253 $t2 = self::factory()->term->create( array( 254 254 'taxonomy' => 'wptests_tax', 255 255 ) ); … … 269 269 register_taxonomy( 'wptests_tax', 'post' ); 270 270 $p = self::$post_ids[0]; 271 $t1 = self:: $factory->term->create( array(272 'taxonomy' => 'wptests_tax', 273 ) ); 274 $t2 = self:: $factory->term->create( array(271 $t1 = self::factory()->term->create( array( 272 'taxonomy' => 'wptests_tax', 273 ) ); 274 $t2 = self::factory()->term->create( array( 275 275 'taxonomy' => 'wptests_tax', 276 276 ) ); … … 365 365 function test_wp_add_remove_object_terms() { 366 366 $posts = self::$post_ids; 367 $tags = self:: $factory->tag->create_many( 5 );367 $tags = self::factory()->tag->create_many( 5 ); 368 368 369 369 $tt = wp_add_object_terms( $posts[0], $tags[1], 'post_tag' ); … … 524 524 function test_object_term_cache_when_term_changes() { 525 525 $post_id = self::$post_ids[0]; 526 $tag_id = self:: $factory->tag->create( array(526 $tag_id = self::factory()->tag->create( array( 527 527 'name' => 'Amaze Tag', 528 528 'description' => 'My Amazing Tag' … … 554 554 $p = self::$post_ids[0]; 555 555 register_taxonomy( 'wptests_tax', 'post' ); 556 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );556 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 557 557 wp_set_object_terms( $p, $t, 'wptests_tax' ); 558 558 … … 573 573 $p = self::$post_ids[0]; 574 574 register_taxonomy( 'wptests_tax', 'post' ); 575 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );575 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 576 576 wp_set_object_terms( $p, $t, 'wptests_tax' ); 577 577 … … 619 619 */ 620 620 function test_orphan_category() { 621 $cat_id1 = self:: $factory->category->create();621 $cat_id1 = self::factory()->category->create(); 622 622 623 623 wp_delete_category( $cat_id1 ); 624 624 625 $cat_id2 = self:: $factory->category->create( array( 'parent' => $cat_id1 ) );625 $cat_id2 = self::factory()->category->create( array( 'parent' => $cat_id1 ) ); 626 626 $this->assertWPError( $cat_id2 ); 627 627 } -
trunk/tests/phpunit/tests/term/cache.php
r35225 r35242 16 16 function test_category_children_cache() { 17 17 // Test with only one Parent => Child 18 $term_id1 = self:: $factory->category->create();19 $term_id1_child = self:: $factory->category->create( array( 'parent' => $term_id1 ) );18 $term_id1 = self::factory()->category->create(); 19 $term_id1_child = self::factory()->category->create( array( 'parent' => $term_id1 ) ); 20 20 $hierarchy = _get_term_hierarchy( 'category' ); 21 21 … … 23 23 24 24 // Add another Parent => Child 25 $term_id2 = self:: $factory->category->create();26 $term_id2_child = self:: $factory->category->create( array( 'parent' => $term_id2 ) );25 $term_id2 = self::factory()->category->create(); 26 $term_id2_child = self::factory()->category->create( array( 'parent' => $term_id2 ) ); 27 27 $hierarchy = _get_term_hierarchy( 'category' ); 28 28 … … 34 34 */ 35 35 function test_category_name_change() { 36 $term = self:: $factory->category->create_and_get( array( 'name' => 'Foo' ) );37 $post_id = self:: $factory->post->create();36 $term = self::factory()->category->create_and_get( array( 'name' => 'Foo' ) ); 37 $post_id = self::factory()->post->create(); 38 38 wp_set_post_categories( $post_id, $term->term_id ); 39 39 … … 99 99 100 100 register_taxonomy( 'wptests_tax', 'post' ); 101 $term = self:: $factory->term->create( array(101 $term = self::factory()->term->create( array( 102 102 'taxonomy' => 'wptests_tax', 103 103 ) ); … … 125 125 126 126 register_taxonomy( 'wptests_tax', 'post' ); 127 $term = self:: $factory->term->create( array(127 $term = self::factory()->term->create( array( 128 128 'taxonomy' => 'wptests_tax', 129 129 ) ); … … 152 152 153 153 register_taxonomy( 'wptests_tax', 'post' ); 154 $term = self:: $factory->term->create( array(154 $term = self::factory()->term->create( array( 155 155 'taxonomy' => 'wptests_tax', 156 156 ) ); … … 183 183 register_taxonomy( 'wptests_tax', 'post' ); 184 184 185 $terms = self:: $factory->term->create_many( 5, array(185 $terms = self::factory()->term->create_many( 5, array( 186 186 'taxonomy' => 'wptests_tax', 187 187 ) ); -
trunk/tests/phpunit/tests/term/categoryExists.php
r35225 r35242 6 6 */ 7 7 public function test_category_exists_should_return_only_top_level_categories_when_parent_is_0() { 8 $c1 = self:: $factory->category->create();9 $c2 = self:: $factory->category->create( array(8 $c1 = self::factory()->category->create(); 9 $c2 = self::factory()->category->create( array( 10 10 'name' => 'Foo', 11 11 'parent' => $c1, 12 12 ) ); 13 $c3 = self:: $factory->category->create( array(13 $c3 = self::factory()->category->create( array( 14 14 'name' => 'Foo', 15 15 ) ); … … 25 25 public function test_category_exists_should_select_oldest_matching_category_when_no_parent_is_specified_1() { 26 26 // Foo child of c1 is created first. 27 $c1 = self:: $factory->category->create();28 $c2 = self:: $factory->category->create( array(27 $c1 = self::factory()->category->create(); 28 $c2 = self::factory()->category->create( array( 29 29 'name' => 'Foo', 30 30 'parent' => $c1, 31 31 ) ); 32 $c3 = self:: $factory->category->create( array(32 $c3 = self::factory()->category->create( array( 33 33 'name' => 'Foo', 34 34 ) ); … … 44 44 public function test_category_exists_should_select_oldest_matching_category_when_no_parent_is_specified_2() { 45 45 // Top-level Foo is created first. 46 $c1 = self:: $factory->category->create();47 $c2 = self:: $factory->category->create( array(46 $c1 = self::factory()->category->create(); 47 $c2 = self::factory()->category->create( array( 48 48 'name' => 'Foo', 49 49 ) ); 50 $c3 = self:: $factory->category->create( array(50 $c3 = self::factory()->category->create( array( 51 51 'name' => 'Foo', 52 52 'parent' => $c1, … … 62 62 */ 63 63 public function test_category_exists_should_respect_nonempty_parent() { 64 $c1 = self:: $factory->category->create();65 $c2 = self:: $factory->category->create( array(64 $c1 = self::factory()->category->create(); 65 $c2 = self::factory()->category->create( array( 66 66 'name' => 'Foo', 67 67 'parent' => $c1, 68 68 ) ); 69 $c3 = self:: $factory->category->create( array(69 $c3 = self::factory()->category->create( array( 70 70 'name' => 'Foo', 71 71 ) ); -
trunk/tests/phpunit/tests/term/getEditTermLink.php
r35225 r35242 7 7 public function setUp() { 8 8 parent::setUp(); 9 wp_set_current_user( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );9 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 10 10 register_taxonomy( 'wptests_tax', 'post' ); 11 11 } 12 12 13 13 public function test_get_edit_term_link_default() { 14 $term1 = self:: $factory->term->create( array(14 $term1 = self::factory()->term->create( array( 15 15 'taxonomy' => 'wptests_tax', 16 16 'name' => 'foo', … … 26 26 */ 27 27 public function test_get_edit_term_link_invalid_id() { 28 $term1 = self:: $factory->term->create( array(28 $term1 = self::factory()->term->create( array( 29 29 'taxonomy' => 'wptests_tax', 30 30 'name' => 'foo', -
trunk/tests/phpunit/tests/term/getTerm.php
r35227 r35242 25 25 global $wpdb; 26 26 27 $term = self:: $factory->term->create_and_get( array( 'taxonomy' => 'wptests_tax' ) );27 $term = self::factory()->term->create_and_get( array( 'taxonomy' => 'wptests_tax' ) ); 28 28 clean_term_cache( $term->term_id, 'wptests_tax' ); 29 29 … … 47 47 global $wpdb; 48 48 49 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );49 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 50 50 clean_term_cache( $t, 'wptests_tax' ); 51 51 … … 61 61 62 62 public function test_output_object() { 63 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );63 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 64 64 $this->assertInternalType( 'object', get_term( $t, 'wptests_tax', OBJECT ) ); 65 65 } 66 66 67 67 public function test_output_array_a() { 68 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );68 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 69 69 $term = get_term( $t, 'wptests_tax', ARRAY_A ); 70 70 $this->assertInternalType( 'array', $term ); … … 73 73 74 74 public function test_output_array_n() { 75 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );75 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 76 76 $term = get_term( $t, 'wptests_tax', ARRAY_N ); 77 77 $this->assertInternalType( 'array', $term ); … … 83 83 84 84 public function test_output_should_fall_back_to_object_for_invalid_input() { 85 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );85 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 86 86 $this->assertInternalType( 'object', get_term( $t, 'wptests_tax', 'foo' ) ); 87 87 } … … 93 93 global $wpdb; 94 94 95 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );95 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 96 96 97 97 // Get raw data from the database. … … 112 112 */ 113 113 public function test_should_return_null_when_provided_taxonomy_does_not_match_actual_term_taxonomy() { 114 $term_id = self:: $factory->term->create( array( 'taxonomy' => 'post_tag' ) );114 $term_id = self::factory()->term->create( array( 'taxonomy' => 'post_tag' ) ); 115 115 $this->assertNull( get_term( $term_id, 'category' ) ); 116 116 } -
trunk/tests/phpunit/tests/term/getTermBy.php
r35225 r35242 29 29 30 30 $slug = 'ńaș'; 31 $t = self:: $factory->term->create( array(31 $t = self::factory()->term->create( array( 32 32 'slug' => $slug, 33 33 'taxonomy' => 'wptests_tax', … … 45 45 46 46 register_taxonomy( 'wptests_tax', 'post' ); 47 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );47 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 48 48 $term = get_term( $t, 'wptests_tax' ); 49 49 … … 68 68 69 69 register_taxonomy( 'wptests_tax', 'post' ); 70 $t = self:: $factory->term->create( array(70 $t = self::factory()->term->create( array( 71 71 'taxonomy' => 'wptests_tax', 72 72 'slug' => 'foo', -
trunk/tests/phpunit/tests/term/getTermField.php
r35225 r35242 18 18 */ 19 19 public function test_get_term_field_should_not_return_error_for_empty_taxonomy() { 20 $term = self:: $factory->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );20 $term = self::factory()->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) ); 21 21 22 22 $found = get_term_field( 'taxonomy', $term->term_id, '' ); … … 29 29 */ 30 30 public function test_get_term_field_supplying_a_taxonomy() { 31 $term = self:: $factory->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );31 $term = self::factory()->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) ); 32 32 33 33 $found = get_term_field( 'taxonomy', $term->term_id, $term->taxonomy ); … … 39 39 */ 40 40 public function test_get_term_field_supplying_no_taxonomy() { 41 $term = self:: $factory->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );41 $term = self::factory()->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) ); 42 42 43 43 $found = get_term_field( 'taxonomy', $term->term_id ); … … 49 49 */ 50 50 public function test_get_term_field_should_accept_a_WP_Term_object_or_a_term_id() { 51 $term = self:: $factory->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );51 $term = self::factory()->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) ); 52 52 53 53 $this->assertInstanceOf( 'WP_Term', $term ); … … 60 60 */ 61 61 public function test_get_term_field_invalid_taxonomy_should_return_WP_Error() { 62 $term = self:: $factory->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) );62 $term = self::factory()->term->create_and_get( array( 'taxonomy' => $this->taxonomy ) ); 63 63 64 64 $found = get_term_field( 'taxonomy', $term, 'foo-taxonomy' ); -
trunk/tests/phpunit/tests/term/getTermLink.php
r35225 r35242 13 13 14 14 public function test_integer_should_be_interpreted_as_term_id() { 15 $t1 = self:: $factory->term->create( array(15 $t1 = self::factory()->term->create( array( 16 16 'taxonomy' => 'wptests_tax', 17 17 'name' => 'foo', 18 18 ) ); 19 $t2 = self:: $factory->term->create( array(19 $t2 = self::factory()->term->create( array( 20 20 'taxonomy' => 'wptests_tax', 21 21 'slug' => $t1, … … 29 29 30 30 public function test_numeric_string_should_be_interpreted_as_term_slug() { 31 $t1 = self:: $factory->term->create( array(31 $t1 = self::factory()->term->create( array( 32 32 'taxonomy' => 'wptests_tax', 33 33 'name' => 'foo', 34 34 ) ); 35 $t2 = self:: $factory->term->create( array(35 $t2 = self::factory()->term->create( array( 36 36 'taxonomy' => 'wptests_tax', 37 37 'slug' => $t1, … … 50 50 51 51 public function test_category_should_use_cat_query_var_with_term_id() { 52 $c = self:: $factory->category->create();52 $c = self::factory()->category->create(); 53 53 54 54 $actual = get_term_link( $c, 'category' ); … … 61 61 ) ); 62 62 63 $t = self:: $factory->term->create( array(63 $t = self::factory()->term->create( array( 64 64 'taxonomy' => 'wptests_tax2', 65 65 'slug' => 'bar', … … 75 75 ) ); 76 76 77 $t = self:: $factory->term->create( array(77 $t = self::factory()->term->create( array( 78 78 'taxonomy' => 'wptests_tax2', 79 79 'slug' => 'bar', … … 98 98 flush_rewrite_rules(); 99 99 100 $t1 = self:: $factory->term->create( array(100 $t1 = self::factory()->term->create( array( 101 101 'taxonomy' => 'wptests_tax2', 102 102 'slug' => 'term1', 103 103 ) ); 104 104 105 $t2 = self:: $factory->term->create( array(105 $t2 = self::factory()->term->create( array( 106 106 'taxonomy' => 'wptests_tax2', 107 107 'slug' => 'term2', … … 127 127 flush_rewrite_rules(); 128 128 129 $t1 = self:: $factory->term->create( array(129 $t1 = self::factory()->term->create( array( 130 130 'taxonomy' => 'wptests_tax2', 131 131 'slug' => 'term1', 132 132 ) ); 133 133 134 $t2 = self:: $factory->term->create( array(134 $t2 = self::factory()->term->create( array( 135 135 'taxonomy' => 'wptests_tax2', 136 136 'slug' => 'term2', -
trunk/tests/phpunit/tests/term/getTerms.php
r35225 r35242 106 106 */ 107 107 function test_get_terms_should_allow_arbitrary_indexed_taxonomies_array() { 108 $term_id = self:: $factory->tag->create();108 $term_id = self::factory()->tag->create(); 109 109 $terms = get_terms( array( '111' => 'post_tag' ), array( 'hide_empty' => false ) ); 110 110 $this->assertEquals( $term_id, reset( $terms )->term_id ); … … 115 115 */ 116 116 function test_get_terms_fields() { 117 $term_id1 = self:: $factory->tag->create( array( 'slug' => 'woo', 'name' => 'WOO!' ) );118 $term_id2 = self:: $factory->tag->create( array( 'slug' => 'hoo', 'name' => 'HOO!', 'parent' => $term_id1 ) );117 $term_id1 = self::factory()->tag->create( array( 'slug' => 'woo', 'name' => 'WOO!' ) ); 118 $term_id2 = self::factory()->tag->create( array( 'slug' => 'hoo', 'name' => 'HOO!', 'parent' => $term_id1 ) ); 119 119 120 120 $terms_id_parent = get_terms( 'post_tag', array( 'hide_empty' => false, 'fields' => 'id=>parent' ) ); … … 149 149 global $wpdb; 150 150 151 $term_id1 = self:: $factory->tag->create();152 $term_id2 = self:: $factory->tag->create();151 $term_id1 = self::factory()->tag->create(); 152 $term_id2 = self::factory()->tag->create(); 153 153 $inc_terms = get_terms( 'post_tag', array( 154 154 'include' => array( $term_id1, $term_id2 ), … … 180 180 register_taxonomy( 'wptests_tax', 'post' ); 181 181 182 $terms = self:: $factory->term->create_many( 2, array(182 $terms = self::factory()->term->create_many( 2, array( 183 183 'taxonomy' => 'wptests_tax', 184 184 ) ); … … 203 203 $term_id_uncategorized = get_option( 'default_category' ); 204 204 205 $term_id1 = self:: $factory->category->create();206 $term_id11 = self:: $factory->category->create( array( 'parent' => $term_id1 ) );207 $term_id2 = self:: $factory->category->create();208 $term_id22 = self:: $factory->category->create( array( 'parent' => $term_id2 ) );205 $term_id1 = self::factory()->category->create(); 206 $term_id11 = self::factory()->category->create( array( 'parent' => $term_id1 ) ); 207 $term_id2 = self::factory()->category->create(); 208 $term_id22 = self::factory()->category->create( array( 'parent' => $term_id2 ) ); 209 209 210 210 $terms = get_terms( 'category', array( … … 229 229 */ 230 230 function test_get_terms_search() { 231 $term_id1 = self:: $factory->tag->create( array( 'slug' => 'burrito' ) );232 $term_id2 = self:: $factory->tag->create( array( 'name' => 'Wilbur' ) );231 $term_id1 = self::factory()->tag->create( array( 'slug' => 'burrito' ) ); 232 $term_id2 = self::factory()->tag->create( array( 'name' => 'Wilbur' ) ); 233 233 234 234 $terms = get_terms( 'post_tag', array( 'hide_empty' => false, 'search' => 'bur', 'fields' => 'ids' ) ); … … 240 240 */ 241 241 function test_get_terms_like() { 242 $term_id1 = self:: $factory->tag->create( array( 'name' => 'burrito', 'description' => 'This is a burrito.' ) );243 $term_id2 = self:: $factory->tag->create( array( 'name' => 'taco', 'description' => 'Burning man.' ) );242 $term_id1 = self::factory()->tag->create( array( 'name' => 'burrito', 'description' => 'This is a burrito.' ) ); 243 $term_id2 = self::factory()->tag->create( array( 'name' => 'taco', 'description' => 'Burning man.' ) ); 244 244 245 245 $terms = get_terms( 'post_tag', array( 'hide_empty' => false, 'name__like' => 'bur', 'fields' => 'ids' ) ); … … 275 275 register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) ); 276 276 277 $cheese = self:: $factory->term->create( array( 'name' => 'Cheese', 'taxonomy' => $tax ) );278 279 $cheddar = self:: $factory->term->create( array( 'name' => 'Cheddar', 'parent' => $cheese, 'taxonomy' => $tax ) );280 281 $post_ids = self:: $factory->post->create_many( 2 );277 $cheese = self::factory()->term->create( array( 'name' => 'Cheese', 'taxonomy' => $tax ) ); 278 279 $cheddar = self::factory()->term->create( array( 'name' => 'Cheddar', 'parent' => $cheese, 'taxonomy' => $tax ) ); 280 281 $post_ids = self::factory()->post->create_many( 2 ); 282 282 foreach ( $post_ids as $id ) { 283 283 wp_set_post_terms( $id, $cheddar, $tax ); … … 286 286 $this->assertEquals( 2, $term->count ); 287 287 288 $brie = self:: $factory->term->create( array( 'name' => 'Brie', 'parent' => $cheese, 'taxonomy' => $tax ) );289 $post_id = self:: $factory->post->create();288 $brie = self::factory()->term->create( array( 'name' => 'Brie', 'parent' => $cheese, 'taxonomy' => $tax ) ); 289 $post_id = self::factory()->post->create(); 290 290 wp_set_post_terms( $post_id, $brie, $tax ); 291 291 $term = get_term( $brie, $tax ); 292 292 $this->assertEquals( 1, $term->count ); 293 293 294 $crackers = self:: $factory->term->create( array( 'name' => 'Crackers', 'taxonomy' => $tax ) );295 296 $butter = self:: $factory->term->create( array( 'name' => 'Butter', 'parent' => $crackers, 'taxonomy' => $tax ) );297 $post_ids = self:: $factory->post->create_many( 1 );294 $crackers = self::factory()->term->create( array( 'name' => 'Crackers', 'taxonomy' => $tax ) ); 295 296 $butter = self::factory()->term->create( array( 'name' => 'Butter', 'parent' => $crackers, 'taxonomy' => $tax ) ); 297 $post_ids = self::factory()->post->create_many( 1 ); 298 298 foreach ( $post_ids as $id ) { 299 299 wp_set_post_terms( $id, $butter, $tax ); … … 302 302 $this->assertEquals( 1, $term->count ); 303 303 304 $multigrain = self:: $factory->term->create( array( 'name' => 'Multigrain', 'parent' => $crackers, 'taxonomy' => $tax ) );305 $post_ids = self:: $factory->post->create_many( 1 );304 $multigrain = self::factory()->term->create( array( 'name' => 'Multigrain', 'parent' => $crackers, 'taxonomy' => $tax ) ); 305 $post_ids = self::factory()->post->create_many( 1 ); 306 306 foreach ( $post_ids as $id ) { 307 307 wp_set_post_terms( $id, $multigrain, $tax ); … … 310 310 $this->assertEquals( 1, $term->count ); 311 311 312 $fruit = self:: $factory->term->create( array( 'name' => 'Fruit', 'taxonomy' => $tax ) );313 $cranberries = self:: $factory->term->create( array( 'name' => 'Cranberries', 'parent' => $fruit, 'taxonomy' => $tax ) );312 $fruit = self::factory()->term->create( array( 'name' => 'Fruit', 'taxonomy' => $tax ) ); 313 $cranberries = self::factory()->term->create( array( 'name' => 'Cranberries', 'parent' => $fruit, 'taxonomy' => $tax ) ); 314 314 315 315 $terms = get_terms( $tax, array( 'parent' => 0, 'cache_domain' => $tax ) ); … … 325 325 register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) ); 326 326 327 $cheese = self:: $factory->term->create( array( 'name' => 'Cheese', 'taxonomy' => $tax ) );328 $cheddar = self:: $factory->term->create( array( 'name' => 'Cheddar', 'parent' => $cheese, 'taxonomy' => $tax ) );329 $spread = self:: $factory->term->create( array( 'name' => 'Spread', 'parent' => $cheddar, 'taxonomy' => $tax ) );330 $post_id = self:: $factory->post->create();327 $cheese = self::factory()->term->create( array( 'name' => 'Cheese', 'taxonomy' => $tax ) ); 328 $cheddar = self::factory()->term->create( array( 'name' => 'Cheddar', 'parent' => $cheese, 'taxonomy' => $tax ) ); 329 $spread = self::factory()->term->create( array( 'name' => 'Spread', 'parent' => $cheddar, 'taxonomy' => $tax ) ); 330 $post_id = self::factory()->post->create(); 331 331 wp_set_post_terms( $post_id, $spread, $tax ); 332 332 $term = get_term( $spread, $tax ); … … 349 349 $t = array(); 350 350 foreach ( range( 1, 7 ) as $depth ) { 351 $t[$depth] = self:: $factory->term->create( array( 'name' => 'term' . $depth, 'taxonomy' => $tax, 'parent' => $parent ) );351 $t[$depth] = self::factory()->term->create( array( 'name' => 'term' . $depth, 'taxonomy' => $tax, 'parent' => $parent ) ); 352 352 $parent = $t[$depth]; 353 353 } 354 $post_id = self:: $factory->post->create();354 $post_id = self::factory()->post->create(); 355 355 wp_set_post_terms( $post_id, $t[7], $tax ); 356 356 $term = get_term( $t[7], $tax ); … … 368 368 */ 369 369 function test_get_terms_child_of() { 370 $parent = self:: $factory->category->create();371 $child = self:: $factory->category->create( array( 'parent' => $parent ) );370 $parent = self::factory()->category->create(); 371 $child = self::factory()->category->create( array( 'parent' => $parent ) ); 372 372 373 373 $terms = get_terms( 'category', array( 'child_of' => $parent, 'hide_empty' => false ) ); … … 383 383 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true, ) ); 384 384 385 $terms = self:: $factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );385 $terms = self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); 386 386 387 387 $num_queries = $wpdb->num_queries; … … 403 403 register_taxonomy( 'wptests_tax2', 'post', array( 'hierarchical' => true ) ); 404 404 405 $t1 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );406 $t2 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );407 $t3 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t2 ) );405 $t1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax1' ) ); 406 $t2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax2' ) ); 407 $t3 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t2 ) ); 408 408 409 409 $found = get_terms( array( 'wptests_tax1', 'wptests_tax2' ), array( … … 441 441 remove_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10 ); 442 442 443 $c1 = self:: $factory->category->create();444 $c2 = self:: $factory->category->create( array( 'parent' => $c1 ) );445 $c3 = self:: $factory->category->create( array( 'parent' => $c2 ) );443 $c1 = self::factory()->category->create(); 444 $c2 = self::factory()->category->create( array( 'parent' => $c1 ) ); 445 $c3 = self::factory()->category->create( array( 'parent' => $c2 ) ); 446 446 wp_update_term( $c1, 'category', array( 'parent' => $c3 ) ); 447 447 … … 460 460 remove_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10 ); 461 461 462 $c1 = self:: $factory->category->create_and_get();463 $c2 = self:: $factory->category->create_and_get( array( 'parent' => $c1->term_id ) );464 $c3 = self:: $factory->category->create_and_get( array( 'parent' => $c2->term_id ) );462 $c1 = self::factory()->category->create_and_get(); 463 $c2 = self::factory()->category->create_and_get( array( 'parent' => $c1->term_id ) ); 464 $c3 = self::factory()->category->create_and_get( array( 'parent' => $c2->term_id ) ); 465 465 wp_update_term( $c1->term_id, 'category', array( 'parent' => $c3->term_id ) ); 466 466 … … 473 473 474 474 public function test_get_terms_by_slug() { 475 $t1 = self:: $factory->tag->create( array( 'slug' => 'foo' ) );476 $t2 = self:: $factory->tag->create( array( 'slug' => 'bar' ) );475 $t1 = self::factory()->tag->create( array( 'slug' => 'foo' ) ); 476 $t2 = self::factory()->tag->create( array( 'slug' => 'bar' ) ); 477 477 478 478 $found = get_terms( 'post_tag', array( … … 489 489 */ 490 490 public function test_get_terms_by_multiple_slugs() { 491 $t1 = self:: $factory->tag->create( array( 'slug' => 'foo' ) );492 $t2 = self:: $factory->tag->create( array( 'slug' => 'bar' ) );493 $t3 = self:: $factory->tag->create( array( 'slug' => 'barry' ) );491 $t1 = self::factory()->tag->create( array( 'slug' => 'foo' ) ); 492 $t2 = self::factory()->tag->create( array( 'slug' => 'bar' ) ); 493 $t3 = self::factory()->tag->create( array( 'slug' => 'barry' ) ); 494 494 495 495 $found = get_terms( 'post_tag', array( … … 506 506 */ 507 507 public function test_get_terms_by_name() { 508 $t1 = self:: $factory->tag->create( array( 'name' => 'Foo' ) );509 $t2 = self:: $factory->tag->create( array( 'name' => 'Bar' ) );508 $t1 = self::factory()->tag->create( array( 'name' => 'Foo' ) ); 509 $t2 = self::factory()->tag->create( array( 'name' => 'Bar' ) ); 510 510 511 511 $found = get_terms( 'post_tag', array( … … 522 522 */ 523 523 public function test_get_terms_by_multiple_names() { 524 $t1 = self:: $factory->tag->create( array( 'name' => 'Foo' ) );525 $t2 = self:: $factory->tag->create( array( 'name' => 'Bar' ) );526 $t3 = self:: $factory->tag->create( array( 'name' => 'Barry' ) );524 $t1 = self::factory()->tag->create( array( 'name' => 'Foo' ) ); 525 $t2 = self::factory()->tag->create( array( 'name' => 'Bar' ) ); 526 $t3 = self::factory()->tag->create( array( 'name' => 'Barry' ) ); 527 527 528 528 $found = get_terms( 'post_tag', array( … … 541 541 register_taxonomy( 'wptests_tax', 'post' ); 542 542 543 $t = self:: $factory->term->create( array(543 $t = self::factory()->term->create( array( 544 544 'taxonomy' => 'wptests_tax', 545 545 'name' => 'Foo & Bar', … … 570 570 $flat_tax = 'countries'; 571 571 register_taxonomy( $flat_tax, 'post', array( 'hierarchical' => false ) ); 572 $australia = self:: $factory->term->create( array( 'name' => 'Australia', 'taxonomy' => $flat_tax ) );573 $china = self:: $factory->term->create( array( 'name' => 'China', 'taxonomy' => $flat_tax ) );574 $tanzania = self:: $factory->term->create( array( 'name' => 'Tanzania', 'taxonomy' => $flat_tax ) );572 $australia = self::factory()->term->create( array( 'name' => 'Australia', 'taxonomy' => $flat_tax ) ); 573 $china = self::factory()->term->create( array( 'name' => 'China', 'taxonomy' => $flat_tax ) ); 574 $tanzania = self::factory()->term->create( array( 'name' => 'Tanzania', 'taxonomy' => $flat_tax ) ); 575 575 576 576 $terms = get_terms( $flat_tax, array( … … 602 602 */ 603 603 // Level 1 604 $canada = self:: $factory->term->create( array( 'name' => 'Canada', 'taxonomy' => $tax ) );604 $canada = self::factory()->term->create( array( 'name' => 'Canada', 'taxonomy' => $tax ) ); 605 605 606 606 // Level 2 607 $ontario = self:: $factory->term->create( array( 'name' => 'Ontario', 'parent' => $canada, 'taxonomy' => $tax ) );608 $quebec = self:: $factory->term->create( array( 'name' => 'Quebec', 'parent' => $canada, 'taxonomy' => $tax ) );609 $pei = self:: $factory->term->create( array( 'name' => 'PEI', 'parent' => $canada, 'taxonomy' => $tax ) );607 $ontario = self::factory()->term->create( array( 'name' => 'Ontario', 'parent' => $canada, 'taxonomy' => $tax ) ); 608 $quebec = self::factory()->term->create( array( 'name' => 'Quebec', 'parent' => $canada, 'taxonomy' => $tax ) ); 609 $pei = self::factory()->term->create( array( 'name' => 'PEI', 'parent' => $canada, 'taxonomy' => $tax ) ); 610 610 611 611 // Level 3 612 $toronto = self:: $factory->term->create( array( 'name' => 'Toronto', 'parent' => $ontario, 'taxonomy' => $tax ) );613 $ottawa = self:: $factory->term->create( array( 'name' => 'Ottawa', 'parent' => $ontario, 'taxonomy' => $tax ) );614 $montreal = self:: $factory->term->create( array( 'name' => 'Montreal', 'parent' => $quebec, 'taxonomy' => $tax ) );612 $toronto = self::factory()->term->create( array( 'name' => 'Toronto', 'parent' => $ontario, 'taxonomy' => $tax ) ); 613 $ottawa = self::factory()->term->create( array( 'name' => 'Ottawa', 'parent' => $ontario, 'taxonomy' => $tax ) ); 614 $montreal = self::factory()->term->create( array( 'name' => 'Montreal', 'parent' => $quebec, 'taxonomy' => $tax ) ); 615 615 616 616 // Level 4 617 $nepean = self:: $factory->term->create( array( 'name' => 'Nepean', 'parent' => $ottawa, 'taxonomy' => $tax ) );617 $nepean = self::factory()->term->create( array( 'name' => 'Nepean', 'parent' => $ottawa, 'taxonomy' => $tax ) ); 618 618 619 619 $terms = get_terms( $tax, array( … … 634 634 635 635 // Level 1 636 $canada = self:: $factory->term->create( array( 'name' => 'Canada', 'taxonomy' => $tax ) );636 $canada = self::factory()->term->create( array( 'name' => 'Canada', 'taxonomy' => $tax ) ); 637 637 638 638 // Level 2 639 $ontario = self:: $factory->term->create( array( 'name' => 'Ontario', 'parent' => $canada, 'taxonomy' => $tax ) );640 $quebec = self:: $factory->term->create( array( 'name' => 'Quebec', 'parent' => $canada, 'taxonomy' => $tax ) );639 $ontario = self::factory()->term->create( array( 'name' => 'Ontario', 'parent' => $canada, 'taxonomy' => $tax ) ); 640 $quebec = self::factory()->term->create( array( 'name' => 'Quebec', 'parent' => $canada, 'taxonomy' => $tax ) ); 641 641 642 642 // Level 3 643 $laval = self:: $factory->term->create( array( 'name' => 'Laval', 'parent' => $quebec, 'taxonomy' => $tax ) );644 $montreal = self:: $factory->term->create( array( 'name' => 'Montreal', 'parent' => $quebec, 'taxonomy' => $tax ) );643 $laval = self::factory()->term->create( array( 'name' => 'Laval', 'parent' => $quebec, 'taxonomy' => $tax ) ); 644 $montreal = self::factory()->term->create( array( 'name' => 'Montreal', 'parent' => $quebec, 'taxonomy' => $tax ) ); 645 645 646 646 // Level 4 647 $dorval = self:: $factory->term->create( array( 'name' => 'Dorval', 'parent' => $montreal, 'taxonomy' => $tax ) );647 $dorval = self::factory()->term->create( array( 'name' => 'Dorval', 'parent' => $montreal, 'taxonomy' => $tax ) ); 648 648 649 649 $terms = get_terms( $tax, array( … … 664 664 register_taxonomy( 'wptests_tax2', 'post', array( 'hierarchical' => true ) ); 665 665 666 $t1 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );667 $t2 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax1', 'parent' => $t1 ) );668 $t3 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );669 $t4 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t3 ) );666 $t1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax1' ) ); 667 $t2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax1', 'parent' => $t1 ) ); 668 $t3 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax2' ) ); 669 $t4 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t3 ) ); 670 670 671 671 $found = get_terms( array( 'wptests_tax1', 'wptests_tax2' ), array( … … 1099 1099 register_taxonomy( 'wptests_tax2', 'post', array( 'hierarchical' => true ) ); 1100 1100 1101 $t1 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );1102 $t2 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax1', 'parent' => $t1 ) );1103 $t3 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax1', 'parent' => $t2 ) );1104 1105 $t4 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );1106 $t5 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t4 ) );1107 $t6 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t5 ) );1108 1109 $p = self:: $factory->post->create();1101 $t1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax1' ) ); 1102 $t2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax1', 'parent' => $t1 ) ); 1103 $t3 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax1', 'parent' => $t2 ) ); 1104 1105 $t4 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax2' ) ); 1106 $t5 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t4 ) ); 1107 $t6 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t5 ) ); 1108 1109 $p = self::factory()->post->create(); 1110 1110 1111 1111 wp_set_object_terms( $p, $t3, 'wptests_tax1' ); … … 1141 1141 register_taxonomy( $tax, 'post' ); 1142 1142 1143 $t1 = self:: $factory->term->create( array( 'taxonomy' => $tax ) );1144 $t2 = self:: $factory->term->create( array( 'taxonomy' => $tax ) );1145 $t3 = self:: $factory->term->create( array( 'taxonomy' => $tax ) );1146 $t4 = self:: $factory->term->create( array( 'taxonomy' => $tax ) );1143 $t1 = self::factory()->term->create( array( 'taxonomy' => $tax ) ); 1144 $t2 = self::factory()->term->create( array( 'taxonomy' => $tax ) ); 1145 $t3 = self::factory()->term->create( array( 'taxonomy' => $tax ) ); 1146 $t4 = self::factory()->term->create( array( 'taxonomy' => $tax ) ); 1147 1147 1148 1148 $found = get_terms( $tax, array( … … 1165 1165 register_taxonomy( $tax, 'post' ); 1166 1166 1167 $t1 = self:: $factory->term->create( array( 'taxonomy' => $tax, 'description' => 'fff' ) );1168 $t2 = self:: $factory->term->create( array( 'taxonomy' => $tax, 'description' => 'aaa' ) );1169 $t3 = self:: $factory->term->create( array( 'taxonomy' => $tax, 'description' => 'zzz' ) );1170 $t4 = self:: $factory->term->create( array( 'taxonomy' => $tax, 'description' => 'jjj' ) );1167 $t1 = self::factory()->term->create( array( 'taxonomy' => $tax, 'description' => 'fff' ) ); 1168 $t2 = self::factory()->term->create( array( 'taxonomy' => $tax, 'description' => 'aaa' ) ); 1169 $t3 = self::factory()->term->create( array( 'taxonomy' => $tax, 'description' => 'zzz' ) ); 1170 $t4 = self::factory()->term->create( array( 'taxonomy' => $tax, 'description' => 'jjj' ) ); 1171 1171 1172 1172 $found = get_terms( $tax, array( … … 1186 1186 public function test_orderby_term_id() { 1187 1187 register_taxonomy( 'wptests_tax', 'post' ); 1188 $t1 = self:: $factory->term->create( array(1188 $t1 = self::factory()->term->create( array( 1189 1189 'taxonomy' => 'wptests_tax', 1190 1190 'name' => 'AAA', 1191 1191 ) ); 1192 $t2 = self:: $factory->term->create( array(1192 $t2 = self::factory()->term->create( array( 1193 1193 'taxonomy' => 'wptests_tax', 1194 1194 'name' => 'ZZZ', 1195 1195 ) ); 1196 $t3 = self:: $factory->term->create( array(1196 $t3 = self::factory()->term->create( array( 1197 1197 'taxonomy' => 'wptests_tax', 1198 1198 'name' => 'JJJ', … … 1244 1244 public function test_hierarchical_false_with_child_of_and_direct_child() { 1245 1245 $initial_terms = $this->create_hierarchical_terms(); 1246 $post_id = self:: $factory->post->create();1246 $post_id = self::factory()->post->create(); 1247 1247 wp_set_post_terms( 1248 1248 $post_id, … … 1324 1324 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true, ) ); 1325 1325 1326 $terms = self:: $factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );1326 $terms = self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); 1327 1327 1328 1328 $num_queries = $wpdb->num_queries; … … 1344 1344 register_taxonomy( 'wptests_tax2', 'post', array( 'hierarchical' => true ) ); 1345 1345 1346 $t1 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );1347 $t2 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );1348 $t3 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t2 ) );1346 $t1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax1' ) ); 1347 $t2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax2' ) ); 1348 $t3 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t2 ) ); 1349 1349 1350 1350 $found = get_terms( array( 'wptests_tax1', 'wptests_tax2' ), array( … … 1396 1396 register_taxonomy( 'wptests_tax_1', 'post', array( 'hierarchical' => true ) ); 1397 1397 1398 $posts = self:: $factory->post->create_many( 3 );1399 1400 $t1 = self:: $factory->term->create( array(1398 $posts = self::factory()->post->create_many( 3 ); 1399 1400 $t1 = self::factory()->term->create( array( 1401 1401 'taxonomy' => 'wptests_tax_1', 1402 1402 ) ); 1403 $t2 = self:: $factory->term->create( array(1403 $t2 = self::factory()->term->create( array( 1404 1404 'taxonomy' => 'wptests_tax_1', 1405 1405 'parent' => $t1, 1406 1406 ) ); 1407 $t3 = self:: $factory->term->create( array(1407 $t3 = self::factory()->term->create( array( 1408 1408 'taxonomy' => 'wptests_tax_1', 1409 1409 'parent' => $t2, … … 1437 1437 remove_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10 ); 1438 1438 1439 $c1 = self:: $factory->category->create();1440 $c2 = self:: $factory->category->create( array( 'parent' => $c1 ) );1441 $c3 = self:: $factory->category->create( array( 'parent' => $c2 ) );1439 $c1 = self::factory()->category->create(); 1440 $c2 = self::factory()->category->create( array( 'parent' => $c1 ) ); 1441 $c3 = self::factory()->category->create( array( 'parent' => $c2 ) ); 1442 1442 wp_update_term( $c1, 'category', array( 'parent' => $c3 ) ); 1443 1443 1444 1444 add_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10, 3 ); 1445 1445 1446 $posts = self:: $factory->post->create_many( 3 );1446 $posts = self::factory()->post->create_many( 3 ); 1447 1447 wp_set_post_terms( $posts[0], $c1, 'category' ); 1448 1448 wp_set_post_terms( $posts[1], $c2, 'category' ); … … 1467 1467 register_taxonomy( 'wptests_tax2', 'post', array( 'hierarchical' => true ) ); 1468 1468 1469 $t1 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );1470 $t2 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );1471 $t3 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t2 ) );1472 1473 $posts = self:: $factory->post->create_many( 3 );1469 $t1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax1' ) ); 1470 $t2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax2' ) ); 1471 $t3 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax2', 'parent' => $t2 ) ); 1472 1473 $posts = self::factory()->post->create_many( 3 ); 1474 1474 wp_set_object_terms( $posts[0], $t1, 'wptests_tax1' ); 1475 1475 wp_set_object_terms( $posts[1], $t2, 'wptests_tax2' ); … … 1500 1500 1501 1501 register_taxonomy( 'wptests_tax', 'post' ); 1502 $terms = self:: $factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );1502 $terms = self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); 1503 1503 add_term_meta( $terms[0], 'foo', 'bar' ); 1504 1504 add_term_meta( $terms[1], 'foo', 'bar' ); … … 1526 1526 1527 1527 register_taxonomy( 'wptests_tax', 'post' ); 1528 $terms = self:: $factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );1528 $terms = self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); 1529 1529 add_term_meta( $terms[0], 'foo', 'bar' ); 1530 1530 add_term_meta( $terms[1], 'foo', 'bar' ); … … 1551 1551 public function test_meta_query() { 1552 1552 register_taxonomy( 'wptests_tax', 'post' ); 1553 $terms = self:: $factory->term->create_many( 5, array( 'taxonomy' => 'wptests_tax' ) );1553 $terms = self::factory()->term->create_many( 5, array( 'taxonomy' => 'wptests_tax' ) ); 1554 1554 add_term_meta( $terms[0], 'foo', 'bar' ); 1555 1555 add_term_meta( $terms[1], 'foo', 'bar' ); … … 1576 1576 public function test_should_return_wp_term_objects() { 1577 1577 register_taxonomy( 'wptests_tax', 'post' ); 1578 $terms = self:: $factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );1578 $terms = self::factory()->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) ); 1579 1579 1580 1580 $found = get_terms( 'wptests_tax', array( … … 1598 1598 1599 1599 register_taxonomy( 'wptests_tax', 'post' ); 1600 $terms = self:: $factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );1600 $terms = self::factory()->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) ); 1601 1601 1602 1602 // Prime the cache. … … 1629 1629 1630 1630 register_taxonomy( 'wptests_tax', 'post' ); 1631 $terms = self:: $factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );1631 $terms = self::factory()->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) ); 1632 1632 1633 1633 $found = get_terms( 'wptests_tax', array( … … 1645 1645 $terms = array(); 1646 1646 1647 $terms['parent1'] = self:: $factory->term->create( array( 'slug' => 'parent-1', 'name' => 'Parent 1', 'taxonomy' => 'hierarchical_fields' ) );1648 $terms['parent2'] = self:: $factory->term->create( array( 'slug' => 'parent-2', 'name' => 'Parent 2', 'taxonomy' => 'hierarchical_fields' ) );1649 $terms['child1'] = self:: $factory->term->create( array( 'slug' => 'child-1', 'name' => 'Child 1', 'taxonomy' => 'hierarchical_fields', 'parent' => $terms['parent1'] ) );1650 $terms['child2'] = self:: $factory->term->create( array( 'slug' => 'child-2', 'name' => 'Child 2', 'taxonomy' => 'hierarchical_fields', 'parent' => $terms['parent1'] ) );1651 $terms['grandchild1'] = self:: $factory->term->create( array( 'slug' => 'grandchild-1', 'name' => 'Grandchild 1', 'taxonomy' => 'hierarchical_fields', 'parent' => $terms['child1'] ) );1652 1653 $post_id = self:: $factory->post->create();1647 $terms['parent1'] = self::factory()->term->create( array( 'slug' => 'parent-1', 'name' => 'Parent 1', 'taxonomy' => 'hierarchical_fields' ) ); 1648 $terms['parent2'] = self::factory()->term->create( array( 'slug' => 'parent-2', 'name' => 'Parent 2', 'taxonomy' => 'hierarchical_fields' ) ); 1649 $terms['child1'] = self::factory()->term->create( array( 'slug' => 'child-1', 'name' => 'Child 1', 'taxonomy' => 'hierarchical_fields', 'parent' => $terms['parent1'] ) ); 1650 $terms['child2'] = self::factory()->term->create( array( 'slug' => 'child-2', 'name' => 'Child 2', 'taxonomy' => 'hierarchical_fields', 'parent' => $terms['parent1'] ) ); 1651 $terms['grandchild1'] = self::factory()->term->create( array( 'slug' => 'grandchild-1', 'name' => 'Grandchild 1', 'taxonomy' => 'hierarchical_fields', 'parent' => $terms['child1'] ) ); 1652 1653 $post_id = self::factory()->post->create(); 1654 1654 wp_set_post_terms( $post_id, $terms['parent2'], 'hierarchical_fields', true ); 1655 1655 wp_set_post_terms( $post_id, $terms['child1'], 'hierarchical_fields', true ); … … 1715 1715 1716 1716 // Ensure child terms are not empty 1717 $first_post_id = self:: $factory->post->create();1718 $second_post_id = self:: $factory->post->create();1717 $first_post_id = self::factory()->post->create(); 1718 $second_post_id = self::factory()->post->create(); 1719 1719 wp_set_post_terms( $first_post_id, array( $three_term['term_id'] ), 'category' ); 1720 1720 wp_set_post_terms( $second_post_id, array( $six_term['term_id'] ), 'category' ); … … 1732 1732 1733 1733 protected function set_up_three_posts_and_tags() { 1734 $posts = self:: $factory->post->create_many( 3, array( 'post_type' => 'post' ) );1734 $posts = self::factory()->post->create_many( 3, array( 'post_type' => 'post' ) ); 1735 1735 foreach ( $posts as $post ) { 1736 1736 wp_set_object_terms( $post, rand_str(), 'post_tag' ); -
trunk/tests/phpunit/tests/term/isObjectInTerm.php
r35225 r35242 8 8 register_taxonomy( 'wptests_tax', 'post' ); 9 9 10 $t1 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );11 $t2 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );10 $t1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 11 $t2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 12 12 13 $posts = self:: $factory->post->create_many( 2 );13 $posts = self::factory()->post->create_many( 2 ); 14 14 wp_set_object_terms( $posts[0], array( $t1 ), 'wptests_tax' ); 15 15 … … 23 23 register_taxonomy( 'wptests_tax', 'post' ); 24 24 25 $t1 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );26 $t2 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );25 $t1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 26 $t2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 27 27 28 $posts = self:: $factory->post->create_many( 2 );28 $posts = self::factory()->post->create_many( 2 ); 29 29 wp_set_object_terms( $posts[0], array( $t1 ), 'wptests_tax' ); 30 30 … … 41 41 register_taxonomy( 'wptests_tax', 'post' ); 42 42 43 $t1 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Foo' ) );44 $t2 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Bar') );43 $t1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Foo' ) ); 44 $t2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'name' => 'Bar') ); 45 45 46 $posts = self:: $factory->post->create_many( 2 );46 $posts = self::factory()->post->create_many( 2 ); 47 47 wp_set_object_terms( $posts[0], array( $t1 ), 'wptests_tax' ); 48 48 … … 56 56 register_taxonomy( 'wptests_tax', 'post' ); 57 57 58 $t1 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax', 'slug' => 'foo' ) );59 $t2 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax', 'slug' => 'bar') );58 $t1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'slug' => 'foo' ) ); 59 $t2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'slug' => 'bar') ); 60 60 61 $posts = self:: $factory->post->create_many( 2 );61 $posts = self::factory()->post->create_many( 2 ); 62 62 wp_set_object_terms( $posts[0], array( $t1 ), 'wptests_tax' ); 63 63 … … 71 71 register_taxonomy( 'wptests_tax', 'post' ); 72 72 73 $t1 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax', 'slug' => 'foo' ) );74 $t2 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax', 'slug' => 'bar') );73 $t1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'slug' => 'foo' ) ); 74 $t2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax', 'slug' => 'bar') ); 75 75 76 $posts = self:: $factory->post->create_many( 2 );76 $posts = self::factory()->post->create_many( 2 ); 77 77 wp_set_object_terms( $posts[0], array( $t1 ), 'wptests_tax' ); 78 78 … … 88 88 public function test_should_not_return_true_if_term_name_begins_with_existing_term_id() { 89 89 register_taxonomy( 'wptests_tax', 'post' ); 90 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );90 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 91 91 92 $post_ID = self:: $factory->post->create();92 $post_ID = self::factory()->post->create(); 93 93 wp_set_object_terms( $post_ID, $t, 'wptests_tax' ); 94 94 … … 109 109 110 110 register_taxonomy( 'wptests_tax', 'post' ); 111 $terms = self:: $factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );111 $terms = self::factory()->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) ); 112 112 113 113 $o = 12345; … … 130 130 131 131 register_taxonomy( 'wptests_tax', 'post' ); 132 $terms = self:: $factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );132 $terms = self::factory()->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) ); 133 133 134 134 $o = 12345; -
trunk/tests/phpunit/tests/term/meta.php
r35225 r35242 13 13 14 14 public function test_add() { 15 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );15 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 16 16 17 17 $this->assertNotEmpty( add_term_meta( $t, 'foo', 'bar' ) ); … … 19 19 20 20 public function test_add_unique() { 21 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );21 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 22 22 23 23 $this->assertNotEmpty( add_term_meta( $t, 'foo', 'bar' ) ); … … 26 26 27 27 public function test_delete() { 28 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );28 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 29 29 add_term_meta( $t, 'foo', 'bar' ); 30 30 … … 33 33 34 34 public function test_delete_with_invalid_meta_key_should_return_false() { 35 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );35 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 36 36 37 37 $this->assertFalse( delete_term_meta( $t, 'foo' ) ); … … 39 39 40 40 public function test_delete_should_respect_meta_value() { 41 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );41 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 42 42 add_term_meta( $t, 'foo', 'bar' ); 43 43 add_term_meta( $t, 'foo', 'baz' ); … … 50 50 51 51 public function test_get_with_no_key_should_fetch_all_keys() { 52 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );52 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 53 53 add_term_meta( $t, 'foo', 'bar' ); 54 54 add_term_meta( $t, 'foo1', 'baz' ); … … 64 64 65 65 public function test_get_with_key_should_fetch_all_for_key() { 66 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );66 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 67 67 add_term_meta( $t, 'foo', 'bar' ); 68 68 add_term_meta( $t, 'foo', 'baz' ); … … 76 76 77 77 public function test_get_should_respect_single_true() { 78 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );78 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 79 79 add_term_meta( $t, 'foo', 'bar' ); 80 80 add_term_meta( $t, 'foo', 'baz' ); … … 85 85 86 86 public function test_update_should_pass_to_add_when_no_value_exists_for_key() { 87 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );87 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 88 88 89 89 $actual = update_term_meta( $t, 'foo', 'bar' ); … … 96 96 97 97 public function test_update_should_return_true_when_updating_existing_value_for_key() { 98 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );98 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 99 99 100 100 add_term_meta( $t, 'foo', 'bar' ); … … 110 110 global $wpdb; 111 111 112 $p = self:: $factory->post->create( array( 'post_status' => 'publish' ) );112 $p = self::factory()->post->create( array( 'post_status' => 'publish' ) ); 113 113 114 114 register_taxonomy( 'wptests_tax', 'post' ); 115 $terms = self:: $factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );115 $terms = self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); 116 116 wp_set_object_terms( $p, $terms, 'wptests_tax' ); 117 117 foreach ( $terms as $t ) { … … 120 120 121 121 // Create another term, which should *not* be lazy loaded because it's unattached. 122 $orphan_term = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );122 $orphan_term = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 123 123 add_term_meta( $orphan_term, 'foo', 'bar' ); 124 124 … … 155 155 global $wpdb; 156 156 157 $posts = self:: $factory->post->create_many( 3, array( 'post_status' => 'publish' ) );157 $posts = self::factory()->post->create_many( 3, array( 'post_status' => 'publish' ) ); 158 158 register_taxonomy( 'wptests_tax', 'post' ); 159 $terms = self:: $factory->term->create_many( 6, array( 'taxonomy' => 'wptests_tax' ) );159 $terms = self::factory()->term->create_many( 6, array( 'taxonomy' => 'wptests_tax' ) ); 160 160 161 161 wp_set_object_terms( $posts[0], array( $terms[0], $terms[1] ), 'wptests_tax' ); … … 202 202 203 203 public function test_adding_term_meta_should_bust_get_terms_cache() { 204 $terms = self:: $factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );204 $terms = self::factory()->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) ); 205 205 206 206 add_term_meta( $terms[0], 'foo', 'bar' ); … … 237 237 238 238 public function test_updating_term_meta_should_bust_get_terms_cache() { 239 $terms = self:: $factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );239 $terms = self::factory()->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) ); 240 240 241 241 add_term_meta( $terms[0], 'foo', 'bar' ); … … 273 273 274 274 public function test_deleting_term_meta_should_bust_get_terms_cache() { 275 $terms = self:: $factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );275 $terms = self::factory()->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) ); 276 276 277 277 add_term_meta( $terms[0], 'foo', 'bar' ); -
trunk/tests/phpunit/tests/term/query.php
r35225 r35242 126 126 127 127 public function test_transform_query_resulting_field_sanitized() { 128 $t1 = self:: $factory->category->create( array( 'slug' => 'foo', ) );129 $t2 = self:: $factory->category->create( array( 'slug' => 'bar', ) );130 $p = self:: $factory->post->create();128 $t1 = self::factory()->category->create( array( 'slug' => 'foo', ) ); 129 $t2 = self::factory()->category->create( array( 'slug' => 'bar', ) ); 130 $p = self::factory()->post->create(); 131 131 wp_set_post_categories( $p, $t1 ); 132 132 … … 151 151 152 152 public function test_transform_query_field_slug() { 153 $t1 = self:: $factory->category->create( array( 'slug' => 'foo', ) );154 $p = self:: $factory->post->create();153 $t1 = self::factory()->category->create( array( 'slug' => 'foo', ) ); 154 $p = self::factory()->post->create(); 155 155 $tt_ids = wp_set_post_categories( $p, $t1 ); 156 156 … … 169 169 170 170 public function test_transform_query_field_name() { 171 $t1 = self:: $factory->category->create( array( 'slug' => 'foo', 'name' => 'Foo', ) );172 $p = self:: $factory->post->create();171 $t1 = self::factory()->category->create( array( 'slug' => 'foo', 'name' => 'Foo', ) ); 172 $p = self::factory()->post->create(); 173 173 $tt_ids = wp_set_post_categories( $p, $t1 ); 174 174 … … 187 187 188 188 public function test_transform_query_field_term_taxonomy_id() { 189 $t1 = self:: $factory->category->create( array( 'slug' => 'foo', 'name' => 'Foo', ) );190 $p = self:: $factory->post->create();189 $t1 = self::factory()->category->create( array( 'slug' => 'foo', 'name' => 'Foo', ) ); 190 $p = self::factory()->post->create(); 191 191 $tt_ids = wp_set_post_categories( $p, $t1 ); 192 192 … … 205 205 206 206 public function test_transform_query_field_term_taxonomy_default() { 207 $t1 = self:: $factory->category->create( array( 'slug' => 'foo', 'name' => 'Foo', ) );208 $p = self:: $factory->post->create();207 $t1 = self::factory()->category->create( array( 'slug' => 'foo', 'name' => 'Foo', ) ); 208 $p = self::factory()->post->create(); 209 209 $tt_ids = wp_set_post_categories( $p, $t1 ); 210 210 … … 241 241 register_taxonomy( 'wptests_tax', 'post' ); 242 242 243 $t1 = self:: $factory->term->create( array(244 'taxonomy' => 'wptests_tax', 245 ) ); 246 $t2 = self:: $factory->term->create( array(247 'taxonomy' => 'wptests_tax', 248 ) ); 249 $t3 = self:: $factory->term->create( array(243 $t1 = self::factory()->term->create( array( 244 'taxonomy' => 'wptests_tax', 245 ) ); 246 $t2 = self::factory()->term->create( array( 247 'taxonomy' => 'wptests_tax', 248 ) ); 249 $t3 = self::factory()->term->create( array( 250 250 'taxonomy' => 'wptests_tax', 251 251 ) ); … … 285 285 register_taxonomy( 'wptests_tax', 'post' ); 286 286 287 $t1 = self:: $factory->term->create( array(288 'taxonomy' => 'wptests_tax', 289 ) ); 290 $t2 = self:: $factory->term->create( array(291 'taxonomy' => 'wptests_tax', 292 ) ); 293 $t3 = self:: $factory->term->create( array(287 $t1 = self::factory()->term->create( array( 288 'taxonomy' => 'wptests_tax', 289 ) ); 290 $t2 = self::factory()->term->create( array( 291 'taxonomy' => 'wptests_tax', 292 ) ); 293 $t3 = self::factory()->term->create( array( 294 294 'taxonomy' => 'wptests_tax', 295 295 ) ); … … 328 328 register_taxonomy( 'wptests_tax', 'post' ); 329 329 330 $t1 = self:: $factory->term->create( array(331 'taxonomy' => 'wptests_tax', 332 ) ); 333 $t2 = self:: $factory->term->create( array(334 'taxonomy' => 'wptests_tax', 335 ) ); 336 $t3 = self:: $factory->term->create( array(330 $t1 = self::factory()->term->create( array( 331 'taxonomy' => 'wptests_tax', 332 ) ); 333 $t2 = self::factory()->term->create( array( 334 'taxonomy' => 'wptests_tax', 335 ) ); 336 $t3 = self::factory()->term->create( array( 337 337 'taxonomy' => 'wptests_tax', 338 338 ) ); -
trunk/tests/phpunit/tests/term/slashes.php
r35225 r35242 9 9 function setUp() { 10 10 parent::setUp(); 11 $this->author_id = self:: $factory->user->create( array( 'role' => 'administrator' ) );11 $this->author_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); 12 12 $this->old_current_user = get_current_user_id(); 13 13 wp_set_current_user( $this->author_id ); … … 85 85 ); 86 86 foreach ( $taxonomies as $taxonomy ) { 87 $id = self:: $factory->term->create(array(87 $id = self::factory()->term->create(array( 88 88 'taxonomy' => $taxonomy 89 89 )); -
trunk/tests/phpunit/tests/term/termExists.php
r35225 r35242 10 10 11 11 public function test_term_exists_term_int_taxonomy_nonempty_term_exists() { 12 $t = self:: $factory->term->create( array(12 $t = self::factory()->term->create( array( 13 13 'taxonomy' => 'post_tag', 14 14 ) ); … … 23 23 24 24 public function test_term_exists_term_int_taxonomy_nonempty_wrong_taxonomy() { 25 $t = self:: $factory->term->create( array(25 $t = self::factory()->term->create( array( 26 26 'taxonomy' => 'post_tag', 27 27 ) ); … … 31 31 32 32 public function test_term_exists_term_int_taxonomy_empty_term_exists() { 33 $t = self:: $factory->term->create( array(33 $t = self::factory()->term->create( array( 34 34 'taxonomy' => 'post_tag', 35 35 ) ); … … 44 44 45 45 public function test_term_exists_unslash_term() { 46 $t = self:: $factory->term->create( array(46 $t = self::factory()->term->create( array( 47 47 'taxonomy' => 'post_tag', 48 48 'name' => 'I "love" WordPress\'s taxonomy system', … … 54 54 55 55 public function test_term_exists_trim_term() { 56 $t = self:: $factory->term->create( array(56 $t = self::factory()->term->create( array( 57 57 'taxonomy' => 'post_tag', 58 58 'slug' => 'foo', … … 85 85 ) ); 86 86 87 $parent_term = self:: $factory->term->create( array(88 'taxonomy' => 'foo', 89 ) ); 90 91 $t = self:: $factory->term->create( array(87 $parent_term = self::factory()->term->create( array( 88 'taxonomy' => 'foo', 89 ) ); 90 91 $t = self::factory()->term->create( array( 92 92 'taxonomy' => 'foo', 93 93 'parent' => $parent_term, … … 111 111 ) ); 112 112 113 $parent_term = self:: $factory->term->create( array(114 'taxonomy' => 'foo', 115 ) ); 116 117 $t = self:: $factory->term->create( array(113 $parent_term = self::factory()->term->create( array( 114 'taxonomy' => 'foo', 115 ) ); 116 117 $t = self::factory()->term->create( array( 118 118 'taxonomy' => 'foo', 119 119 'parent' => $parent_term, … … 133 133 ) ); 134 134 135 $parent_term = self:: $factory->term->create( array(136 'taxonomy' => 'foo', 137 ) ); 138 139 $t = self:: $factory->term->create( array(135 $parent_term = self::factory()->term->create( array( 136 'taxonomy' => 'foo', 137 ) ); 138 139 $t = self::factory()->term->create( array( 140 140 'taxonomy' => 'foo', 141 141 'parent' => $parent_term, … … 154 154 register_taxonomy( 'foo', 'post', array() ); 155 155 156 $t = self:: $factory->term->create( array(156 $t = self::factory()->term->create( array( 157 157 'taxonomy' => 'foo', 158 158 'slug' => 'kewl-dudez', … … 170 170 register_taxonomy( 'foo', 'post', array() ); 171 171 172 $t = self:: $factory->term->create( array(172 $t = self::factory()->term->create( array( 173 173 'taxonomy' => 'foo', 174 174 'name' => 'Kewl Dudez', … … 186 186 register_taxonomy( 'foo', 'post', array() ); 187 187 188 $t = self:: $factory->term->create( array(188 $t = self::factory()->term->create( array( 189 189 'taxonomy' => 'foo', 190 190 'name' => 'juicy-fruit', … … 202 202 register_taxonomy( 'foo', 'post', array() ); 203 203 204 $t = self:: $factory->term->create( array(204 $t = self::factory()->term->create( array( 205 205 'taxonomy' => 'foo', 206 206 'name' => 'Juicy Fruit', -
trunk/tests/phpunit/tests/term/wpDeleteObjectTermRelationships.php
r35225 r35242 10 10 register_taxonomy( 'wptests_tax2', 'post' ); 11 11 12 $t1 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );13 $t2 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );12 $t1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax1' ) ); 13 $t2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax2' ) ); 14 14 15 15 $object_id = 567; … … 34 34 register_taxonomy( 'wptests_tax3', 'post' ); 35 35 36 $t1 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );37 $t2 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );38 $t3 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax3' ) );36 $t1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax1' ) ); 37 $t2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax2' ) ); 38 $t3 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax3' ) ); 39 39 40 40 $object_id = 567; -
trunk/tests/phpunit/tests/term/wpDeleteTerm.php
r35225 r35242 13 13 register_taxonomy( 'wptests_tax', 'post' ); 14 14 15 $terms = self:: $factory->term->create_many( 2, array(15 $terms = self::factory()->term->create_many( 2, array( 16 16 'taxonomy' => 'wptests_tax', 17 17 ) ); 18 18 19 $p = self:: $factory->post->create();19 $p = self::factory()->post->create(); 20 20 21 21 wp_set_object_terms( $p, array( $terms[0] ), 'wptests_tax' ); -
trunk/tests/phpunit/tests/term/wpGenerateTagCloud.php
r35225 r35242 28 28 */ 29 29 function test_empty_tags_list_returned( $expected, $args ) { 30 $term_ids = self:: $factory->term->create_many( 4, array( 'taxonomy' => 'post_tag' ) );30 $term_ids = self::factory()->term->create_many( 4, array( 'taxonomy' => 'post_tag' ) ); 31 31 $this->terms = array(); 32 32 foreach ( $term_ids as $term_id ) { … … 72 72 73 73 function test_hide_empty_false() { 74 $term_id = self:: $factory->tag->create();74 $term_id = self::factory()->tag->create(); 75 75 $term = get_term( $term_id, 'post_tag' ); 76 76 … … 86 86 87 87 function test_hide_empty_false_format_array() { 88 $term_id = self:: $factory->tag->create();88 $term_id = self::factory()->tag->create(); 89 89 $term = get_term( $term_id, 'post_tag' ); 90 90 … … 102 102 103 103 function test_hide_empty_false_format_list() { 104 $term_id = self:: $factory->tag->create();104 $term_id = self::factory()->tag->create(); 105 105 $term = get_term( $term_id, 'post_tag' ); 106 106 … … 118 118 119 119 function test_hide_empty_false_multi() { 120 $term_ids = self:: $factory->tag->create_many( 4 );120 $term_ids = self::factory()->tag->create_many( 4 ); 121 121 $terms = array(); 122 122 foreach ( $term_ids as $term_id ) { … … 140 140 141 141 function test_hide_empty_false_multi_format_list() { 142 $term_ids = self:: $factory->tag->create_many( 4 );142 $term_ids = self::factory()->tag->create_many( 4 ); 143 143 $terms = array(); 144 144 foreach ( $term_ids as $term_id ) { … … 167 167 public function test_topic_count_text() { 168 168 register_taxonomy( 'wptests_tax', 'post' ); 169 $term_ids = self:: $factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );169 $term_ids = self::factory()->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) ); 170 170 $this->terms = array(); 171 171 foreach ( $term_ids as $term_id ) { 172 172 $this->terms[] = get_term( $term_id, 'post_tag' ); 173 173 } 174 $posts = self:: $factory->post->create_many( 2 );174 $posts = self::factory()->post->create_many( 2 ); 175 175 176 176 wp_set_post_terms( $posts[0], $term_ids, 'wptests_tax' ); … … 197 197 public function test_topic_count_text_callback() { 198 198 register_taxonomy( 'wptests_tax', 'post' ); 199 $term_ids = self:: $factory->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) );199 $term_ids = self::factory()->term->create_many( 2, array( 'taxonomy' => 'wptests_tax' ) ); 200 200 $this->terms = array(); 201 201 foreach ( $term_ids as $term_id ) { 202 202 $this->terms[] = get_term( $term_id, 'post_tag' ); 203 203 } 204 $posts = self:: $factory->post->create_many( 2 );204 $posts = self::factory()->post->create_many( 2 ); 205 205 206 206 wp_set_post_terms( $posts[0], $term_ids, 'wptests_tax' ); -
trunk/tests/phpunit/tests/term/wpGetObjectTerms.php
r35225 r35242 14 14 15 15 public function test_get_object_terms_by_slug() { 16 $post_id = self:: $factory->post->create();16 $post_id = self::factory()->post->create(); 17 17 18 18 $terms_1 = array('Foo', 'Bar', 'Baz'); … … 32 32 */ 33 33 public function test_should_not_filter_out_duplicate_terms_associated_with_different_objects() { 34 $post_id1 = self:: $factory->post->create();35 $post_id2 = self:: $factory->post->create();36 $cat_id = self:: $factory->category->create();37 $cat_id2 = self:: $factory->category->create();34 $post_id1 = self::factory()->post->create(); 35 $post_id2 = self::factory()->post->create(); 36 $cat_id = self::factory()->category->create(); 37 $cat_id2 = self::factory()->category->create(); 38 38 wp_set_post_categories( $post_id1, array( $cat_id, $cat_id2 ) ); 39 39 wp_set_post_categories( $post_id2, $cat_id ); … … 55 55 */ 56 56 public function test_should_return_objects_with_int_properties() { 57 $post_id = self:: $factory->post->create();57 $post_id = self::factory()->post->create(); 58 58 $term = wp_insert_term( 'one', $this->taxonomy ); 59 59 wp_set_object_terms( $post_id, $term, $this->taxonomy ); … … 74 74 */ 75 75 public function test_references_should_be_reset_after_wp_get_object_terms_filter() { 76 $post_id = self:: $factory->post->create();76 $post_id = self::factory()->post->create(); 77 77 $terms_1 = array('foo', 'bar', 'baz'); 78 78 … … 87 87 88 88 public function test_orderby_name() { 89 $p = self:: $factory->post->create();90 91 $t1 = self:: $factory->term->create( array(89 $p = self::factory()->post->create(); 90 91 $t1 = self::factory()->term->create( array( 92 92 'taxonomy' => $this->taxonomy, 93 93 'name' => 'AAA', 94 94 ) ); 95 $t2 = self:: $factory->term->create( array(95 $t2 = self::factory()->term->create( array( 96 96 'taxonomy' => $this->taxonomy, 97 97 'name' => 'ZZZ', 98 98 ) ); 99 $t3 = self:: $factory->term->create( array(99 $t3 = self::factory()->term->create( array( 100 100 'taxonomy' => $this->taxonomy, 101 101 'name' => 'JJJ', … … 113 113 114 114 public function test_orderby_count() { 115 $posts = self:: $factory->post->create_many( 3 );116 117 $t1 = self:: $factory->term->create( array(115 $posts = self::factory()->post->create_many( 3 ); 116 117 $t1 = self::factory()->term->create( array( 118 118 'taxonomy' => $this->taxonomy, 119 119 'name' => 'AAA', 120 120 ) ); 121 $t2 = self:: $factory->term->create( array(121 $t2 = self::factory()->term->create( array( 122 122 'taxonomy' => $this->taxonomy, 123 123 'name' => 'ZZZ', 124 124 ) ); 125 $t3 = self:: $factory->term->create( array(125 $t3 = self::factory()->term->create( array( 126 126 'taxonomy' => $this->taxonomy, 127 127 'name' => 'JJJ', … … 141 141 142 142 public function test_orderby_slug() { 143 $p = self:: $factory->post->create();144 145 $t1 = self:: $factory->term->create( array(143 $p = self::factory()->post->create(); 144 145 $t1 = self::factory()->term->create( array( 146 146 'taxonomy' => $this->taxonomy, 147 147 'slug' => 'aaa', 148 148 ) ); 149 $t2 = self:: $factory->term->create( array(149 $t2 = self::factory()->term->create( array( 150 150 'taxonomy' => $this->taxonomy, 151 151 'slug' => 'zzz', 152 152 ) ); 153 $t3 = self:: $factory->term->create( array(153 $t3 = self::factory()->term->create( array( 154 154 'taxonomy' => $this->taxonomy, 155 155 'slug' => 'jjj', … … 167 167 168 168 public function test_orderby_term_group() { 169 $p = self:: $factory->post->create();170 171 $t1 = self:: $factory->term->create( array(172 'taxonomy' => $this->taxonomy, 173 ) ); 174 $t2 = self:: $factory->term->create( array(175 'taxonomy' => $this->taxonomy, 176 ) ); 177 $t3 = self:: $factory->term->create( array(169 $p = self::factory()->post->create(); 170 171 $t1 = self::factory()->term->create( array( 172 'taxonomy' => $this->taxonomy, 173 ) ); 174 $t2 = self::factory()->term->create( array( 175 'taxonomy' => $this->taxonomy, 176 ) ); 177 $t3 = self::factory()->term->create( array( 178 178 'taxonomy' => $this->taxonomy, 179 179 ) ); … … 196 196 197 197 public function test_orderby_term_order() { 198 $p = self:: $factory->post->create();199 200 $t1 = self:: $factory->term->create( array(201 'taxonomy' => $this->taxonomy, 202 ) ); 203 $t2 = self:: $factory->term->create( array(204 'taxonomy' => $this->taxonomy, 205 ) ); 206 $t3 = self:: $factory->term->create( array(198 $p = self::factory()->post->create(); 199 200 $t1 = self::factory()->term->create( array( 201 'taxonomy' => $this->taxonomy, 202 ) ); 203 $t2 = self::factory()->term->create( array( 204 'taxonomy' => $this->taxonomy, 205 ) ); 206 $t3 = self::factory()->term->create( array( 207 207 'taxonomy' => $this->taxonomy, 208 208 ) ); … … 232 232 */ 233 233 public function test_orderby_parent() { 234 $p = self:: $factory->post->create();235 236 $t1 = self:: $factory->term->create( array(237 'taxonomy' => $this->taxonomy, 238 ) ); 239 $t2 = self:: $factory->term->create( array(240 'taxonomy' => $this->taxonomy, 241 ) ); 242 $t3 = self:: $factory->term->create( array(234 $p = self::factory()->post->create(); 235 236 $t1 = self::factory()->term->create( array( 237 'taxonomy' => $this->taxonomy, 238 ) ); 239 $t2 = self::factory()->term->create( array( 240 'taxonomy' => $this->taxonomy, 241 ) ); 242 $t3 = self::factory()->term->create( array( 243 243 'taxonomy' => $this->taxonomy, 244 244 ) ); … … 270 270 register_taxonomy( 'wptests_tax_3', 'post' ); 271 271 272 $p = self:: $factory->post->create();273 274 $t1 = self:: $factory->term->create( array(275 'taxonomy' => $this->taxonomy, 276 ) ); 277 $t2 = self:: $factory->term->create( array(272 $p = self::factory()->post->create(); 273 274 $t1 = self::factory()->term->create( array( 275 'taxonomy' => $this->taxonomy, 276 ) ); 277 $t2 = self::factory()->term->create( array( 278 278 'taxonomy' => 'wptests_tax_3', 279 279 ) ); 280 $t3 = self:: $factory->term->create( array(280 $t3 = self::factory()->term->create( array( 281 281 'taxonomy' => 'wptests_tax_2', 282 282 ) ); … … 298 298 */ 299 299 public function test_orderby_tt_id() { 300 $p = self:: $factory->post->create();301 302 $t1 = self:: $factory->term->create( array(303 'taxonomy' => $this->taxonomy, 304 ) ); 305 $t2 = self:: $factory->term->create( array(306 'taxonomy' => $this->taxonomy, 307 ) ); 308 $t3 = self:: $factory->term->create( array(300 $p = self::factory()->post->create(); 301 302 $t1 = self::factory()->term->create( array( 303 'taxonomy' => $this->taxonomy, 304 ) ); 305 $t2 = self::factory()->term->create( array( 306 'taxonomy' => $this->taxonomy, 307 ) ); 308 $t3 = self::factory()->term->create( array( 309 309 'taxonomy' => $this->taxonomy, 310 310 ) ); … … 331 331 332 332 public function test_order_desc() { 333 $p = self:: $factory->post->create();334 335 $t1 = self:: $factory->term->create( array(333 $p = self::factory()->post->create(); 334 335 $t1 = self::factory()->term->create( array( 336 336 'taxonomy' => $this->taxonomy, 337 337 'name' => 'AAA', 338 338 ) ); 339 $t2 = self:: $factory->term->create( array(339 $t2 = self::factory()->term->create( array( 340 340 'taxonomy' => $this->taxonomy, 341 341 'name' => 'ZZZ', 342 342 ) ); 343 $t3 = self:: $factory->term->create( array(343 $t3 = self::factory()->term->create( array( 344 344 'taxonomy' => $this->taxonomy, 345 345 'name' => 'JJJ', … … 361 361 */ 362 362 public function test_parent() { 363 $t1 = self:: $factory->term->create( array(364 'taxonomy' => $this->taxonomy, 365 ) ); 366 $t2 = self:: $factory->term->create( array(367 'taxonomy' => $this->taxonomy, 368 ) ); 369 $t3 = self:: $factory->term->create( array(363 $t1 = self::factory()->term->create( array( 364 'taxonomy' => $this->taxonomy, 365 ) ); 366 $t2 = self::factory()->term->create( array( 367 'taxonomy' => $this->taxonomy, 368 ) ); 369 $t3 = self::factory()->term->create( array( 370 370 'taxonomy' => $this->taxonomy, 371 371 'parent' => $t1, 372 372 ) ); 373 $t4 = self:: $factory->term->create( array(373 $t4 = self::factory()->term->create( array( 374 374 'taxonomy' => $this->taxonomy, 375 375 'parent' => $t2, 376 376 ) ); 377 377 378 $p = self:: $factory->post->create();378 $p = self::factory()->post->create(); 379 379 380 380 wp_set_object_terms( $p, array( $t1, $t2, $t3, $t3 ), $this->taxonomy ); … … 392 392 */ 393 393 public function test_parent_0() { 394 $t1 = self:: $factory->term->create( array(395 'taxonomy' => $this->taxonomy, 396 ) ); 397 $t2 = self:: $factory->term->create( array(398 'taxonomy' => $this->taxonomy, 399 ) ); 400 $t3 = self:: $factory->term->create( array(394 $t1 = self::factory()->term->create( array( 395 'taxonomy' => $this->taxonomy, 396 ) ); 397 $t2 = self::factory()->term->create( array( 398 'taxonomy' => $this->taxonomy, 399 ) ); 400 $t3 = self::factory()->term->create( array( 401 401 'taxonomy' => $this->taxonomy, 402 402 'parent' => $t1, 403 403 ) ); 404 $t4 = self:: $factory->term->create( array(404 $t4 = self::factory()->term->create( array( 405 405 'taxonomy' => $this->taxonomy, 406 406 'parent' => $t2, 407 407 ) ); 408 408 409 $p = self:: $factory->post->create();409 $p = self::factory()->post->create(); 410 410 411 411 wp_set_object_terms( $p, array( $t1, $t2, $t3, $t3 ), $this->taxonomy ); … … 426 426 427 427 register_taxonomy( 'wptests_tax', 'post' ); 428 $terms = self:: $factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );428 $terms = self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); 429 429 add_term_meta( $terms[0], 'foo', 'bar' ); 430 430 add_term_meta( $terms[1], 'foo', 'bar' ); 431 431 add_term_meta( $terms[2], 'foo', 'bar' ); 432 432 433 $p = self:: $factory->post->create();433 $p = self::factory()->post->create(); 434 434 wp_set_object_terms( $p, $terms, 'wptests_tax' ); 435 435 … … 452 452 453 453 register_taxonomy( 'wptests_tax', 'post' ); 454 $terms = self:: $factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );454 $terms = self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); 455 455 add_term_meta( $terms[0], 'foo', 'bar' ); 456 456 add_term_meta( $terms[1], 'foo', 'bar' ); 457 457 add_term_meta( $terms[2], 'foo', 'bar' ); 458 458 459 $p = self:: $factory->post->create();459 $p = self::factory()->post->create(); 460 460 wp_set_object_terms( $p, $terms, 'wptests_tax' ); 461 461 … … 478 478 public function test_meta_query() { 479 479 register_taxonomy( 'wptests_tax', 'post' ); 480 $terms = self:: $factory->term->create_many( 5, array( 'taxonomy' => 'wptests_tax' ) );480 $terms = self::factory()->term->create_many( 5, array( 'taxonomy' => 'wptests_tax' ) ); 481 481 add_term_meta( $terms[0], 'foo', 'bar' ); 482 482 add_term_meta( $terms[1], 'foo', 'bar' ); … … 484 484 add_term_meta( $terms[3], 'foob', 'ar' ); 485 485 486 $p = self:: $factory->post->create();486 $p = self::factory()->post->create(); 487 487 wp_set_object_terms( $p, $terms, 'wptests_tax' ); 488 488 … … 504 504 public function test_should_return_wp_term_objects_for_fields_all() { 505 505 register_taxonomy( 'wptests_tax', 'post' ); 506 $p = self:: $factory->post->create();507 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );506 $p = self::factory()->post->create(); 507 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 508 508 wp_set_object_terms( $p, $t, 'wptests_tax' ); 509 509 … … 523 523 public function test_should_return_wp_term_objects_for_fields_all_with_object_id() { 524 524 register_taxonomy( 'wptests_tax', 'post' ); 525 $p = self:: $factory->post->create();526 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );525 $p = self::factory()->post->create(); 526 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 527 527 wp_set_object_terms( $p, $t, 'wptests_tax' ); 528 528 … … 544 544 545 545 register_taxonomy( 'wptests_tax', 'post' ); 546 $p = self:: $factory->post->create();547 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );546 $p = self::factory()->post->create(); 547 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 548 548 wp_set_object_terms( $p, $t, 'wptests_tax' ); 549 549 … … 562 562 public function test_object_id_should_not_be_cached_with_term_object() { 563 563 register_taxonomy( 'wptests_tax', 'post' ); 564 $p = self:: $factory->post->create();565 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );564 $p = self::factory()->post->create(); 565 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 566 566 wp_set_object_terms( $p, $t, 'wptests_tax' ); 567 567 … … 586 586 register_taxonomy( 'wptests_tax1', 'post' ); 587 587 register_taxonomy( 'wptests_tax2', 'post' ); 588 $p = self:: $factory->post->create();589 $t1 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax1' ) );590 $t2 = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax2' ) );588 $p = self::factory()->post->create(); 589 $t1 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax1' ) ); 590 $t2 = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax2' ) ); 591 591 wp_set_object_terms( $p, $t1, 'wptests_tax1' ); 592 592 wp_set_object_terms( $p, $t2, 'wptests_tax2' ); … … 612 612 public function test_object_id_should_be_set_on_objects_that_share_terms() { 613 613 register_taxonomy( 'wptests_tax', 'post' ); 614 $posts = self:: $factory->post->create_many( 2 );615 $t = self:: $factory->term->create( array( 'taxonomy' => 'wptests_tax' ) );614 $posts = self::factory()->post->create_many( 2 ); 615 $t = self::factory()->term->create( array( 'taxonomy' => 'wptests_tax' ) ); 616 616 wp_set_object_terms( $posts[0], $t, 'wptests_tax' ); 617 617 wp_set_object_terms( $posts[1], $t, 'wptests_tax' ); -
trunk/tests/phpunit/tests/term/wpInsertTerm.php
r35225 r35242 161 161 */ 162 162 public function test_wp_insert_term_duplicate_name() { 163 $term = self:: $factory->tag->create_and_get( array( 'name' => 'Bozo' ) );163 $term = self::factory()->tag->create_and_get( array( 'name' => 'Bozo' ) ); 164 164 $this->assertNotWPError( $term ); 165 165 $this->assertTrue( empty( $term->errors ) ); 166 166 167 167 // Test existing term name with unique slug 168 $term1 = self:: $factory->tag->create( array( 'name' => 'Bozo', 'slug' => 'bozo1' ) );168 $term1 = self::factory()->tag->create( array( 'name' => 'Bozo', 'slug' => 'bozo1' ) ); 169 169 $this->assertNotWPError( $term1 ); 170 170 171 171 // Test an existing term name 172 $term2 = self:: $factory->tag->create( array( 'name' => 'Bozo' ) );172 $term2 = self::factory()->tag->create( array( 'name' => 'Bozo' ) ); 173 173 $this->assertTrue( is_wp_error( $term2 ) ); 174 174 $this->assertNotEmpty( $term2->errors ); 175 175 176 176 // Test named terms ending in special characters 177 $term3 = self:: $factory->tag->create( array( 'name' => 'T$' ) );178 $term4 = self:: $factory->tag->create( array( 'name' => 'T$$' ) );179 $term5 = self:: $factory->tag->create( array( 'name' => 'T$$$' ) );180 $term6 = self:: $factory->tag->create( array( 'name' => 'T$$$$' ) );181 $term7 = self:: $factory->tag->create( array( 'name' => 'T$$$$' ) );177 $term3 = self::factory()->tag->create( array( 'name' => 'T$' ) ); 178 $term4 = self::factory()->tag->create( array( 'name' => 'T$$' ) ); 179 $term5 = self::factory()->tag->create( array( 'name' => 'T$$$' ) ); 180 $term6 = self::factory()->tag->create( array( 'name' => 'T$$$$' ) ); 181 $term7 = self::factory()->tag->create( array( 'name' => 'T$$$$' ) ); 182 182 $this->assertTrue( is_wp_error( $term7 ) ); 183 183 $this->assertNotEmpty( $term7->errors ); … … 188 188 189 189 // Test named terms with only special characters 190 $term8 = self:: $factory->tag->create( array( 'name' => '$' ) );191 $term9 = self:: $factory->tag->create( array( 'name' => '$$' ) );192 $term10 = self:: $factory->tag->create( array( 'name' => '$$$' ) );193 $term11 = self:: $factory->tag->create( array( 'name' => '$$$$' ) );194 $term12 = self:: $factory->tag->create( array( 'name' => '$$$$' ) );190 $term8 = self::factory()->tag->create( array( 'name' => '$' ) ); 191 $term9 = self::factory()->tag->create( array( 'name' => '$$' ) ); 192 $term10 = self::factory()->tag->create( array( 'name' => '$$$' ) ); 193 $term11 = self::factory()->tag->create( array( 'name' => '$$$$' ) ); 194 $term12 = self::factory()->tag->create( array( 'name' => '$$$$' ) ); 195 195 $this->assertTrue( is_wp_error( $term12 ) ); 196 196 $this->assertNotEmpty( $term12->errors ); … … 200 200 $this->assertCount( 4, array_unique( wp_list_pluck( $terms, 'slug' ) ) ); 201 201 202 $term13 = self:: $factory->tag->create( array( 'name' => 'A' ) );202 $term13 = self::factory()->tag->create( array( 'name' => 'A' ) ); 203 203 $this->assertNotWPError( $term13 ); 204 $term14 = self:: $factory->tag->create( array( 'name' => 'A' ) );204 $term14 = self::factory()->tag->create( array( 'name' => 'A' ) ); 205 205 $this->assertTrue( is_wp_error( $term14 ) ); 206 $term15 = self:: $factory->tag->create( array( 'name' => 'A+', 'slug' => 'a' ) );206 $term15 = self::factory()->tag->create( array( 'name' => 'A+', 'slug' => 'a' ) ); 207 207 $this->assertNotWPError( $term15 ); 208 $term16 = self:: $factory->tag->create( array( 'name' => 'A+' ) );208 $term16 = self::factory()->tag->create( array( 'name' => 'A+' ) ); 209 209 $this->assertTrue( is_wp_error( $term16 ) ); 210 $term17 = self:: $factory->tag->create( array( 'name' => 'A++' ) );210 $term17 = self::factory()->tag->create( array( 'name' => 'A++' ) ); 211 211 $this->assertNotWPError( $term17 ); 212 $term18 = self:: $factory->tag->create( array( 'name' => 'A-', 'slug' => 'a' ) );212 $term18 = self::factory()->tag->create( array( 'name' => 'A-', 'slug' => 'a' ) ); 213 213 $this->assertNotWPError( $term18 ); 214 $term19 = self:: $factory->tag->create( array( 'name' => 'A-' ) );214 $term19 = self::factory()->tag->create( array( 'name' => 'A-' ) ); 215 215 $this->assertTrue( is_wp_error( $term19 ) ); 216 $term20 = self:: $factory->tag->create( array( 'name' => 'A--' ) );216 $term20 = self::factory()->tag->create( array( 'name' => 'A--' ) ); 217 217 $this->assertNotWPError( $term20 ); 218 218 } … … 223 223 public function test_wp_insert_term_should_not_allow_duplicate_names_when_slug_is_a_duplicate_of_the_same_term_in_non_hierarchical_taxonomy() { 224 224 register_taxonomy( 'wptests_tax', 'post' ); 225 $t1 = self:: $factory->term->create( array(225 $t1 = self::factory()->term->create( array( 226 226 'name' => 'Foo', 227 227 'slug' => 'foo', … … 242 242 public function test_wp_insert_term_should_not_allow_duplicate_names_when_slug_is_a_duplicate_of_a_different_term_in_non_hierarchical_taxonomy() { 243 243 register_taxonomy( 'wptests_tax', 'post' ); 244 $t1 = self:: $factory->term->create( array(245 'name' => 'Foo', 246 'slug' => 'foo', 247 'taxonomy' => 'wptests_tax', 248 ) ); 249 250 $t2 = self:: $factory->term->create( array(244 $t1 = self::factory()->term->create( array( 245 'name' => 'Foo', 246 'slug' => 'foo', 247 'taxonomy' => 'wptests_tax', 248 ) ); 249 250 $t2 = self::factory()->term->create( array( 251 251 'name' => 'Bar', 252 252 'slug' => 'bar', … … 267 267 public function test_wp_insert_term_should_allow_duplicate_names_when_a_unique_slug_has_been_provided_in_non_hierarchical_taxonomy() { 268 268 register_taxonomy( 'wptests_tax', 'post' ); 269 $t1 = self:: $factory->term->create( array(269 $t1 = self::factory()->term->create( array( 270 270 'name' => 'Foo', 271 271 'slug' => 'foo', … … 289 289 public function test_wp_insert_term_should_not_allow_duplicate_names_when_the_slug_is_not_provided_in_non_hierarchical_taxonomy() { 290 290 register_taxonomy( 'wptests_tax', 'post' ); 291 $t1 = self:: $factory->term->create( array(291 $t1 = self::factory()->term->create( array( 292 292 'name' => 'Foo', 293 293 'slug' => 'foo', … … 306 306 public function test_wp_insert_term_should_not_allow_duplicate_names_when_slug_is_a_duplicate_of_the_same_term_in_hierarchical_taxonomy() { 307 307 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) ); 308 $t1 = self:: $factory->term->create( array(308 $t1 = self::factory()->term->create( array( 309 309 'name' => 'Foo', 310 310 'slug' => 'foo', … … 325 325 public function test_wp_insert_term_should_not_allow_duplicate_names_when_slug_is_a_duplicate_of_a_different_term_at_same_hierarchy_level_in_hierarchical_taxonomy() { 326 326 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) ); 327 $t1 = self:: $factory->term->create( array(328 'name' => 'Foo', 329 'slug' => 'foo', 330 'taxonomy' => 'wptests_tax', 331 ) ); 332 333 $t2 = self:: $factory->term->create( array(327 $t1 = self::factory()->term->create( array( 328 'name' => 'Foo', 329 'slug' => 'foo', 330 'taxonomy' => 'wptests_tax', 331 ) ); 332 333 $t2 = self::factory()->term->create( array( 334 334 'name' => 'Bar', 335 335 'slug' => 'bar', … … 350 350 public function test_wp_insert_term_should_allow_duplicate_names_when_slug_is_a_duplicate_of_a_term_at_different_hierarchy_level_in_hierarchical_taxonomy() { 351 351 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) ); 352 $t1 = self:: $factory->term->create( array(353 'name' => 'Foo', 354 'slug' => 'foo', 355 'taxonomy' => 'wptests_tax', 356 ) ); 357 358 $t2 = self:: $factory->term->create();359 360 $t3 = self:: $factory->term->create( array(352 $t1 = self::factory()->term->create( array( 353 'name' => 'Foo', 354 'slug' => 'foo', 355 'taxonomy' => 'wptests_tax', 356 ) ); 357 358 $t2 = self::factory()->term->create(); 359 360 $t3 = self::factory()->term->create( array( 361 361 'name' => 'Bar', 362 362 'slug' => 'bar', … … 382 382 public function test_wp_insert_term_should_allow_duplicate_names_when_a_unique_slug_has_been_provided_in_hierarchical_taxonomy() { 383 383 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) ); 384 $t1 = self:: $factory->term->create( array(384 $t1 = self::factory()->term->create( array( 385 385 'name' => 'Foo', 386 386 'slug' => 'foo', … … 404 404 public function test_wp_insert_term_should_not_allow_duplicate_names_when_the_slug_is_not_provided_in_hierarchical_taxonomy() { 405 405 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true ) ); 406 $t1 = self:: $factory->term->create( array(406 $t1 = self::factory()->term->create( array( 407 407 'name' => 'Foo', 408 408 'slug' => 'foo', … … 420 420 public function test_wp_insert_term_duplicate_slug_same_taxonomy() { 421 421 register_taxonomy( 'wptests_tax', 'post' ); 422 $t = self:: $factory->term->create( array(422 $t = self::factory()->term->create( array( 423 423 'name' => 'Foo', 424 424 'slug' => 'foo', … … 444 444 register_taxonomy( 'wptests_tax', 'post' ); 445 445 register_taxonomy( 'wptests_tax_2', 'post' ); 446 $t = self:: $factory->term->create( array(446 $t = self::factory()->term->create( array( 447 447 'name' => 'Foo', 448 448 'slug' => 'foo', … … 474 474 register_taxonomy( 'wptests_tax', 'post' ); 475 475 register_taxonomy( 'wptests_tax_2', 'post' ); 476 $t = self:: $factory->term->create( array(476 $t = self::factory()->term->create( array( 477 477 'name' => 'Foo', 478 478 'slug' => 'foo', … … 502 502 public function test_wp_insert_term_alias_of_no_term_group() { 503 503 register_taxonomy( 'wptests_tax', 'post' ); 504 $t1 = self:: $factory->term->create( array(504 $t1 = self::factory()->term->create( array( 505 505 'taxonomy' => 'wptests_tax', 506 506 ) ); … … 524 524 public function test_wp_insert_term_alias_of_existing_term_group() { 525 525 register_taxonomy( 'wptests_tax', 'post' ); 526 $t1 = self:: $factory->term->create( array(526 $t1 = self::factory()->term->create( array( 527 527 'taxonomy' => 'wptests_tax', 528 528 ) ); 529 529 $term_1 = get_term( $t1, 'wptests_tax' ); 530 530 531 $t2 = self:: $factory->term->create( array(531 $t2 = self::factory()->term->create( array( 532 532 'taxonomy' => 'wptests_tax', 533 533 'alias_of' => $term_1->slug, … … 592 592 ) ); 593 593 594 $t = self:: $factory->term->create( array(594 $t = self::factory()->term->create( array( 595 595 'taxonomy' => 'wptests_tax', 596 596 ) ); … … 624 624 register_taxonomy( 'wptests_tax', 'post' ); 625 625 626 $t1 = self:: $factory->term->create( array(626 $t1 = self::factory()->term->create( array( 627 627 'name' => 'Foó', 628 628 'taxonomy' => 'wptests_tax', 629 629 ) ); 630 $t2 = self:: $factory->term->create( array(630 $t2 = self::factory()->term->create( array( 631 631 'name' => 'Foo', 632 632 'taxonomy' => 'wptests_tax', -
trunk/tests/phpunit/tests/term/wpUniqueTermSlug.php
r35225 r35242 12 12 13 13 public function test_unique_slug_should_be_unchanged() { 14 $term = self:: $factory->term->create_and_get( array(14 $term = self::factory()->term->create_and_get( array( 15 15 'taxonomy' => 'wptests_tax1', 16 16 'name' => 'foo', … … 23 23 24 24 public function test_nonunique_slug_in_different_taxonomy_should_be_unchanged() { 25 $term1 = self:: $factory->term->create( array(25 $term1 = self::factory()->term->create( array( 26 26 'taxonomy' => 'wptests_tax2', 27 27 'name' => 'bar', … … 29 29 ) ); 30 30 31 $term2 = self:: $factory->term->create( array(31 $term2 = self::factory()->term->create( array( 32 32 'taxonomy' => 'wptests_tax1', 33 33 'name' => 'foo', … … 41 41 42 42 public function test_nonunique_slug_in_same_nonhierarchical_taxonomy_should_be_changed() { 43 $term1 = self:: $factory->term->create( array(43 $term1 = self::factory()->term->create( array( 44 44 'taxonomy' => 'wptests_tax1', 45 45 'name' => 'bar', … … 47 47 ) ); 48 48 49 $term2 = self:: $factory->term->create( array(49 $term2 = self::factory()->term->create( array( 50 50 'taxonomy' => 'wptests_tax1', 51 51 'name' => 'foo', … … 59 59 60 60 public function test_nonunique_slug_in_same_hierarchical_taxonomy_with_same_parent_should_be_suffixed_with_parent_slug() { 61 $parent = self:: $factory->term->create( array(61 $parent = self::factory()->term->create( array( 62 62 'taxonomy' => 'wptests_tax2', 63 63 'slug' => 'parent-term', 64 64 ) ); 65 65 66 $term1 = self:: $factory->term->create( array(66 $term1 = self::factory()->term->create( array( 67 67 'taxonomy' => 'wptests_tax2', 68 68 'name' => 'bar', … … 71 71 ) ); 72 72 73 $term2 = self:: $factory->term->create( array(73 $term2 = self::factory()->term->create( array( 74 74 'taxonomy' => 'wptests_tax2', 75 75 'name' => 'foo', … … 84 84 85 85 public function test_nonunique_slug_in_same_hierarchical_taxonomy_at_different_level_of_hierarchy_should_be_suffixed_with_number() { 86 $parent = self:: $factory->term->create( array(86 $parent = self::factory()->term->create( array( 87 87 'taxonomy' => 'wptests_tax2', 88 88 'slug' => 'parent-term', 89 89 ) ); 90 90 91 $term1 = self:: $factory->term->create( array(91 $term1 = self::factory()->term->create( array( 92 92 'taxonomy' => 'wptests_tax2', 93 93 'name' => 'bar', … … 96 96 ) ); 97 97 98 $term2 = self:: $factory->term->create( array(98 $term2 = self::factory()->term->create( array( 99 99 'taxonomy' => 'wptests_tax2', 100 100 'name' => 'foo', -
trunk/tests/phpunit/tests/term/wpUpdateTerm.php
r35225 r35242 21 21 public function test_wp_update_term_unslash_name() { 22 22 register_taxonomy( 'wptests_tax', 'post' ); 23 $t = self:: $factory->term->create( array(23 $t = self::factory()->term->create( array( 24 24 'taxonomy' => 'wptests_tax', 25 25 ) ); … … 37 37 public function test_wp_update_term_unslash_description() { 38 38 register_taxonomy( 'wptests_tax', 'post' ); 39 $t = self:: $factory->term->create( array(39 $t = self::factory()->term->create( array( 40 40 'taxonomy' => 'wptests_tax', 41 41 ) ); … … 53 53 public function test_wp_update_term_name_empty_string() { 54 54 register_taxonomy( 'wptests_tax', 'post' ); 55 $t = self:: $factory->term->create( array(55 $t = self::factory()->term->create( array( 56 56 'taxonomy' => 'wptests_tax', 57 57 ) ); … … 77 77 $this->assertNull( term_exists( $fake_term_id, 'wptests_tax' ) ); 78 78 79 $t = self:: $factory->term->create( array(79 $t = self::factory()->term->create( array( 80 80 'taxonomy' => 'wptests_tax', 81 81 ) ); … … 95 95 public function test_wp_update_term_slug_empty_string_while_not_updating_name() { 96 96 register_taxonomy( 'wptests_tax', 'post' ); 97 $t = self:: $factory->term->create( array(97 $t = self::factory()->term->create( array( 98 98 'taxonomy' => 'wptests_tax', 99 99 'name' => 'Foo Bar', … … 111 111 public function test_wp_update_term_slug_empty_string_while_updating_name() { 112 112 register_taxonomy( 'wptests_tax', 'post' ); 113 $t = self:: $factory->term->create( array(113 $t = self::factory()->term->create( array( 114 114 'taxonomy' => 'wptests_tax', 115 115 ) ); … … 127 127 public function test_wp_update_term_slug_set_slug() { 128 128 register_taxonomy( 'wptests_tax', 'post' ); 129 $t = self:: $factory->term->create( array(129 $t = self::factory()->term->create( array( 130 130 'taxonomy' => 'wptests_tax', 131 131 ) ); … … 146 146 register_taxonomy( 'wptests_tax', 'post' ); 147 147 148 $t1 = self:: $factory->term->create( array(148 $t1 = self::factory()->term->create( array( 149 149 'name' => 'Foo', 150 150 'slug' => 'foo', … … 152 152 ) ); 153 153 154 $t2 = self:: $factory->term->create( array(154 $t2 = self::factory()->term->create( array( 155 155 'name' => 'Bar', 156 156 'slug' => 'bar', … … 173 173 register_taxonomy( 'wptests_tax_2', 'post' ); 174 174 175 $t1 = self:: $factory->term->create( array(175 $t1 = self::factory()->term->create( array( 176 176 'name' => 'Foo', 177 177 'slug' => 'foo', … … 179 179 ) ); 180 180 181 $t2 = self:: $factory->term->create( array(181 $t2 = self::factory()->term->create( array( 182 182 'name' => 'Foo', 183 183 'slug' => 'bar', … … 203 203 register_taxonomy( 'wptests_tax_2', 'post' ); 204 204 205 $t1 = self:: $factory->term->create( array(205 $t1 = self::factory()->term->create( array( 206 206 'name' => 'Foo', 207 207 'slug' => 'foo', … … 209 209 ) ); 210 210 211 $t2 = self:: $factory->term->create( array(211 $t2 = self::factory()->term->create( array( 212 212 'name' => 'Bar', 213 213 'slug' => 'bar', … … 233 233 ) ); 234 234 235 $t1 = self:: $factory->term->create( array(235 $t1 = self::factory()->term->create( array( 236 236 'name' => 'Foo', 237 237 'slug' => 'foo', … … 239 239 ) ); 240 240 241 $t2 = self:: $factory->term->create( array(241 $t2 = self::factory()->term->create( array( 242 242 'name' => 'Bar', 243 243 'slug' => 'bar', … … 246 246 ) ); 247 247 248 $t3 = self:: $factory->term->create( array(248 $t3 = self::factory()->term->create( array( 249 249 'name' => 'Bar Child', 250 250 'slug' => 'bar-child', … … 283 283 ); 284 284 285 $posts = self:: $factory->post->create_many( 2 );285 $posts = self::factory()->post->create_many( 2 ); 286 286 wp_set_object_terms( $posts[0], array( 'Foo' ), 'wptests_tax' ); 287 287 wp_set_object_terms( $posts[1], array( 'Foo' ), 'wptests_tax_2' ); … … 303 303 public function test_wp_update_term_alias_of_no_term_group() { 304 304 register_taxonomy( 'wptests_tax', 'post' ); 305 $t1 = self:: $factory->term->create( array(305 $t1 = self::factory()->term->create( array( 306 306 'taxonomy' => 'wptests_tax', 307 307 ) ); … … 324 324 public function test_wp_update_term_alias_of_existing_term_group() { 325 325 register_taxonomy( 'wptests_tax', 'post' ); 326 $t1 = self:: $factory->term->create( array(326 $t1 = self::factory()->term->create( array( 327 327 'taxonomy' => 'wptests_tax', 328 328 ) ); 329 329 $term_1 = get_term( $t1, 'wptests_tax' ); 330 330 331 $t2 = self:: $factory->term->create( array(331 $t2 = self::factory()->term->create( array( 332 332 'taxonomy' => 'wptests_tax', 333 333 'alias_of' => $term_1->slug, … … 360 360 public function test_wp_update_term_slug_same_as_old_slug() { 361 361 register_taxonomy( 'wptests_tax', 'post' ); 362 $t = self:: $factory->term->create( array(362 $t = self::factory()->term->create( array( 363 363 'taxonomy' => 'wptests_tax', 364 364 'slug' => 'foo', … … 378 378 public function test_wp_update_term_duplicate_slug_generated_due_to_empty_slug_param() { 379 379 register_taxonomy( 'wptests_tax', 'post' ); 380 $t1 = self:: $factory->term->create( array(380 $t1 = self::factory()->term->create( array( 381 381 'taxonomy' => 'wptests_tax', 382 382 'slug' => 'foo-bar', 383 383 ) ); 384 $t2 = self:: $factory->term->create( array(384 $t2 = self::factory()->term->create( array( 385 385 'taxonomy' => 'wptests_tax', 386 386 'name' => 'not foo bar', … … 403 403 'hierarchical' => true, 404 404 ) ); 405 $p = self:: $factory->term->create( array(406 'taxonomy' => 'wptests_tax', 407 ) ); 408 $t1 = self:: $factory->term->create( array(405 $p = self::factory()->term->create( array( 406 'taxonomy' => 'wptests_tax', 407 ) ); 408 $t1 = self::factory()->term->create( array( 409 409 'taxonomy' => 'wptests_tax', 410 410 'slug' => 'foo-bar', 411 411 ) ); 412 $t2 = self:: $factory->term->create( array(412 $t2 = self::factory()->term->create( array( 413 413 'taxonomy' => 'wptests_tax', 414 414 ) ); … … 429 429 public function test_wp_update_term_duplicate_slug_failure() { 430 430 register_taxonomy( 'wptests_tax', 'post' ); 431 $t1 = self:: $factory->term->create( array(431 $t1 = self::factory()->term->create( array( 432 432 'taxonomy' => 'wptests_tax', 433 433 'slug' => 'foo-bar', 434 434 ) ); 435 $t2 = self:: $factory->term->create( array(435 $t2 = self::factory()->term->create( array( 436 436 'taxonomy' => 'wptests_tax', 437 437 'slug' => 'my-old-slug', … … 452 452 public function test_wp_update_term_should_return_term_id_and_term_taxonomy_id() { 453 453 register_taxonomy( 'wptests_tax', 'post' ); 454 $t = self:: $factory->term->create( array(454 $t = self::factory()->term->create( array( 455 455 'taxonomy' => 'wptests_tax', 456 456 ) ); … … 478 478 public function test_wp_update_term_should_return_int_values_for_term_id_and_term_taxonomy_id() { 479 479 register_taxonomy( 'wptests_tax', 'post' ); 480 $t = self:: $factory->term->create( array(480 $t = self::factory()->term->create( array( 481 481 'taxonomy' => 'wptests_tax', 482 482 ) ); … … 492 492 register_taxonomy( 'wptests_tax_for_post', 'post' ); 493 493 register_taxonomy( 'wptests_tax_for_page', 'page' ); 494 $post = self:: $factory->post->create();495 $page = self:: $factory->post->create( array(494 $post = self::factory()->post->create(); 495 $page = self::factory()->post->create( array( 496 496 'post_type' => 'page', 497 497 ) ); 498 498 499 $t_for_post = self:: $factory->term->create( array(499 $t_for_post = self::factory()->term->create( array( 500 500 'taxonomy' => 'wptests_tax_for_post', 501 501 ) ); 502 $t_for_page = self:: $factory->term->create( array(502 $t_for_page = self::factory()->term->create( array( 503 503 'taxonomy' => 'wptests_tax_for_page', 504 504 ) ); … … 528 528 ) ); 529 529 530 $t1 = self:: $factory->term->create( array(531 'taxonomy' => 'wptests_tax', 532 ) ); 533 $t2 = self:: $factory->term->create( array(530 $t1 = self::factory()->term->create( array( 531 'taxonomy' => 'wptests_tax', 532 ) ); 533 $t2 = self::factory()->term->create( array( 534 534 'taxonomy' => 'wptests_tax', 535 535 ) ); … … 568 568 ) ); 569 569 570 $t1 = self:: $factory->term->create( array(570 $t1 = self::factory()->term->create( array( 571 571 'taxonomy' => 'wptests_tax', 572 572 'slug' => 'parent-term', 573 573 ) ); 574 574 575 $t2 = self:: $factory->term->create( array(575 $t2 = self::factory()->term->create( array( 576 576 'taxonomy' => 'wptests_tax', 577 577 'slug' => 'foo', … … 600 600 ) ); 601 601 602 $t1 = self:: $factory->term->create( array(602 $t1 = self::factory()->term->create( array( 603 603 'taxonomy' => 'wptests_tax', 604 604 'slug' => 'parent-term', … … 606 606 607 607 // Same slug but in a different tax. 608 $t2 = self:: $factory->term->create( array(608 $t2 = self::factory()->term->create( array( 609 609 'taxonomy' => 'wptests_tax_2', 610 610 'slug' => 'foo', 611 611 ) ); 612 612 613 $t3 = self:: $factory->term->create( array(613 $t3 = self::factory()->term->create( array( 614 614 'taxonomy' => 'wptests_tax', 615 615 'slug' => 'foo', … … 631 631 */ 632 632 public function test_wp_update_term_with_null_get_term() { 633 $t = self:: $factory->term->create( array( 'taxonomy' => 'category' ) );633 $t = self::factory()->term->create( array( 'taxonomy' => 'category' ) ); 634 634 $found = wp_update_term( $t, 'post_tag', array( 'slug' => 'foo' ) ); 635 635 -
trunk/tests/phpunit/tests/url.php
r35225 r35242 273 273 public function test_get_adjacent_post() { 274 274 $now = time(); 275 $post_id = self:: $factory->post->create( array( 'post_date' => date( 'Y-m-d H:i:s', $now - 1 ) ) );276 $post_id2 = self:: $factory->post->create( array( 'post_date' => date( 'Y-m-d H:i:s', $now ) ) );275 $post_id = self::factory()->post->create( array( 'post_date' => date( 'Y-m-d H:i:s', $now - 1 ) ) ); 276 $post_id2 = self::factory()->post->create( array( 'post_date' => date( 'Y-m-d H:i:s', $now ) ) ); 277 277 278 278 if ( ! isset( $GLOBALS['post'] ) ) … … 306 306 */ 307 307 public function test_get_adjacent_post_should_return_private_posts_belonging_to_the_current_user() { 308 $u = self:: $factory->user->create( array( 'role' => 'author' ) );308 $u = self::factory()->user->create( array( 'role' => 'author' ) ); 309 309 $old_uid = get_current_user_id(); 310 310 wp_set_current_user( $u ); 311 311 312 312 $now = time(); 313 $p1 = self:: $factory->post->create( array( 'post_author' => $u, 'post_status' => 'private', 'post_date' => date( 'Y-m-d H:i:s', $now - 1 ) ) );314 $p2 = self:: $factory->post->create( array( 'post_author' => $u, 'post_date' => date( 'Y-m-d H:i:s', $now ) ) );313 $p1 = self::factory()->post->create( array( 'post_author' => $u, 'post_status' => 'private', 'post_date' => date( 'Y-m-d H:i:s', $now - 1 ) ) ); 314 $p2 = self::factory()->post->create( array( 'post_author' => $u, 'post_date' => date( 'Y-m-d H:i:s', $now ) ) ); 315 315 316 316 if ( ! isset( $GLOBALS['post'] ) ) { … … 332 332 */ 333 333 public function test_get_adjacent_post_should_return_private_posts_belonging_to_other_users_if_the_current_user_can_read_private_posts() { 334 $u1 = self:: $factory->user->create( array( 'role' => 'author' ) );335 $u2 = self:: $factory->user->create( array( 'role' => 'administrator' ) );334 $u1 = self::factory()->user->create( array( 'role' => 'author' ) ); 335 $u2 = self::factory()->user->create( array( 'role' => 'administrator' ) ); 336 336 $old_uid = get_current_user_id(); 337 337 wp_set_current_user( $u2 ); 338 338 339 339 $now = time(); 340 $p1 = self:: $factory->post->create( array( 'post_author' => $u1, 'post_status' => 'private', 'post_date' => date( 'Y-m-d H:i:s', $now - 1 ) ) );341 $p2 = self:: $factory->post->create( array( 'post_author' => $u1, 'post_date' => date( 'Y-m-d H:i:s', $now ) ) );340 $p1 = self::factory()->post->create( array( 'post_author' => $u1, 'post_status' => 'private', 'post_date' => date( 'Y-m-d H:i:s', $now - 1 ) ) ); 341 $p2 = self::factory()->post->create( array( 'post_author' => $u1, 'post_date' => date( 'Y-m-d H:i:s', $now ) ) ); 342 342 343 343 if ( ! isset( $GLOBALS['post'] ) ) { … … 359 359 */ 360 360 public function test_get_adjacent_post_should_not_return_private_posts_belonging_to_other_users_if_the_current_user_cannot_read_private_posts() { 361 $u1 = self:: $factory->user->create( array( 'role' => 'author' ) );362 $u2 = self:: $factory->user->create( array( 'role' => 'author' ) );361 $u1 = self::factory()->user->create( array( 'role' => 'author' ) ); 362 $u2 = self::factory()->user->create( array( 'role' => 'author' ) ); 363 363 $old_uid = get_current_user_id(); 364 364 wp_set_current_user( $u2 ); 365 365 366 366 $now = time(); 367 $p1 = self:: $factory->post->create( array( 'post_author' => $u1, 'post_date' => date( 'Y-m-d H:i:s', $now - 2 ) ) );368 $p2 = self:: $factory->post->create( array( 'post_author' => $u1, 'post_status' => 'private', 'post_date' => date( 'Y-m-d H:i:s', $now - 1 ) ) );369 $p3 = self:: $factory->post->create( array( 'post_author' => $u1, 'post_date' => date( 'Y-m-d H:i:s', $now ) ) );367 $p1 = self::factory()->post->create( array( 'post_author' => $u1, 'post_date' => date( 'Y-m-d H:i:s', $now - 2 ) ) ); 368 $p2 = self::factory()->post->create( array( 'post_author' => $u1, 'post_status' => 'private', 'post_date' => date( 'Y-m-d H:i:s', $now - 1 ) ) ); 369 $p3 = self::factory()->post->create( array( 'post_author' => $u1, 'post_date' => date( 'Y-m-d H:i:s', $now ) ) ); 370 370 371 371 if ( ! isset( $GLOBALS['post'] ) ) { -
trunk/tests/phpunit/tests/user.php
r35225 r35242 44 44 $nusers = array(); 45 45 foreach ( array('administrator', 'editor', 'author', 'contributor', 'subscriber' ) as $role ) { 46 $id = self:: $factory->user->create( array( 'role' => $role ) );46 $id = self::factory()->user->create( array( 'role' => $role ) ); 47 47 $nusers[ $id ] = $id; 48 48 } … … 245 245 246 246 foreach ( $roles as $role => $level ) { 247 $user_id = self:: $factory->user->create( array( 'role' => $role ) );247 $user_id = self::factory()->user->create( array( 'role' => $role ) ); 248 248 $user = new WP_User( $user_id ); 249 249 … … 293 293 294 294 function test_get() { 295 $user_id = self:: $factory->user->create( array(295 $user_id = self::factory()->user->create( array( 296 296 'role' => 'author', 297 297 'user_login' => 'test_wp_user_get', … … 311 311 312 312 function test_has_prop() { 313 $user_id = self:: $factory->user->create( array(313 $user_id = self::factory()->user->create( array( 314 314 'role' => 'author', 315 315 'user_login' => 'test_wp_user_has_prop', … … 328 328 329 329 function test_update_user() { 330 $user_id = self:: $factory->user->create( array(330 $user_id = self::factory()->user->create( array( 331 331 'role' => 'author', 332 332 'user_login' => 'test_wp_update_user', … … 384 384 global $userdata, $wpdb; 385 385 386 $user_id = self:: $factory->user->create( array( 'role' => 'subscriber' ) );386 $user_id = self::factory()->user->create( array( 'role' => 'subscriber' ) ); 387 387 wp_set_current_user( $user_id ); 388 388 … … 498 498 */ 499 499 function test_count_many_users_posts() { 500 $user_id_a = self:: $factory->user->create( array( 'role' => 'author' ) );501 $user_id_b = self:: $factory->user->create( array( 'role' => 'author' ) );502 $post_id_a = self:: $factory->post->create( array( 'post_author' => $user_id_a ) );503 $post_id_b = self:: $factory->post->create( array( 'post_author' => $user_id_b ) );504 $post_id_c = self:: $factory->post->create( array( 'post_author' => $user_id_b, 'post_status' => 'private' ) );500 $user_id_a = self::factory()->user->create( array( 'role' => 'author' ) ); 501 $user_id_b = self::factory()->user->create( array( 'role' => 'author' ) ); 502 $post_id_a = self::factory()->post->create( array( 'post_author' => $user_id_a ) ); 503 $post_id_b = self::factory()->post->create( array( 'post_author' => $user_id_b ) ); 504 $post_id_c = self::factory()->post->create( array( 'post_author' => $user_id_b, 'post_status' => 'private' ) ); 505 505 506 506 wp_set_current_user( $user_id_a ); … … 772 772 */ 773 773 public function test_wp_insert_user_should_not_truncate_to_a_duplicate_user_nicename() { 774 $u1 = self:: $factory->user->create( array(774 $u1 = self::factory()->user->create( array( 775 775 'user_nicename' => str_repeat( 'a', 50 ), 776 776 ) ); … … 793 793 */ 794 794 public function test_wp_insert_user_should_not_truncate_to_a_duplicate_user_nicename_when_suffix_has_more_than_one_character() { 795 $users = self:: $factory->user->create_many( 4, array(795 $users = self::factory()->user->create_many( 4, array( 796 796 'user_nicename' => str_repeat( 'a', 50 ), 797 797 ) ); … … 877 877 function test_email_case() { 878 878 // Create a test user with a lower-case email address. 879 $user_id = self:: $factory->user->create( array(879 $user_id = self::factory()->user->create( array( 880 880 'user_email' => 'test@test.com', 881 881 ) ); … … 896 896 function test_email_change() { 897 897 // Create a test user. 898 $user_id = self:: $factory->user->create( array(898 $user_id = self::factory()->user->create( array( 899 899 'user_email' => 'test@test.com', 900 900 ) ); … … 984 984 */ 985 985 function test_wp_new_user_notification_old_signature_throws_deprecated_warning() { 986 $user = self:: $factory->user->create( array(986 $user = self::factory()->user->create( array( 987 987 'role' => 'author', 988 988 'user_login' => 'test_wp_new_user_notification', -
trunk/tests/phpunit/tests/user/author.php
r35225 r35242 16 16 parent::setUp(); 17 17 18 $this->author_id = self:: $factory->user->create( array(18 $this->author_id = self::factory()->user->create( array( 19 19 'role' => 'author', 20 20 'user_login' => 'test_author', … … 32 32 33 33 // insert a post and make sure the ID is ok 34 $this->post_id = self:: $factory->post->create( $post );34 $this->post_id = self::factory()->post->create( $post ); 35 35 36 36 setup_postdata( get_post( $this->post_id ) ); … … 91 91 register_post_type( 'wptests_pt' ); 92 92 93 $cpt_ids = self:: $factory->post->create_many( 2, array(93 $cpt_ids = self::factory()->post->create_many( 2, array( 94 94 'post_author' => $this->author_id, 95 95 'post_type' => 'wptests_pt', … … 106 106 */ 107 107 public function test_get_the_author_posts_link_no_permalinks() { 108 $author = self:: $factory->user->create_and_get( array(108 $author = self::factory()->user->create_and_get( array( 109 109 'display_name' => 'Foo', 110 110 'user_nicename' => 'bar' … … 130 130 $this->set_permalink_structure( '/%postname%/' ); 131 131 132 $author = self:: $factory->user->create_and_get( array(132 $author = self::factory()->user->create_and_get( array( 133 133 'display_name' => 'Foo', 134 134 'user_nicename' => 'bar' -
trunk/tests/phpunit/tests/user/capabilities.php
r35225 r35242 223 223 function test_all_roles_and_caps() { 224 224 $users = array( 225 'administrator' => self:: $factory->user->create_and_get( array( 'role' => 'administrator' ) ),226 'editor' => self:: $factory->user->create_and_get( array( 'role' => 'editor' ) ),227 'author' => self:: $factory->user->create_and_get( array( 'role' => 'author' ) ),228 'contributor' => self:: $factory->user->create_and_get( array( 'role' => 'contributor' ) ),229 'subscriber' => self:: $factory->user->create_and_get( array( 'role' => 'subscriber' ) ),225 'administrator' => self::factory()->user->create_and_get( array( 'role' => 'administrator' ) ), 226 'editor' => self::factory()->user->create_and_get( array( 'role' => 'editor' ) ), 227 'author' => self::factory()->user->create_and_get( array( 'role' => 'author' ) ), 228 'contributor' => self::factory()->user->create_and_get( array( 'role' => 'contributor' ) ), 229 'subscriber' => self::factory()->user->create_and_get( array( 'role' => 'subscriber' ) ), 230 230 ); 231 231 $caps = $this->getCapsAndRoles(); … … 259 259 function test_link_manager_caps() { 260 260 $users = array( 261 'administrator' => self:: $factory->user->create_and_get( array( 'role' => 'administrator' ) ),262 'editor' => self:: $factory->user->create_and_get( array( 'role' => 'editor' ) ),263 'author' => self:: $factory->user->create_and_get( array( 'role' => 'author' ) ),264 'contributor' => self:: $factory->user->create_and_get( array( 'role' => 'contributor' ) ),265 'subscriber' => self:: $factory->user->create_and_get( array( 'role' => 'subscriber' ) ),261 'administrator' => self::factory()->user->create_and_get( array( 'role' => 'administrator' ) ), 262 'editor' => self::factory()->user->create_and_get( array( 'role' => 'editor' ) ), 263 'author' => self::factory()->user->create_and_get( array( 'role' => 'author' ) ), 264 'contributor' => self::factory()->user->create_and_get( array( 'role' => 'contributor' ) ), 265 'subscriber' => self::factory()->user->create_and_get( array( 'role' => 'subscriber' ) ), 266 266 ); 267 267 $caps = array( … … 306 306 $caps = $this->getCapsAndRoles(); 307 307 308 $user = self:: $factory->user->create_and_get( array( 'role' => 'administrator' ) );308 $user = self::factory()->user->create_and_get( array( 'role' => 'administrator' ) ); 309 309 grant_super_admin( $user->ID ); 310 310 … … 322 322 // a role that doesn't exist 323 323 function test_bogus_role() { 324 $user = self:: $factory->user->create_and_get( array( 'role' => 'invalid_role' ) );324 $user = self::factory()->user->create_and_get( array( 'role' => 'invalid_role' ) ); 325 325 326 326 // make sure the user is valid … … 340 340 // a user with multiple roles 341 341 function test_user_subscriber_contributor() { 342 $user = self:: $factory->user->create_and_get( array( 'role' => 'subscriber' ) );342 $user = self::factory()->user->create_and_get( array( 'role' => 'subscriber' ) ); 343 343 344 344 // make sure the user is valid … … 373 373 $this->assertTrue( $wp_roles->is_role( $role_name ) ); 374 374 375 $user = self:: $factory->user->create_and_get( array( 'role' => $role_name ) );375 $user = self::factory()->user->create_and_get( array( 'role' => $role_name ) ); 376 376 377 377 // make sure the user is valid … … 410 410 $this->assertTrue( $wp_roles->is_role( $role_name ) ); 411 411 412 $user = self:: $factory->user->create_and_get( array( 'role' => $role_name ) );412 $user = self::factory()->user->create_and_get( array( 'role' => $role_name ) ); 413 413 414 414 // make sure the user is valid … … 447 447 448 448 // assign a user to that role 449 $id = self:: $factory->user->create( array( 'role' => $role_name ) );449 $id = self::factory()->user->create( array( 'role' => $role_name ) ); 450 450 451 451 // now add a cap to the role … … 485 485 486 486 // assign a user to that role 487 $id = self:: $factory->user->create( array( 'role' => $role_name ) );487 $id = self::factory()->user->create( array( 'role' => $role_name ) ); 488 488 489 489 // now remove a cap from the role … … 514 514 515 515 // there are two contributors 516 $id_1 = self:: $factory->user->create( array( 'role' => 'contributor' ) );517 $id_2 = self:: $factory->user->create( array( 'role' => 'contributor' ) );516 $id_1 = self::factory()->user->create( array( 'role' => 'contributor' ) ); 517 $id_2 = self::factory()->user->create( array( 'role' => 'contributor' ) ); 518 518 519 519 // user 1 has an extra capability … … 551 551 552 552 // there are two contributors 553 $id_1 = self:: $factory->user->create( array( 'role' => 'contributor' ) );554 $id_2 = self:: $factory->user->create( array( 'role' => 'contributor' ) );553 $id_1 = self::factory()->user->create( array( 'role' => 'contributor' ) ); 554 $id_2 = self::factory()->user->create( array( 'role' => 'contributor' ) ); 555 555 556 556 // user 1 has an extra capability … … 582 582 583 583 // user starts as an author 584 $id = self:: $factory->user->create( array( 'role' => 'author' ) );584 $id = self::factory()->user->create( array( 'role' => 'author' ) ); 585 585 $user = new WP_User($id); 586 586 $this->assertTrue($user->exists(), "Problem getting user $id"); … … 605 605 function test_user_remove_all_caps() { 606 606 // user starts as an author 607 $id = self:: $factory->user->create( array( 'role' => 'author' ) );607 $id = self::factory()->user->create( array( 'role' => 'author' ) ); 608 608 $user = new WP_User($id); 609 609 $this->assertTrue($user->exists(), "Problem getting user $id"); … … 647 647 648 648 // Make our author 649 $author = new WP_User( self:: $factory->user->create( array( 'role' => 'author' ) ) );649 $author = new WP_User( self::factory()->user->create( array( 'role' => 'author' ) ) ); 650 650 651 651 // make a post 652 $post = self:: $factory->post->create( array( 'post_author' => $author->ID, 'post_type' => 'post' ) );652 $post = self::factory()->post->create( array( 'post_author' => $author->ID, 'post_type' => 'post' ) ); 653 653 654 654 // the author of the post … … 656 656 657 657 // add some other users 658 $admin = new WP_User( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );659 $author_2 = new WP_User( self:: $factory->user->create( array( 'role' => 'author' ) ) );660 $editor = new WP_User( self:: $factory->user->create( array( 'role' => 'editor' ) ) );661 $contributor = new WP_User( self:: $factory->user->create( array( 'role' => 'contributor' ) ) );658 $admin = new WP_User( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 659 $author_2 = new WP_User( self::factory()->user->create( array( 'role' => 'author' ) ) ); 660 $editor = new WP_User( self::factory()->user->create( array( 'role' => 'editor' ) ) ); 661 $contributor = new WP_User( self::factory()->user->create( array( 'role' => 'contributor' ) ) ); 662 662 663 663 // administrators, editors and the post owner can edit it … … 733 733 function test_authorless_post( $status ) { 734 734 // Make a post without an author 735 $post = self:: $factory->post->create( array( 'post_author' => 0, 'post_type' => 'post', 'post_status' => $status ) );735 $post = self::factory()->post->create( array( 'post_author' => 0, 'post_type' => 'post', 'post_status' => $status ) ); 736 736 737 737 // Add an editor and contributor 738 $editor = self:: $factory->user->create_and_get( array( 'role' => 'editor' ) );739 $contributor = self:: $factory->user->create_and_get( array( 'role' => 'contributor' ) );738 $editor = self::factory()->user->create_and_get( array( 'role' => 'editor' ) ); 739 $contributor = self::factory()->user->create_and_get( array( 'role' => 'contributor' ) ); 740 740 741 741 // editor can edit, view, and trash … … 754 754 */ 755 755 function test_create_posts_caps() { 756 $author = new WP_User( self:: $factory->user->create( array( 'role' => 'author' ) ) );757 $admin = new WP_User( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );758 $author_2 = new WP_User( self:: $factory->user->create( array( 'role' => 'author' ) ) );759 $editor = new WP_User( self:: $factory->user->create( array( 'role' => 'editor' ) ) );760 $contributor = new WP_User( self:: $factory->user->create( array( 'role' => 'contributor' ) ) );756 $author = new WP_User( self::factory()->user->create( array( 'role' => 'author' ) ) ); 757 $admin = new WP_User( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 758 $author_2 = new WP_User( self::factory()->user->create( array( 'role' => 'author' ) ) ); 759 $editor = new WP_User( self::factory()->user->create( array( 'role' => 'editor' ) ) ); 760 $contributor = new WP_User( self::factory()->user->create( array( 'role' => 'contributor' ) ) ); 761 761 762 762 // create_posts isn't a real cap. … … 819 819 820 820 // Make our author 821 $author = new WP_User( self:: $factory->user->create( array( 'role' => 'author' ) ) );821 $author = new WP_User( self::factory()->user->create( array( 'role' => 'author' ) ) ); 822 822 823 823 // make a page 824 $page = self:: $factory->post->create( array( 'post_author' => $author->ID, 'post_type' => 'page' ) );824 $page = self::factory()->post->create( array( 'post_author' => $author->ID, 'post_type' => 'page' ) ); 825 825 826 826 // the author of the page … … 828 828 829 829 // add some other users 830 $admin = new WP_User( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );831 $author_2 = new WP_User( self:: $factory->user->create( array( 'role' => 'author' ) ) );832 $editor = new WP_User( self:: $factory->user->create( array( 'role' => 'editor' ) ) );833 $contributor = new WP_User( self:: $factory->user->create( array( 'role' => 'contributor' ) ) );830 $admin = new WP_User( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 831 $author_2 = new WP_User( self::factory()->user->create( array( 'role' => 'author' ) ) ); 832 $editor = new WP_User( self::factory()->user->create( array( 'role' => 'editor' ) ) ); 833 $contributor = new WP_User( self::factory()->user->create( array( 'role' => 'contributor' ) ) ); 834 834 835 835 // administrators, editors and the post owner can edit it … … 854 854 */ 855 855 function test_negative_caps() { 856 $author = new WP_User( self:: $factory->user->create( array( 'role' => 'author' ) ) );856 $author = new WP_User( self::factory()->user->create( array( 'role' => 'author' ) ) ); 857 857 $author->add_cap( 'foo', false ); 858 858 $this->assertTrue ( isset( $author->caps['foo'] ) ); … … 865 865 */ 866 866 function test_set_role_same_role() { 867 $user = new WP_User( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );867 $user = new WP_User( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 868 868 $caps = $user->caps; 869 869 $this->assertNotEmpty( $user->caps ); … … 876 876 global $wpdb; 877 877 878 $user = new WP_User( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );878 $user = new WP_User( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 879 879 $old_uid = get_current_user_id(); 880 880 wp_set_current_user( $user->ID ); … … 891 891 $wpdb->suppress_errors( $suppress ); 892 892 893 $blog_id = self:: $factory->blog->create( array( 'user_id' => $user->ID ) );893 $blog_id = self::factory()->blog->create( array( 'user_id' => $user->ID ) ); 894 894 $this->assertTrue( current_user_can_for_blog( $blog_id, 'edit_posts' ) ); 895 895 $this->assertFalse( current_user_can_for_blog( $blog_id, 'foo_the_bar' ) ); … … 905 905 906 906 $orig_blog_id = get_current_blog_id(); 907 $blog_id = self:: $factory->blog->create();907 $blog_id = self::factory()->blog->create(); 908 908 909 909 $this->_nullify_current_user(); … … 933 933 */ 934 934 function test_current_user_edit_caps() { 935 $user = new WP_User( self:: $factory->user->create( array( 'role' => 'contributor' ) ) );935 $user = new WP_User( self::factory()->user->create( array( 'role' => 'contributor' ) ) ); 936 936 wp_set_current_user( $user->ID ); 937 937 … … 946 946 947 947 function test_subscriber_cant_edit_posts() { 948 $user = new WP_User( self:: $factory->user->create( array( 'role' => 'subscriber' ) ) );948 $user = new WP_User( self::factory()->user->create( array( 'role' => 'subscriber' ) ) ); 949 949 wp_set_current_user( $user->ID ); 950 950 951 $post = self:: $factory->post->create( array( 'post_author' => 1 ) );951 $post = self::factory()->post->create( array( 'post_author' => 1 ) ); 952 952 953 953 $this->assertFalse( current_user_can( 'edit_post', $post ) ); … … 961 961 } 962 962 963 $user = new WP_User( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );964 $other_user = new WP_User( self:: $factory->user->create( array( 'role' => 'subscriber' ) ) );963 $user = new WP_User( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 964 $other_user = new WP_User( self::factory()->user->create( array( 'role' => 'subscriber' ) ) ); 965 965 966 966 wp_set_current_user( $user->ID ); … … 975 975 } 976 976 977 $user = new WP_User( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );977 $user = new WP_User( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 978 978 979 979 wp_set_current_user( $user->ID ); … … 988 988 } 989 989 990 $user = new WP_User( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );990 $user = new WP_User( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 991 991 $user->add_cap( 'manage_network_users' ); 992 $other_user = new WP_User( self:: $factory->user->create( array( 'role' => 'subscriber' ) ) );992 $other_user = new WP_User( self::factory()->user->create( array( 'role' => 'subscriber' ) ) ); 993 993 994 994 wp_set_current_user( $user->ID ); … … 1003 1003 } 1004 1004 1005 $user = new WP_User( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );1005 $user = new WP_User( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 1006 1006 $user->add_cap( 'manage_network_users' ); 1007 $super_admin = new WP_User( self:: $factory->user->create( array( 'role' => 'subscriber' ) ) );1007 $super_admin = new WP_User( self::factory()->user->create( array( 'role' => 'subscriber' ) ) ); 1008 1008 grant_super_admin( $super_admin->ID ); 1009 1009 … … 1018 1018 function test_require_edit_others_posts_if_post_type_doesnt_exist() { 1019 1019 register_post_type( 'existed' ); 1020 $post_id = self:: $factory->post->create( array( 'post_type' => 'existed' ) );1020 $post_id = self::factory()->post->create( array( 'post_type' => 'existed' ) ); 1021 1021 _unregister_post_type( 'existed' ); 1022 1022 1023 $subscriber_id = self:: $factory->user->create( array( 'role' => 'subscriber' ) );1024 $editor_id = self:: $factory->user->create( array( 'role' => 'editor' ) );1023 $subscriber_id = self::factory()->user->create( array( 'role' => 'subscriber' ) ); 1024 $editor_id = self::factory()->user->create( array( 'role' => 'editor' ) ); 1025 1025 1026 1026 $this->setExpectedIncorrectUsage( 'map_meta_cap' ); … … 1047 1047 $cpt = get_post_type_object( 'page_capability' ); 1048 1048 1049 $admin = self:: $factory->user->create_and_get( array( 'role' => 'administrator' ) );1050 $editor = self:: $factory->user->create_and_get( array( 'role' => 'editor' ) );1051 $author = self:: $factory->user->create_and_get( array( 'role' => 'author' ) );1052 $contributor = self:: $factory->user->create_and_get( array( 'role' => 'contributor' ) );1049 $admin = self::factory()->user->create_and_get( array( 'role' => 'administrator' ) ); 1050 $editor = self::factory()->user->create_and_get( array( 'role' => 'editor' ) ); 1051 $author = self::factory()->user->create_and_get( array( 'role' => 'author' ) ); 1052 $contributor = self::factory()->user->create_and_get( array( 'role' => 'contributor' ) ); 1053 1053 1054 1054 $this->assertEquals( 'edit_pages', $cpt->cap->edit_posts ); … … 1058 1058 $this->assertFalse( user_can( $contributor->ID, $cpt->cap->edit_posts ) ); 1059 1059 1060 $admin_post = self:: $factory->post->create_and_get( array(1060 $admin_post = self::factory()->post->create_and_get( array( 1061 1061 'post_author' => $admin->ID, 1062 1062 'post_type' => 'page_capability', … … 1068 1068 $this->assertFalse( user_can( $contributor->ID, 'edit_post', $admin_post->ID ) ); 1069 1069 1070 $author_post = self:: $factory->post->create_and_get( array(1070 $author_post = self::factory()->post->create_and_get( array( 1071 1071 'post_author' => $author->ID, 1072 1072 'post_type' => 'page_capability', -
trunk/tests/phpunit/tests/user/countUsers.php
r35225 r35242 18 18 19 19 // Setup users 20 $admin = self:: $factory->user->create( array(20 $admin = self::factory()->user->create( array( 21 21 'role' => 'administrator', 22 22 ) ); 23 $editor = self:: $factory->user->create( array(23 $editor = self::factory()->user->create( array( 24 24 'role' => 'editor', 25 25 ) ); 26 $author = self:: $factory->user->create( array(26 $author = self::factory()->user->create( array( 27 27 'role' => 'author', 28 28 ) ); 29 $contributor = self:: $factory->user->create( array(29 $contributor = self::factory()->user->create( array( 30 30 'role' => 'contributor', 31 31 ) ); 32 $subscriber = self:: $factory->user->create( array(32 $subscriber = self::factory()->user->create( array( 33 33 'role' => 'subscriber', 34 34 ) ); 35 $none = self:: $factory->user->create( array(35 $none = self::factory()->user->create( array( 36 36 'role' => '', 37 37 ) ); 38 $nobody = self:: $factory->user->create( array(38 $nobody = self::factory()->user->create( array( 39 39 'role' => '', 40 40 ) ); … … 68 68 69 69 // Setup users 70 $admin = self:: $factory->user->create( array(70 $admin = self::factory()->user->create( array( 71 71 'role' => 'administrator', 72 72 ) ); 73 $editor = self:: $factory->user->create( array(73 $editor = self::factory()->user->create( array( 74 74 'role' => 'editor', 75 75 ) ); 76 $author = self:: $factory->user->create( array(76 $author = self::factory()->user->create( array( 77 77 'role' => 'author', 78 78 ) ); 79 $contributor = self:: $factory->user->create( array(79 $contributor = self::factory()->user->create( array( 80 80 'role' => 'contributor', 81 81 ) ); 82 $subscriber = self:: $factory->user->create( array(82 $subscriber = self::factory()->user->create( array( 83 83 'role' => 'subscriber', 84 84 ) ); 85 $none = self:: $factory->user->create( array(85 $none = self::factory()->user->create( array( 86 86 'role' => '', 87 87 ) ); 88 $nobody = self:: $factory->user->create( array(88 $nobody = self::factory()->user->create( array( 89 89 'role' => '', 90 90 ) ); 91 91 92 92 // Setup blogs 93 $blog_1 = (int) self:: $factory->blog->create( array(93 $blog_1 = (int) self::factory()->blog->create( array( 94 94 'user_id' => $editor, 95 95 ) ); 96 $blog_2 = (int) self:: $factory->blog->create( array(96 $blog_2 = (int) self::factory()->blog->create( array( 97 97 'user_id' => $author, 98 98 ) ); -
trunk/tests/phpunit/tests/user/dateQuery.php
r35225 r35242 10 10 */ 11 11 public function test_user_registered() { 12 $u1 = self:: $factory->user->create( array(12 $u1 = self::factory()->user->create( array( 13 13 'user_registered' => '2012-02-14 05:05:05', 14 14 ) ); 15 $u2 = self:: $factory->user->create( array(15 $u2 = self::factory()->user->create( array( 16 16 'user_registered' => '2013-02-14 05:05:05', 17 17 ) ); … … 32 32 */ 33 33 public function test_user_registered_relation_or() { 34 $u1 = self:: $factory->user->create( array(34 $u1 = self::factory()->user->create( array( 35 35 'user_registered' => '2012-02-14 05:05:05', 36 36 ) ); 37 $u2 = self:: $factory->user->create( array(37 $u2 = self::factory()->user->create( array( 38 38 'user_registered' => '2013-02-14 05:05:05', 39 39 ) ); 40 $u3 = self:: $factory->user->create( array(40 $u3 = self::factory()->user->create( array( 41 41 'user_registered' => '2014-02-14 05:05:05', 42 42 ) ); -
trunk/tests/phpunit/tests/user/listAuthors.php
r35225 r35242 72 72 73 73 function test_wp_list_authors_exclude_admin() { 74 self:: $factory->post->create( array( 'post_type' => 'post', 'post_author' => 1 ) );74 self::factory()->post->create( array( 'post_type' => 'post', 'post_author' => 1 ) ); 75 75 $expected['exclude_admin'] = '<li><a href="' . get_author_posts_url( 1 ) . '" title="Posts by admin">admin</a></li><li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li><li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li><li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>'; 76 76 $this->AssertEquals( $expected['exclude_admin'], wp_list_authors( array( 'echo' => false, 'exclude_admin' => 0 ) ) ); -
trunk/tests/phpunit/tests/user/mapMetaCap.php
r35225 r35242 13 13 $this->user_ids = array(); 14 14 15 $this->user_id = self:: $factory->user->create( array( 'role' => 'administrator' ) );16 $this->author_id = self:: $factory->user->create( array( 'role' => 'administrator' ) );15 $this->user_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); 16 $this->author_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); 17 17 18 18 if ( isset( $GLOBALS['super_admins'] ) ) … … 249 249 */ 250 250 function test_authorless_posts_capabilties() { 251 $post_id = self:: $factory->post->create( array( 'post_author' => 0, 'post_type' => 'post', 'post_status' => 'publish' ) );252 $editor = self:: $factory->user->create( array( 'role' => 'editor' ) );251 $post_id = self::factory()->post->create( array( 'post_author' => 0, 'post_type' => 'post', 'post_status' => 'publish' ) ); 252 $editor = self::factory()->user->create( array( 'role' => 'editor' ) ); 253 253 254 254 $this->assertEquals( array( 'edit_others_posts', 'edit_published_posts' ), map_meta_cap( 'edit_post', $editor, $post_id ) ); -
trunk/tests/phpunit/tests/user/multisite.php
r35225 r35242 26 26 27 27 function test_remove_user_from_blog() { 28 $user1 = self:: $factory->user->create_and_get();29 $user2 = self:: $factory->user->create_and_get();30 31 $post_id = self:: $factory->post->create( array( 'post_author' => $user1->ID ) );28 $user1 = self::factory()->user->create_and_get(); 29 $user2 = self::factory()->user->create_and_get(); 30 31 $post_id = self::factory()->post->create( array( 'post_author' => $user1->ID ) ); 32 32 33 33 remove_user_from_blog( $user1->ID, 1, $user2->ID ); … … 43 43 */ 44 44 function test_get_blogs_of_user() { 45 $user1_id = self:: $factory->user->create( array( 'role' => 'administrator' ) );45 $user1_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); 46 46 47 47 // Maintain a list of 6 total sites and include the primary network site. 48 $blog_ids = self:: $factory->blog->create_many( 5, array( 'user_id' => $user1_id ) );48 $blog_ids = self::factory()->blog->create_many( 5, array( 'user_id' => $user1_id ) ); 49 49 $blog_ids = array_merge( array( 1 ), $blog_ids ); 50 50 … … 115 115 global $wpdb; 116 116 117 $user1_id = self:: $factory->user->create( array( 'role' => 'administrator' ) );117 $user1_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); 118 118 119 119 $old_current = get_current_user_id(); … … 125 125 $blog_ids = array(); 126 126 127 $blog_ids = self:: $factory->blog->create_many( 5 );127 $blog_ids = self::factory()->blog->create_many( 5 ); 128 128 foreach ( $blog_ids as $blog_id ) { 129 129 $this->assertInternalType( 'int', $blog_id ); … … 139 139 global $wpdb; 140 140 141 $user1_id = self:: $factory->user->create( array( 'role' => 'administrator' ) );142 $user2_id = self:: $factory->user->create( array( 'role' => 'administrator' ) );141 $user1_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); 142 $user2_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); 143 143 144 144 $old_current = get_current_user_id(); … … 157 157 $this->assertTrue( is_user_member_of_blog( $user1_id, $wpdb->blogid ) ); 158 158 159 $blog_ids = self:: $factory->blog->create_many( 5 );159 $blog_ids = self::factory()->blog->create_many( 5 ); 160 160 foreach ( $blog_ids as $blog_id ) { 161 161 $this->assertInternalType( 'int', $blog_id ); … … 198 198 */ 199 199 function test_is_user_spammy() { 200 $user_id = self:: $factory->user->create( array(200 $user_id = self::factory()->user->create( array( 201 201 'role' => 'author', 202 202 'user_login' => 'testuser1', … … 204 204 205 205 $spam_username = (string) $user_id; 206 $spam_user_id = self:: $factory->user->create( array(206 $spam_user_id = self::factory()->user->create( array( 207 207 'role' => 'author', 208 208 'user_login' => $spam_username, … … 220 220 global $wp_rewrite; 221 221 222 self:: $factory->blog->create();223 $user_id = self:: $factory->user->create();224 self:: $factory->blog->create( array( 'user_id' => $user_id ) );222 self::factory()->blog->create(); 223 $user_id = self::factory()->user->create(); 224 self::factory()->blog->create( array( 'user_id' => $user_id ) ); 225 225 226 226 $blogs = get_blogs_of_user( $user_id ); … … 262 262 } 263 263 264 $user_id = self:: $factory->user->create();264 $user_id = self::factory()->user->create(); 265 265 grant_super_admin( $user_id ); 266 266 revoke_super_admin( $user_id ); … … 279 279 } 280 280 281 $user_id = self:: $factory->user->create();281 $user_id = self::factory()->user->create(); 282 282 grant_super_admin( $user_id ); 283 283 revoke_super_admin( $user_id ); … … 298 298 } 299 299 300 $user_id = self:: $factory->user->create();300 $user_id = self::factory()->user->create(); 301 301 grant_super_admin( $user_id ); 302 302 … … 317 317 } 318 318 319 $user_id = self:: $factory->user->create();319 $user_id = self::factory()->user->create(); 320 320 321 321 $this->assertFalse( is_super_admin( $user_id ) ); … … 330 330 331 331 // Try with two users. 332 $second_user = self:: $factory->user->create();332 $second_user = self::factory()->user->create(); 333 333 $this->assertTrue( grant_super_admin( $user_id ) ); 334 334 $this->assertTrue( grant_super_admin( $second_user ) ); … … 344 344 345 345 public function test_numeric_string_user_id() { 346 $u = self:: $factory->user->create();346 $u = self::factory()->user->create(); 347 347 348 348 $u_string = (string) $u; … … 362 362 */ 363 363 public function test_should_return_false_for_object_user_id() { 364 $u_obj = self:: $factory->user->create_and_get();364 $u_obj = self::factory()->user->create_and_get(); 365 365 $this->assertFalse( wpmu_delete_user( $u_obj ) ); 366 366 $this->assertEquals( $u_obj->ID, username_exists( $u_obj->user_login ) ); -
trunk/tests/phpunit/tests/user/query.php
r35225 r35242 246 246 */ 247 247 public function test_orderby_clause_key_as_secondary_sort() { 248 $u1 = self:: $factory->user->create( array(248 $u1 = self::factory()->user->create( array( 249 249 'user_registered' => '2015-01-28 03:00:00', 250 250 ) ); 251 $u2 = self:: $factory->user->create( array(251 $u2 = self::factory()->user->create( array( 252 252 'user_registered' => '2015-01-28 05:00:00', 253 253 ) ); 254 $u3 = self:: $factory->user->create( array(254 $u3 = self::factory()->user->create( array( 255 255 'user_registered' => '2015-01-28 03:00:00', 256 256 ) ); … … 599 599 } 600 600 601 $b = self:: $factory->blog->create();601 $b = self::factory()->blog->create(); 602 602 603 603 add_user_to_blog( $b, self::$author_ids[0], 'author' ); … … 625 625 } 626 626 627 $b = self:: $factory->blog->create();627 $b = self::factory()->blog->create(); 628 628 add_user_to_blog( $b, self::$author_ids[0], 'author' ); 629 629 … … 650 650 } 651 651 652 $b = self:: $factory->blog->create();652 $b = self::factory()->blog->create(); 653 653 654 654 add_user_to_blog( $b, self::$author_ids[0], 'subscriber' ); … … 676 676 } 677 677 678 $b = self:: $factory->blog->create();678 $b = self::factory()->blog->create(); 679 679 680 680 add_user_to_blog( $b, self::$author_ids[0], 'subscriber' ); … … 708 708 register_post_type( 'wptests_pt_private', array( 'public' => false ) ); 709 709 710 self:: $factory->post->create( array( 'post_author' => self::$author_ids[0], 'post_status' => 'publish', 'post_type' => 'wptests_pt_public' ) );711 self:: $factory->post->create( array( 'post_author' => self::$author_ids[1], 'post_status' => 'publish', 'post_type' => 'wptests_pt_private' ) );710 self::factory()->post->create( array( 'post_author' => self::$author_ids[0], 'post_status' => 'publish', 'post_type' => 'wptests_pt_public' ) ); 711 self::factory()->post->create( array( 'post_author' => self::$author_ids[1], 'post_status' => 'publish', 'post_type' => 'wptests_pt_private' ) ); 712 712 713 713 $q = new WP_User_Query( array( … … 728 728 register_post_type( 'wptests_pt_private', array( 'public' => false ) ); 729 729 730 self:: $factory->post->create( array( 'post_author' => self::$author_ids[0], 'post_status' => 'publish', 'post_type' => 'wptests_pt_public' ) );731 self:: $factory->post->create( array( 'post_author' => self::$author_ids[1], 'post_status' => 'publish', 'post_type' => 'wptests_pt_private' ) );732 self:: $factory->post->create( array( 'post_author' => self::$author_ids[2], 'post_status' => 'publish', 'post_type' => 'post' ) );730 self::factory()->post->create( array( 'post_author' => self::$author_ids[0], 'post_status' => 'publish', 'post_type' => 'wptests_pt_public' ) ); 731 self::factory()->post->create( array( 'post_author' => self::$author_ids[1], 'post_status' => 'publish', 'post_type' => 'wptests_pt_private' ) ); 732 self::factory()->post->create( array( 'post_author' => self::$author_ids[2], 'post_status' => 'publish', 'post_type' => 'post' ) ); 733 733 734 734 $q = new WP_User_Query( array( … … 749 749 register_post_type( 'wptests_pt_private', array( 'public' => false ) ); 750 750 751 self:: $factory->post->create( array( 'post_author' => self::$author_ids[0], 'post_status' => 'draft', 'post_type' => 'wptests_pt_public' ) );752 self:: $factory->post->create( array( 'post_author' => self::$author_ids[1], 'post_status' => 'inherit', 'post_type' => 'wptests_pt_private' ) );753 self:: $factory->post->create( array( 'post_author' => self::$author_ids[2], 'post_status' => 'publish', 'post_type' => 'post' ) );751 self::factory()->post->create( array( 'post_author' => self::$author_ids[0], 'post_status' => 'draft', 'post_type' => 'wptests_pt_public' ) ); 752 self::factory()->post->create( array( 'post_author' => self::$author_ids[1], 'post_status' => 'inherit', 'post_type' => 'wptests_pt_private' ) ); 753 self::factory()->post->create( array( 'post_author' => self::$author_ids[2], 'post_status' => 'publish', 'post_type' => 'post' ) ); 754 754 755 755 $q = new WP_User_Query( array( … … 771 771 } 772 772 773 $blogs = self:: $factory->blog->create_many( 2 );773 $blogs = self::factory()->blog->create_many( 2 ); 774 774 775 775 add_user_to_blog( $blogs[0], self::$author_ids[0], 'author' ); … … 779 779 780 780 switch_to_blog( $blogs[0] ); 781 self:: $factory->post->create( array( 'post_author' => self::$author_ids[0], 'post_status' => 'publish', 'post_type' => 'post' ) );781 self::factory()->post->create( array( 'post_author' => self::$author_ids[0], 'post_status' => 'publish', 'post_type' => 'post' ) ); 782 782 restore_current_blog(); 783 783 784 784 switch_to_blog( $blogs[1] ); 785 self:: $factory->post->create( array( 'post_author' => self::$author_ids[1], 'post_status' => 'publish', 'post_type' => 'post' ) );785 self::factory()->post->create( array( 'post_author' => self::$author_ids[1], 'post_status' => 'publish', 'post_type' => 'post' ) ); 786 786 restore_current_blog(); 787 787 … … 932 932 */ 933 933 public function test_get_single_role_by_string_which_is_similar() { 934 $another_editor = self:: $factory->user->create( array(934 $another_editor = self::factory()->user->create( array( 935 935 'role' => 'another-editor', 936 936 ) ); … … 1149 1149 } 1150 1150 1151 $sites = self:: $factory->blog->create_many( 2 );1151 $sites = self::factory()->blog->create_many( 2 ); 1152 1152 1153 1153 add_user_to_blog( $sites[0], self::$author_ids[0], 'author' ); -
trunk/tests/phpunit/tests/user/session.php
r35225 r35242 11 11 parent::setUp(); 12 12 remove_all_filters( 'session_token_manager' ); 13 $user_id = self:: $factory->user->create();13 $user_id = self::factory()->user->create(); 14 14 $this->manager = WP_Session_Tokens::get_instance( $user_id ); 15 15 $this->assertInstanceOf( 'WP_Session_Tokens', $this->manager ); -
trunk/tests/phpunit/tests/user/slashes.php
r35225 r35242 9 9 function setUp() { 10 10 parent::setUp(); 11 $this->author_id = self:: $factory->user->create( array( 'role' => 'administrator' ) );11 $this->author_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); 12 12 $this->old_current_user = get_current_user_id(); 13 13 wp_set_current_user( $this->author_id ); … … 84 84 */ 85 85 function test_edit_user() { 86 $id = self:: $factory->user->create();86 $id = self::factory()->user->create(); 87 87 88 88 $_POST = $_GET = $_REQUEST = array(); … … 174 174 */ 175 175 function test_wp_update_user() { 176 $id = self:: $factory->user->create();176 $id = self::factory()->user->create(); 177 177 $id = wp_update_user(array( 178 178 'ID' => $id, -
trunk/tests/phpunit/tests/user/updateUserCaches.php
r35225 r35242 8 8 global $wpdb; 9 9 10 $u = self:: $factory->user->create();10 $u = self::factory()->user->create(); 11 11 $raw_userdata = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE ID = %d", $u ) ); 12 12 … … 58 58 global $wpdb; 59 59 60 $u = self:: $factory->user->create();60 $u = self::factory()->user->create(); 61 61 $raw_userdata = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE ID = %d", $u ) ); 62 62 $user_object = new WP_User( $u ); -
trunk/tests/phpunit/tests/user/wpDeleteUser.php
r35225 r35242 15 15 $this->assertEquals( array(), get_blogs_of_user( 0 ) ); 16 16 17 $user_id = self:: $factory->user->create( array( 'role' => 'subscriber' ) );17 $user_id = self::factory()->user->create( array( 'role' => 'subscriber' ) ); 18 18 $blogs = get_blogs_of_user( $user_id ); 19 19 $this->assertEquals( array( 1 ), array_keys( $blogs ) ); … … 35 35 $old_current = get_current_user_id(); 36 36 37 $user_id = self:: $factory->user->create( array( 'role' => 'subscriber' ) );37 $user_id = self::factory()->user->create( array( 'role' => 'subscriber' ) ); 38 38 wp_set_current_user( $user_id ); 39 39 … … 55 55 56 56 function test_delete_user() { 57 $user_id = self:: $factory->user->create( array( 'role' => 'author' ) );57 $user_id = self::factory()->user->create( array( 'role' => 'author' ) ); 58 58 $user = new WP_User( $user_id ); 59 59 … … 112 112 */ 113 113 function test_wp_delete_user_reassignment_clears_post_caches() { 114 $user_id = self:: $factory->user->create();115 $reassign = self:: $factory->user->create();116 $post_id = self:: $factory->post->create( array( 'post_author' => $user_id ) );114 $user_id = self::factory()->user->create(); 115 $reassign = self::factory()->user->create(); 116 $post_id = self::factory()->post->create( array( 'post_author' => $user_id ) ); 117 117 118 118 get_post( $post_id ); // Ensure this post is in the cache. … … 129 129 } 130 130 131 $u = self:: $factory->user->create();131 $u = self::factory()->user->create(); 132 132 133 133 $u_string = (string) $u; … … 151 151 } 152 152 153 $u_obj = self:: $factory->user->create_and_get();153 $u_obj = self::factory()->user->create_and_get(); 154 154 $this->assertFalse( wp_delete_user( $u_obj ) ); 155 155 $this->assertEquals( $u_obj->ID, username_exists( $u_obj->user_login ) ); -
trunk/tests/phpunit/tests/user/wpGetUsersWithNoRole.php
r35225 r35242 16 16 17 17 // Setup users 18 $admin = self:: $factory->user->create( array(18 $admin = self::factory()->user->create( array( 19 19 'role' => 'administrator', 20 20 ) ); 21 $editor = self:: $factory->user->create( array(21 $editor = self::factory()->user->create( array( 22 22 'role' => 'editor', 23 23 ) ); 24 $nobody = self:: $factory->user->create( array(24 $nobody = self::factory()->user->create( array( 25 25 'role' => '', 26 26 ) ); 27 $nobody_else = self:: $factory->user->create( array(27 $nobody_else = self::factory()->user->create( array( 28 28 'role' => '', 29 29 ) ); … … 50 50 51 51 // Setup users 52 $admin = self:: $factory->user->create( array(52 $admin = self::factory()->user->create( array( 53 53 'role' => 'administrator', 54 54 ) ); 55 $editor = self:: $factory->user->create( array(55 $editor = self::factory()->user->create( array( 56 56 'role' => 'editor', 57 57 ) ); 58 $nobody = self:: $factory->user->create( array(58 $nobody = self::factory()->user->create( array( 59 59 'role' => '', 60 60 ) ); 61 61 62 62 // Setup blogs 63 $blog_1 = (int) self:: $factory->blog->create( array(63 $blog_1 = (int) self::factory()->blog->create( array( 64 64 'user_id' => $editor, 65 65 ) ); -
trunk/tests/phpunit/tests/user/wpSetCurrentUser.php
r35225 r35242 6 6 class Tests_User_WpSetCurrentUser extends WP_UnitTestCase { 7 7 public function test_set_by_id() { 8 $u = self:: $factory->user->create();8 $u = self::factory()->user->create(); 9 9 10 10 $user = wp_set_current_user( $u ); … … 16 16 17 17 public function test_name_should_be_ignored_if_id_is_not_null() { 18 $u = self:: $factory->user->create();18 $u = self::factory()->user->create(); 19 19 20 20 $user = wp_set_current_user( $u, 'foo' ); … … 26 26 27 27 public function test_should_set_by_name_if_id_is_null_and_current_user_is_nonempty() { 28 $u1 = self:: $factory->user->create();28 $u1 = self::factory()->user->create(); 29 29 wp_set_current_user( $u1 ); 30 30 $this->assertSame( $u1, get_current_user_id() ); 31 31 32 $u2 = self:: $factory->user->create( array(32 $u2 = self::factory()->user->create( array( 33 33 'user_login' => 'foo', 34 34 ) ); … … 50 50 $this->assertSame( 0, get_current_user_id() ); 51 51 52 $u = self:: $factory->user->create( array(52 $u = self::factory()->user->create( array( 53 53 'user_login' => 'foo', 54 54 ) ); -
trunk/tests/phpunit/tests/widgets.php
r35225 r35242 439 439 $this->assertFalse( $widget->is_preview() ); 440 440 441 wp_set_current_user( self:: $factory->user->create( array( 'role' => 'administrator' ) ) );441 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 442 442 require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; 443 443 $wp_customize = new WP_Customize_Manager(); -
trunk/tests/phpunit/tests/xmlrpc/mt/getRecentPostTitles.php
r35225 r35242 23 23 $this->make_user_by_role( 'author' ); 24 24 $editor = $this->make_user_by_role( 'editor' ); 25 self:: $factory->post->create( array( 'post_author' => $editor ) );25 self::factory()->post->create( array( 'post_author' => $editor ) ); 26 26 27 27 $result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) ); … … 33 33 $this->make_user_by_role( 'author' ); 34 34 35 self:: $factory->post->create();35 self::factory()->post->create(); 36 36 37 37 $results = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) ); -
trunk/tests/phpunit/tests/xmlrpc/mw/editPost.php
r35225 r35242 127 127 // create attachment 128 128 $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' ); 129 $attachment_id = self:: $factory->attachment->create_upload_object( $filename, $post_id );129 $attachment_id = self::factory()->attachment->create_upload_object( $filename, $post_id ); 130 130 131 131 // add post thumbnail to post that does not have one … … 142 142 143 143 // create another attachment 144 $attachment2_id = self:: $factory->attachment->create_upload_object( $filename, $post_id );144 $attachment2_id = self::factory()->attachment->create_upload_object( $filename, $post_id ); 145 145 146 146 // change the post's post_thumbnail … … 229 229 $editor_id = $this->make_user_by_role( 'editor' ); 230 230 231 $post_id = self:: $factory->post->create( array(231 $post_id = self::factory()->post->create( array( 232 232 'post_author' => $editor_id 233 233 ) ); … … 252 252 $editor_id = $this->make_user_by_role( 'editor' ); 253 253 254 $post_id = self:: $factory->post->create( array(254 $post_id = self::factory()->post->create( array( 255 255 'post_title' => 'Title', 256 256 'post_author' => $editor_id, -
trunk/tests/phpunit/tests/xmlrpc/mw/getPost.php
r35225 r35242 96 96 // create attachment 97 97 $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' ); 98 $attachment_id = self:: $factory->attachment->create_upload_object( $filename );98 $attachment_id = self::factory()->attachment->create_upload_object( $filename ); 99 99 100 100 set_post_thumbnail( $this->post_id, $attachment_id ); -
trunk/tests/phpunit/tests/xmlrpc/mw/getRecentPosts.php
r35225 r35242 101 101 // create attachment 102 102 $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' ); 103 $attachment_id = self:: $factory->attachment->create_upload_object( $filename, $this->post_id );103 $attachment_id = self::factory()->attachment->create_upload_object( $filename, $this->post_id ); 104 104 set_post_thumbnail( $this->post_id, $attachment_id ); 105 105 -
trunk/tests/phpunit/tests/xmlrpc/mw/newPost.php
r35225 r35242 118 118 // create attachment 119 119 $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' ); 120 $attachment_id = self:: $factory->attachment->create_upload_object( $filename );120 $attachment_id = self::factory()->attachment->create_upload_object( $filename ); 121 121 122 122 $post = array( 'title' => 'Post Thumbnail Test', 'wp_post_thumbnail' => $attachment_id ); -
trunk/tests/phpunit/tests/xmlrpc/wp/deletePost.php
r35225 r35242 22 22 function test_incapable_user() { 23 23 $this->make_user_by_role( 'subscriber' ); 24 $post_id = self:: $factory->post->create();24 $post_id = self::factory()->post->create(); 25 25 26 26 $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'subscriber', 'subscriber', $post_id ) ); … … 31 31 function test_post_deleted() { 32 32 $this->make_user_by_role( 'editor' ); 33 $post_id = self:: $factory->post->create();33 $post_id = self::factory()->post->create(); 34 34 35 35 $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'editor', 'editor', $post_id ) ); -
trunk/tests/phpunit/tests/xmlrpc/wp/editComment.php
r35225 r35242 8 8 function test_author_can_edit_own_comment() { 9 9 $author_id = $this->make_user_by_role( 'author' ); 10 $post_id = self:: $factory->post->create( array(10 $post_id = self::factory()->post->create( array( 11 11 'post_title' => 'Post test by author', 12 12 'post_author' => $author_id … … 30 30 $this->make_user_by_role( 'author' ); 31 31 $editor_id = $this->make_user_by_role( 'editor' ); 32 $post_id = self:: $factory->post->create( array(32 $post_id = self::factory()->post->create( array( 33 33 'post_title' => 'Post test by editor', 34 34 'post_author' => $editor_id … … 50 50 function test_trash_comment() { 51 51 $this->make_user_by_role( 'administrator' ); 52 $post_id = self:: $factory->post->create();52 $post_id = self::factory()->post->create(); 53 53 54 54 $comment_data = array( … … 79 79 80 80 $this->make_user_by_role( 'administrator' ); 81 $post_id = self:: $factory->post->create();81 $post_id = self::factory()->post->create(); 82 82 83 83 $comment_data = array( -
trunk/tests/phpunit/tests/xmlrpc/wp/editPost.php
r35225 r35242 127 127 // create attachment 128 128 $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' ); 129 $attachment_id = self:: $factory->attachment->create_upload_object( $filename, $post_id );129 $attachment_id = self::factory()->attachment->create_upload_object( $filename, $post_id ); 130 130 131 131 // add post thumbnail to post that does not have one … … 149 149 150 150 // create another attachment 151 $attachment2_id = self:: $factory->attachment->create_upload_object( $filename, $post_id );151 $attachment2_id = self::factory()->attachment->create_upload_object( $filename, $post_id ); 152 152 153 153 // change the post's post_thumbnail … … 209 209 $editor_id = $this->make_user_by_role( 'editor' ); 210 210 211 $post_id = self:: $factory->post->create( array( 'post_author' => $editor_id ) );211 $post_id = self::factory()->post->create( array( 'post_author' => $editor_id ) ); 212 212 stick_post( $post_id ); 213 213 … … 221 221 // when transitioning to private status or adding a post password, post should be un-stuck 222 222 $editor_id = $this->make_user_by_role( 'editor' ); 223 $post_id = self:: $factory->post->create( array( 'post_author' => $editor_id ) );223 $post_id = self::factory()->post->create( array( 'post_author' => $editor_id ) ); 224 224 stick_post( $post_id ); 225 225 … … 235 235 $yesterday = strtotime( '-1 day' ); 236 236 237 $post_id = self:: $factory->post->create( array(237 $post_id = self::factory()->post->create( array( 238 238 'post_title' => 'Post Revision Test', 239 239 'post_content' => 'Not edited', … … 264 264 $editor_id = $this->make_user_by_role( 'editor' ); 265 265 266 $post_id = self:: $factory->post->create( array(266 $post_id = self::factory()->post->create( array( 267 267 'post_title' => 'Post Revision Test', 268 268 'post_content' => 'Not edited', … … 283 283 $editor_id = $this->make_user_by_role( 'editor' ); 284 284 285 $post_id = self:: $factory->post->create( array(285 $post_id = self::factory()->post->create( array( 286 286 'post_title' => 'Post Revision Test', 287 287 'post_content' => 'Not edited', … … 303 303 $editor_id = $this->make_user_by_role( 'editor' ); 304 304 305 $post_id = self:: $factory->post->create( array( 'post_author' => $editor_id ) );306 $term_id = self:: $factory->category->create();307 self:: $factory->term->add_post_terms( $post_id, $term_id, 'category', true );305 $post_id = self::factory()->post->create( array( 'post_author' => $editor_id ) ); 306 $term_id = self::factory()->category->create(); 307 self::factory()->term->add_post_terms( $post_id, $term_id, 'category', true ); 308 308 $term_ids = wp_list_pluck( get_the_category( $post_id ), 'term_id' ); 309 309 $this->assertContains( $term_id, $term_ids ); … … 323 323 $editor_id = $this->make_user_by_role( 'editor' ); 324 324 325 $post_id = self:: $factory->post->create( array( 'post_author' => $editor_id ) );326 $term_id = self:: $factory->category->create();327 self:: $factory->term->add_post_terms( $post_id, $term_id, 'category', true );325 $post_id = self::factory()->post->create( array( 'post_author' => $editor_id ) ); 326 $term_id = self::factory()->category->create(); 327 self::factory()->term->add_post_terms( $post_id, $term_id, 'category', true ); 328 328 $term_ids = wp_list_pluck( get_the_category( $post_id ), 'term_id' ); 329 329 $this->assertContains( $term_id, $term_ids ); … … 366 366 367 367 // Add a dummy post 368 $post_id = self:: $factory->post->create( array(368 $post_id = self::factory()->post->create( array( 369 369 'post_title' => 'Post Enclosure Test', 370 370 'post_content' => 'Fake content', -
trunk/tests/phpunit/tests/xmlrpc/wp/getComment.php
r35225 r35242 14 14 parent::setUp(); 15 15 16 $this->post_id = self:: $factory->post->create();16 $this->post_id = self::factory()->post->create(); 17 17 18 18 $this->parent_comment_data = array( -
trunk/tests/phpunit/tests/xmlrpc/wp/getComments.php
r35225 r35242 22 22 23 23 function test_capable_user() { 24 $this->post_id = self:: $factory->post->create();25 self:: $factory->comment->create_post_comments( $this->post_id, 2 );24 $this->post_id = self::factory()->post->create(); 25 self::factory()->comment->create_post_comments( $this->post_id, 2 ); 26 26 27 27 $this->make_user_by_role( 'editor' ); … … 37 37 38 38 function test_post_filter() { 39 $this->post_id = self:: $factory->post->create();40 self:: $factory->comment->create_post_comments( $this->post_id, 2 );39 $this->post_id = self::factory()->post->create(); 40 self::factory()->comment->create_post_comments( $this->post_id, 2 ); 41 41 42 42 $this->make_user_by_role( 'editor' ); … … 53 53 54 54 function test_number_filter() { 55 $this->post_id = self:: $factory->post->create();56 self:: $factory->comment->create_post_comments( $this->post_id, 11 );55 $this->post_id = self::factory()->post->create(); 56 self::factory()->comment->create_post_comments( $this->post_id, 11 ); 57 57 58 58 $this->make_user_by_role( 'editor' ); … … 77 77 $this->make_user_by_role( 'contributor' ); 78 78 $author_id = $this->make_user_by_role( 'author' ); 79 $author_post_id = self:: $factory->post->create( array(79 $author_post_id = self::factory()->post->create( array( 80 80 'post_title' => 'Author', 81 81 'post_author' => $author_id, … … 83 83 ) ); 84 84 85 self:: $factory->comment->create( array(85 self::factory()->comment->create( array( 86 86 'comment_post_ID' => $author_post_id, 87 87 'comment_author' => "Commenter 1", … … 91 91 92 92 $editor_id = $this->make_user_by_role( 'editor' ); 93 $editor_post_id = self:: $factory->post->create( array(93 $editor_post_id = self::factory()->post->create( array( 94 94 'post_title' => 'Editor', 95 95 'post_author' => $editor_id, … … 97 97 ) ); 98 98 99 self:: $factory->comment->create( array(99 self::factory()->comment->create( array( 100 100 'comment_post_ID' => $editor_post_id, 101 101 'comment_author' => 'Commenter 2', … … 111 111 function test_author_capabilities() { 112 112 $author_id = $this->make_user_by_role( 'author' ); 113 $author_post_id = self:: $factory->post->create( array(113 $author_post_id = self::factory()->post->create( array( 114 114 'post_title' => 'Author', 115 115 'post_author' => $author_id, … … 117 117 ) ); 118 118 119 self:: $factory->comment->create( array(119 self::factory()->comment->create( array( 120 120 'comment_post_ID' => $author_post_id, 121 121 'comment_author' => 'Commenter 1', … … 125 125 126 126 $editor_id = $this->make_user_by_role( 'editor' ); 127 $editor_post_id = self:: $factory->post->create( array(127 $editor_post_id = self::factory()->post->create( array( 128 128 'post_title' => 'Editor', 129 129 'post_author' => $editor_id, … … 131 131 ) ); 132 132 133 self:: $factory->comment->create( array(133 self::factory()->comment->create( array( 134 134 'comment_post_ID' => $editor_post_id, 135 135 'comment_author' => 'Commenter 2', … … 167 167 function test_editor_capabilities() { 168 168 $author_id = $this->make_user_by_role( 'author' ); 169 $author_post_id = self:: $factory->post->create( array(169 $author_post_id = self::factory()->post->create( array( 170 170 'post_title' => 'Author', 171 171 'post_author' => $author_id, … … 173 173 ) ); 174 174 175 self:: $factory->comment->create( array(175 self::factory()->comment->create( array( 176 176 'comment_post_ID' => $author_post_id, 177 177 'comment_author' => 'Commenter 1', … … 181 181 182 182 $editor_id = $this->make_user_by_role( 'editor' ); 183 $editor_post_id = self:: $factory->post->create( array(183 $editor_post_id = self::factory()->post->create( array( 184 184 'post_title' => 'Editor', 185 185 'post_author' => $editor_id, … … 187 187 ) ); 188 188 189 self:: $factory->comment->create(array(189 self::factory()->comment->create(array( 190 190 'comment_post_ID' => $editor_post_id, 191 191 'comment_author' => 'Commenter 2', -
trunk/tests/phpunit/tests/xmlrpc/wp/getPost.php
r35225 r35242 123 123 $this->make_user_by_role( 'editor' ); 124 124 125 $parent_page_id = self:: $factory->post->create( array( 'post_type' => 'page' ) );126 $child_page_id = self:: $factory->post->create( array(125 $parent_page_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 126 $child_page_id = self::factory()->post->create( array( 127 127 'post_type' => 'page', 128 128 'post_parent' => $parent_page_id, -
trunk/tests/phpunit/tests/xmlrpc/wp/getPosts.php
r35225 r35242 55 55 $num_posts = 4; 56 56 foreach ( range( 1, $num_posts ) as $i ) { 57 $post_ids[] = self:: $factory->post->create( array(57 $post_ids[] = self::factory()->post->create( array( 58 58 'post_type' => $cpt_name, 59 59 'post_date' => date( 'Y-m-d H:i:s', time() + $i ) … … 81 81 foreach ( $post_ids as $key => $post_id ) { 82 82 // Larger post IDs will get more comments. 83 self:: $factory->comment->create_post_comments( $post_id, $key );83 self::factory()->comment->create_post_comments( $post_id, $key ); 84 84 } 85 85 … … 110 110 function test_fields() { 111 111 $this->make_user_by_role( 'editor' ); 112 self:: $factory->post->create();112 self::factory()->post->create(); 113 113 114 114 // check default fields … … 137 137 $this->make_user_by_role( 'editor' ); 138 138 139 $post_ids[] = self:: $factory->post->create( array( 'post_title' => 'First: ' . rand_str() ) );140 $post_ids[] = self:: $factory->post->create( array( 'post_title' => 'Second: ' . rand_str() ) );139 $post_ids[] = self::factory()->post->create( array( 'post_title' => 'First: ' . rand_str() ) ); 140 $post_ids[] = self::factory()->post->create( array( 'post_title' => 'Second: ' . rand_str() ) ); 141 141 142 142 // Search for none of them -
trunk/tests/phpunit/tests/xmlrpc/wp/getRevisions.php
r35225 r35242 15 15 $this->make_user_by_role( 'subscriber' ); 16 16 17 $post_id = self:: $factory->post->create();17 $post_id = self::factory()->post->create(); 18 18 19 19 $result = $this->myxmlrpcserver->wp_getRevisions( array( 1, 'subscriber', 'subscriber', $post_id ) ); … … 25 25 $this->make_user_by_role( 'editor' ); 26 26 27 $post_id = self:: $factory->post->create();27 $post_id = self::factory()->post->create(); 28 28 $result = $this->myxmlrpcserver->wp_getRevisions( array( 1, 'editor', 'editor', $post_id ) ); 29 29 $this->assertNotInstanceOf( 'IXR_Error', $result ); … … 33 33 $this->make_user_by_role( 'editor' ); 34 34 35 $post_id = self:: $factory->post->create();35 $post_id = self::factory()->post->create(); 36 36 wp_insert_post( array( 'ID' => $post_id, 'post_content' => 'Edit 1' ) ); // Create the initial revision 37 37 -
trunk/tests/phpunit/tests/xmlrpc/wp/getTerms.php
r35225 r35242 107 107 $cat2 = wp_create_category( 'wp.getTerms_' . rand_str( 16 ) ); 108 108 109 self:: $factory->post->create_many( 5, array( 'post_category' => array( $cat1 ) ) );110 self:: $factory->post->create_many( 3, array( 'post_category' => array( $cat2 ) ) );109 self::factory()->post->create_many( 5, array( 'post_category' => array( $cat1 ) ) ); 110 self::factory()->post->create_many( 3, array( 'post_category' => array( $cat2 ) ) ); 111 111 112 112 $filter = array( 'orderby' => 'count', 'order' => 'DESC' ); -
trunk/tests/phpunit/tests/xmlrpc/wp/getUsers.php
r35225 r35242 80 80 grant_super_admin( $administrator_id ); 81 81 82 self:: $factory->user->create_many( 5 );82 self::factory()->user->create_many( 5 ); 83 83 84 84 $user_ids = get_users( array( 'fields' => 'ID' ) ); -
trunk/tests/phpunit/tests/xmlrpc/wp/newComment.php
r35225 r35242 7 7 function test_new_comment_post_closed() { 8 8 $this->make_user_by_role( 'administrator' ); 9 $post = self:: $factory->post->create_and_get( array(9 $post = self::factory()->post->create_and_get( array( 10 10 'comment_status' => 'closed' 11 11 ) ); -
trunk/tests/phpunit/tests/xmlrpc/wp/newPost.php
r35225 r35242 129 129 // create attachment 130 130 $filename = ( DIR_TESTDATA.'/images/a2-small.jpg' ); 131 $attachment_id = self:: $factory->attachment->create_upload_object( $filename );131 $attachment_id = self::factory()->attachment->create_upload_object( $filename ); 132 132 133 133 $post = array( 'post_title' => 'Post Thumbnail Test', 'post_thumbnail' => $attachment_id ); -
trunk/tests/phpunit/tests/xmlrpc/wp/restoreRevision.php
r35225 r35242 11 11 parent::setUp(); 12 12 13 $this->post_id = self:: $factory->post->create( array( 'post_content' => 'edit1' ) ); // Not saved as a revision13 $this->post_id = self::factory()->post->create( array( 'post_content' => 'edit1' ) ); // Not saved as a revision 14 14 // First saved revision on update, see https://core.trac.wordpress.org/changeset/24650 15 15 wp_insert_post( array( 'ID' => $this->post_id, 'post_content' => 'edit2' ) );
Note: See TracChangeset
for help on using the changeset viewer.