Changeset 54088
- Timestamp:
- 09/06/2022 10:03:10 PM (2 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 38 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/adminbar.php
r52010 r54088 657 657 wp_set_current_user( self::$admin_id ); 658 658 659 $this->factory()->post->create(659 self::factory()->post->create( 660 660 array( 661 661 'post_type' => 'customize_changeset', -
trunk/tests/phpunit/tests/ajax/CustomizeManager.php
r53561 r54088 308 308 $uuid = wp_generate_uuid4(); 309 309 310 $post_id = $this->factory()->post->create(310 $post_id = self::factory()->post->create( 311 311 array( 312 312 'post_name' => $uuid, … … 347 347 public function test_success_save_post_date() { 348 348 $uuid = wp_generate_uuid4(); 349 $post_id = $this->factory()->post->create(349 $post_id = self::factory()->post->create( 350 350 array( 351 351 'post_name' => $uuid, … … 447 447 $uuid = wp_generate_uuid4(); 448 448 449 $post_id = $this->factory()->post->create(449 $post_id = self::factory()->post->create( 450 450 array( 451 451 'post_name' => $uuid, … … 615 615 $this->assertSame( 'no_auto_draft_to_delete', $this->_last_response_parsed['data'] ); 616 616 617 $other_user_id = $this->factory()->user->create();617 $other_user_id = self::factory()->user->create(); 618 618 619 619 // Create auto-drafts. 620 620 $user_auto_draft_ids = array(); 621 621 for ( $i = 0; $i < 3; $i++ ) { 622 $user_auto_draft_ids[] = $this->factory()->post->create(622 $user_auto_draft_ids[] = self::factory()->post->create( 623 623 array( 624 624 'post_name' => wp_generate_uuid4(), … … 632 632 $other_user_auto_draft_ids = array(); 633 633 for ( $i = 0; $i < 3; $i++ ) { 634 $other_user_auto_draft_ids[] = $this->factory()->post->create(634 $other_user_auto_draft_ids[] = self::factory()->post->create( 635 635 array( 636 636 'post_name' => wp_generate_uuid4(), -
trunk/tests/phpunit/tests/ajax/CustomizeMenus.php
r53571 r54088 707 707 708 708 // Bad nonce. 709 wp_set_current_user( $this->factory()->user->create( array( 'role' => 'subscriber' ) ) );709 wp_set_current_user( self::factory()->user->create( array( 'role' => 'subscriber' ) ) ); 710 710 $_POST = wp_slash( 711 711 array( … … 720 720 721 721 // Missing params. 722 wp_set_current_user( $this->factory()->user->create( array( 'role' => 'administrator' ) ) );722 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 723 723 $_POST = wp_slash( 724 724 array( -
trunk/tests/phpunit/tests/auth.php
r52157 r54088 422 422 'user_pass' => 'password', 423 423 ); 424 $this->factory()->user->create( $user_args );424 self::factory()->user->create( $user_args ); 425 425 426 426 $_POST['log'] = $user_args['user_email']; … … 437 437 */ 438 438 public function test_application_password_authentication() { 439 $user_id = $this->factory()->user->create(439 $user_id = self::factory()->user->create( 440 440 array( 441 441 'user_login' => 'http_auth_login', -
trunk/tests/phpunit/tests/blocks/context.php
r52010 r54088 37 37 ); 38 38 39 $post = $this->factory()->post->create_and_get( $args );39 $post = self::factory()->post->create_and_get( $args ); 40 40 setup_postdata( $post ); 41 41 } -
trunk/tests/phpunit/tests/blocks/editor.php
r52942 r54088 29 29 ); 30 30 31 $post = $this->factory()->post->create_and_get( $args );31 $post = self::factory()->post->create_and_get( $args ); 32 32 33 33 global $wp_rest_server; -
trunk/tests/phpunit/tests/comment/checkComment.php
r53863 r54088 139 139 */ 140 140 public function test_should_return_true_when_comment_previously_approved_is_enabled_and_user_has_previously_approved_comments_with_different_email() { 141 $subscriber_id = $this->factory()->user->create(141 $subscriber_id = self::factory()->user->create( 142 142 array( 143 143 'role' => 'subscriber', … … 171 171 */ 172 172 public function test_should_return_false_when_comment_previously_approved_is_enabled_and_user_does_not_have_a_previously_approved_comment_with_any_email() { 173 $subscriber_id = $this->factory()->user->create(173 $subscriber_id = self::factory()->user->create( 174 174 array( 175 175 'role' => 'subscriber', -
trunk/tests/phpunit/tests/customize/control.php
r52010 r54088 27 27 public function set_up() { 28 28 parent::set_up(); 29 wp_set_current_user( $this->factory()->user->create( array( 'role' => 'administrator' ) ) );29 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 30 30 require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; 31 31 $GLOBALS['wp_customize'] = new WP_Customize_Manager(); … … 139 139 140 140 // Ensure that auto-draft pages are included if they are among the nav_menus_created_posts. 141 $auto_draft_page_id = $this->factory()->post->create(141 $auto_draft_page_id = self::factory()->post->create( 142 142 array( 143 143 'post_type' => 'page', … … 146 146 ) 147 147 ); 148 $this->factory()->post->create(148 self::factory()->post->create( 149 149 array( 150 150 'post_type' => 'page', … … 153 153 ) 154 154 ); 155 $auto_draft_post_id = $this->factory()->post->create(155 $auto_draft_post_id = self::factory()->post->create( 156 156 array( 157 157 'post_type' => 'post', -
trunk/tests/phpunit/tests/customize/custom-css-setting.php
r52010 r54088 121 121 122 122 $original_css = 'body { color: black; }'; 123 $post_id = $this->factory()->post->create(123 $post_id = self::factory()->post->create( 124 124 array( 125 125 'post_title' => $this->setting->stylesheet, … … 131 131 ); 132 132 $twentyten_css = 'body { color: red; }'; 133 $twentyten_post_id = $this->factory()->post->create(133 $twentyten_post_id = self::factory()->post->create( 134 134 array( 135 135 'post_title' => 'twentyten', … … 274 274 $this->assertSame( '/*default*//*filtered*/', $this->setting->value() ); 275 275 276 $this->factory()->post->create(276 self::factory()->post->create( 277 277 array( 278 278 'post_title' => $this->setting->stylesheet, … … 311 311 public function test_update_filter() { 312 312 $original_css = 'body { color:red; }'; 313 $post_id = $this->factory()->post->create(313 $post_id = self::factory()->post->create( 314 314 array( 315 315 'post_title' => $this->setting->stylesheet, -
trunk/tests/phpunit/tests/customize/manager.php
r53948 r54088 163 163 public function test_constructor_deferred_changeset_uuid() { 164 164 wp_set_current_user( self::$admin_user_id ); 165 $other_admin_user_id = $this->factory()->user->create( array( 'role' => 'admin' ) );165 $other_admin_user_id = self::factory()->user->create( array( 'role' => 'admin' ) ); 166 166 167 167 $data = array( … … 172 172 173 173 $uuid1 = wp_generate_uuid4(); 174 $this->factory()->post->create(174 self::factory()->post->create( 175 175 array( 176 176 'post_type' => 'customize_changeset', … … 188 188 */ 189 189 $uuid2 = wp_generate_uuid4(); 190 $post_id = $this->factory()->post->create(190 $post_id = self::factory()->post->create( 191 191 array( 192 192 'post_type' => 'customize_changeset', … … 425 425 public function test_find_changeset_post_id() { 426 426 $uuid = wp_generate_uuid4(); 427 $post_id = $this->factory()->post->create(427 $post_id = self::factory()->post->create( 428 428 array( 429 429 'post_name' => $uuid, … … 455 455 $uuid = wp_generate_uuid4(); 456 456 $wp_customize = new WP_Customize_Manager( array( 'changeset_uuid' => $uuid ) ); 457 $post_id = $this->factory()->post->create(457 $post_id = self::factory()->post->create( 458 458 array( 459 459 'post_name' => $uuid, … … 483 483 'blogdescription' => array( 'value' => 'Greet the world' ), 484 484 ); 485 $this->factory()->post->create(485 self::factory()->post->create( 486 486 array( 487 487 'post_name' => $uuid, … … 566 566 ) 567 567 ); 568 $existing_published_home_page_id = $this->factory()->post->create(568 $existing_published_home_page_id = self::factory()->post->create( 569 569 array( 570 570 'post_name' => 'home', … … 573 573 ) 574 574 ); 575 $existing_auto_draft_about_page_id = $this->factory()->post->create(575 $existing_auto_draft_about_page_id = self::factory()->post->create( 576 576 array( 577 577 'post_name' => 'about', … … 821 821 wp_set_current_user( self::$admin_user_id ); 822 822 823 $existing_published_home_page_id = $this->factory()->post->create(823 $existing_published_home_page_id = self::factory()->post->create( 824 824 array( 825 825 'post_name' => 'home', … … 1879 1879 array( 1880 1880 'autosave' => true, 1881 'user_id' => $this->factory()->user->create( array( 'role' => 'administrator' ) ),1881 'user_id' => self::factory()->user->create( array( 'role' => 'administrator' ) ), 1882 1882 ) 1883 1883 ); … … 2032 2032 $new_sidebar_1 = array_reverse( $new_sidebars_widgets['sidebar-1'] ); 2033 2033 2034 $post_id = $this->factory()->post->create(2034 $post_id = self::factory()->post->create( 2035 2035 array( 2036 2036 'post_type' => 'customize_changeset', … … 2336 2336 ), 2337 2337 ); 2338 $this->factory()->post->create(2338 self::factory()->post->create( 2339 2339 array( 2340 2340 'post_type' => 'customize_changeset', … … 2831 2831 $this->assertFalse( $this->manager->has_published_pages() ); 2832 2832 2833 $this->factory()->post->create(2833 self::factory()->post->create( 2834 2834 array( 2835 2835 'post_type' => 'page', … … 2839 2839 $this->assertFalse( $this->manager->has_published_pages() ); 2840 2840 2841 $this->factory()->post->create(2841 self::factory()->post->create( 2842 2842 array( 2843 2843 'post_type' => 'page', … … 2865 2865 $setting = $this->manager->get_setting( $setting_id ); 2866 2866 $this->assertInstanceOf( 'WP_Customize_Filter_Setting', $setting ); 2867 $auto_draft_page = $this->factory()->post->create(2867 $auto_draft_page = self::factory()->post->create( 2868 2868 array( 2869 2869 'post_type' => 'page', -
trunk/tests/phpunit/tests/customize/nav-menus.php
r52010 r54088 852 852 public function test_sanitize_nav_menus_created_posts() { 853 853 $menus = new WP_Customize_Nav_Menus( $this->wp_customize ); 854 $contributor_user_id = $this->factory()->user->create( array( 'role' => 'contributor' ) );855 $author_user_id = $this->factory()->user->create( array( 'role' => 'author' ) );856 $administrator_user_id = $this->factory()->user->create( array( 'role' => 'administrator' ) );857 858 $contributor_post_id = $this->factory()->post->create(854 $contributor_user_id = self::factory()->user->create( array( 'role' => 'contributor' ) ); 855 $author_user_id = self::factory()->user->create( array( 'role' => 'author' ) ); 856 $administrator_user_id = self::factory()->user->create( array( 'role' => 'administrator' ) ); 857 858 $contributor_post_id = self::factory()->post->create( 859 859 array( 860 860 'post_status' => 'auto-draft', … … 864 864 ) 865 865 ); 866 $author_post_id = $this->factory()->post->create(866 $author_post_id = self::factory()->post->create( 867 867 array( 868 868 'post_status' => 'auto-draft', … … 872 872 ) 873 873 ); 874 $administrator_post_id = $this->factory()->post->create(874 $administrator_post_id = self::factory()->post->create( 875 875 array( 876 876 'post_status' => 'auto-draft', … … 881 881 ); 882 882 883 $draft_post_id = $this->factory()->post->create(883 $draft_post_id = self::factory()->post->create( 884 884 array( 885 885 'post_status' => 'draft', … … 889 889 ); 890 890 891 $private_post_id = $this->factory()->post->create(891 $private_post_id = self::factory()->post->create( 892 892 array( 893 893 'post_status' => 'private', … … 991 991 $trashed_post_id = $r->ID; 992 992 993 $pre_published_post_id = $this->factory()->post->create( array( 'post_status' => 'publish' ) );993 $pre_published_post_id = self::factory()->post->create( array( 'post_status' => 'publish' ) ); 994 994 995 995 $setting_id = 'nav_menus_created_posts'; -
trunk/tests/phpunit/tests/customize/setting.php
r52010 r54088 138 138 */ 139 139 public function test_preview_standard_types_non_multidimensional() { 140 wp_set_current_user( $this->factory()->user->create( array( 'role' => 'administrator' ) ) );140 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 141 141 $_POST['customized'] = wp_slash( wp_json_encode( $this->post_data_overrides ) ); 142 142 … … 217 217 */ 218 218 public function test_preview_standard_types_multidimensional() { 219 wp_set_current_user( $this->factory()->user->create( array( 'role' => 'administrator' ) ) );219 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 220 220 $_POST['customized'] = wp_slash( wp_json_encode( $this->post_data_overrides ) ); 221 221 … … 363 363 */ 364 364 public function test_preview_custom_type() { 365 wp_set_current_user( $this->factory()->user->create( array( 'role' => 'administrator' ) ) );365 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 366 366 $type = 'custom_type'; 367 367 $post_data_overrides = array( … … 552 552 */ 553 553 public function test_is_current_blog_previewed() { 554 wp_set_current_user( $this->factory()->user->create( array( 'role' => 'administrator' ) ) );554 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 555 555 $type = 'option'; 556 556 $name = 'blogname'; … … 744 744 */ 745 745 public function test_multidimensional_value_when_previewed() { 746 wp_set_current_user( $this->factory()->user->create( array( 'role' => 'administrator' ) ) );746 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 747 747 WP_Customize_Setting::reset_aggregated_multidimensionals(); 748 748 -
trunk/tests/phpunit/tests/feed/rss2.php
r54050 r54088 523 523 524 524 // Create a post dated last week. 525 $post_id = $this->factory()->post->create( array( 'post_date' => $last_week ) );525 $post_id = self::factory()->post->create( array( 'post_date' => $last_week ) ); 526 526 527 527 // Create a comment dated yesterday. 528 $this->factory()->comment->create(528 self::factory()->comment->create( 529 529 array( 530 530 'comment_post_ID' => $post_id, … … 562 562 563 563 // Create a post dated last week. 564 $post_id = $this->factory()->post->create( array( 'post_date' => $last_week ) );564 $post_id = self::factory()->post->create( array( 'post_date' => $last_week ) ); 565 565 566 566 // Create a comment dated yesterday. 567 $this->factory()->comment->create(567 self::factory()->comment->create( 568 568 array( 569 569 'comment_post_ID' => $post_id, … … 602 602 603 603 // Create a post dated last week. 604 $post_id = $this->factory()->post->create( array( 'post_date' => $last_week ) );604 $post_id = self::factory()->post->create( array( 'post_date' => $last_week ) ); 605 605 606 606 // Create a comment dated yesterday. 607 $this->factory()->comment->create(607 self::factory()->comment->create( 608 608 array( 609 609 'comment_post_ID' => $post_id, … … 613 613 614 614 // Create a post dated today. 615 $this->factory()->post->create( array( 'post_date' => $today ) );615 self::factory()->post->create( array( 'post_date' => $today ) ); 616 616 617 617 // The Last-Modified header should have the date from today's post when it is the latest update. -
trunk/tests/phpunit/tests/formatting/excerptRemoveBlocks.php
r53562 r54088 61 61 public function set_up() { 62 62 parent::set_up(); 63 self::$post_id = $this->factory()->post->create(63 self::$post_id = self::factory()->post->create( 64 64 array( 65 65 'post_excerpt' => '', // Empty excerpt, so it has to be generated. -
trunk/tests/phpunit/tests/formatting/wpTargetedLinkRel.php
r53562 r54088 90 90 $expected = '<p>Links: <a href="/" target="_blank" rel="noopener">No rel</a></p>'; 91 91 92 $post = $this->factory()->post->create_and_get(92 $post = self::factory()->post->create_and_get( 93 93 array( 94 94 'post_content' => $content, -
trunk/tests/phpunit/tests/general/template.php
r53774 r54088 181 181 public function test_customize_preview_wp_site_icon_empty() { 182 182 global $wp_customize; 183 wp_set_current_user( $this->factory()->user->create( array( 'role' => 'administrator' ) ) );183 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 184 184 185 185 require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; … … 199 199 public function test_customize_preview_wp_site_icon_dirty() { 200 200 global $wp_customize; 201 wp_set_current_user( $this->factory()->user->create( array( 'role' => 'administrator' ) ) );201 wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); 202 202 203 203 require_once ABSPATH . WPINC . '/class-wp-customize-manager.php'; … … 599 599 */ 600 600 public function test_get_the_archive_title_is_correct_for_author_queries() { 601 $user_with_posts = $this->factory()->user->create_and_get(601 $user_with_posts = self::factory()->user->create_and_get( 602 602 array( 603 603 'role' => 'author', 604 604 ) 605 605 ); 606 $user_with_no_posts = $this->factory()->user->create_and_get(606 $user_with_no_posts = self::factory()->user->create_and_get( 607 607 array( 608 608 'role' => 'author', … … 610 610 ); 611 611 612 $this->factory()->post->create(612 self::factory()->post->create( 613 613 array( 614 614 'post_author' => $user_with_posts->ID, -
trunk/tests/phpunit/tests/l10n.php
r53866 r54088 310 310 ); 311 311 312 $post = $this->factory()->post->create_and_get( $args );312 $post = self::factory()->post->create_and_get( $args ); 313 313 setup_postdata( $post ); 314 314 … … 336 336 ); 337 337 338 $post = $this->factory()->post->create_and_get( $args );338 $post = self::factory()->post->create_and_get( $args ); 339 339 setup_postdata( $post ); 340 340 … … 362 362 ); 363 363 364 $post = $this->factory()->post->create_and_get( $args );364 $post = self::factory()->post->create_and_get( $args ); 365 365 setup_postdata( $post ); 366 366 … … 388 388 ); 389 389 390 $post = $this->factory()->post->create_and_get( $args );390 $post = self::factory()->post->create_and_get( $args ); 391 391 setup_postdata( $post ); 392 392 … … 414 414 ); 415 415 416 $post = $this->factory()->post->create_and_get( $args );416 $post = self::factory()->post->create_and_get( $args ); 417 417 setup_postdata( $post ); 418 418 … … 442 442 ); 443 443 444 $this->factory()->post->create( $args );444 self::factory()->post->create( $args ); 445 445 446 446 $expect = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do…'; … … 468 468 ); 469 469 470 $post = $this->factory()->post->create( $args );470 $post = self::factory()->post->create( $args ); 471 471 472 472 $expect = 'Lorem ipsum dolor sit amet, consectetur …'; … … 494 494 ); 495 495 496 $this->factory()->post->create( $args );496 self::factory()->post->create( $args ); 497 497 498 498 $expect = str_repeat( 'あ', 40 ) . '…'; … … 515 515 'comment_content' => $this->long_text, 516 516 ); 517 $comment_id = $this->factory()->comment->create( $args );517 $comment_id = self::factory()->comment->create( $args ); 518 518 $expect = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut…'; 519 519 $comment_excerpt = get_comment_excerpt( $comment_id ); … … 535 535 'comment_content' => $this->long_text, 536 536 ); 537 $comment_id = $this->factory()->comment->create( $args );537 $comment_id = self::factory()->comment->create( $args ); 538 538 $expect = 'Lorem ipsum dolor sit amet, consectetur …'; 539 539 $comment_excerpt = get_comment_excerpt( $comment_id ); … … 555 555 'comment_content' => str_repeat( 'あ', 200 ), 556 556 ); 557 $comment_id = $this->factory()->comment->create( $args );557 $comment_id = self::factory()->comment->create( $args ); 558 558 $expect = str_repeat( 'あ', 40 ) . '…'; 559 559 $comment_excerpt = get_comment_excerpt( $comment_id ); -
trunk/tests/phpunit/tests/l10n/getUserLocale.php
r53866 r54088 13 13 parent::set_up(); 14 14 15 $this->user_id = $this->factory()->user->create(15 $this->user_id = self::factory()->user->create( 16 16 array( 17 17 'role' => 'administrator', … … 83 83 84 84 public function test_user_id_argument_with_id() { 85 $user_id = $this->factory()->user->create(85 $user_id = self::factory()->user->create( 86 86 array( 87 87 'locale' => 'es_ES', … … 100 100 101 101 public function test_user_id_argument_with_wp_user_object() { 102 $user_id = $this->factory()->user->create(102 $user_id = self::factory()->user->create( 103 103 array( 104 104 'locale' => 'es_ES', -
trunk/tests/phpunit/tests/l10n/wpLocaleSwitcher.php
r53874 r54088 327 327 $site_locale = get_locale(); 328 328 329 $user_id = $this->factory()->user->create(329 $user_id = self::factory()->user->create( 330 330 array( 331 331 'role' => 'administrator', … … 379 379 $site_locale = get_locale(); 380 380 381 $user_id = $this->factory()->user->create(381 $user_id = self::factory()->user->create( 382 382 array( 383 383 'role' => 'administrator', … … 431 431 $site_locale = get_locale(); 432 432 433 $user_id = $this->factory()->user->create(433 $user_id = self::factory()->user->create( 434 434 array( 435 435 'role' => 'administrator', -
trunk/tests/phpunit/tests/multisite/network.php
r53011 r54088 562 562 $this->assertNull( get_network( $new_network_id ) ); 563 563 564 $new_network = $this->factory()->network->create_and_get();564 $new_network = self::factory()->network->create_and_get(); 565 565 566 566 // Double-check we got the ID of the new network correct. -
trunk/tests/phpunit/tests/multisite/site.php
r52010 r54088 2460 2460 $this->assertNull( get_site( $new_site_id ) ); 2461 2461 2462 $new_site = $this->factory()->blog->create_and_get();2462 $new_site = self::factory()->blog->create_and_get(); 2463 2463 2464 2464 // Double-check we got the ID of the new site correct. -
trunk/tests/phpunit/tests/oembed/WpEmbed.php
r51568 r54088 29 29 30 30 public function test_maybe_run_ajax_cache_should_return_nothing_if_there_is_no_message() { 31 $GLOBALS['post'] = $this->factory()->post->create_and_get(31 $GLOBALS['post'] = self::factory()->post->create_and_get( 32 32 array( 33 33 'post_title' => 'Hello World', … … 42 42 43 43 public function test_maybe_run_ajax_cache_should_return_javascript() { 44 $GLOBALS['post'] = $this->factory()->post->create_and_get(44 $GLOBALS['post'] = self::factory()->post->create_and_get( 45 45 array( 46 46 'post_title' => 'Hello World', … … 135 135 136 136 public function test_delete_oembed_caches() { 137 $post_id = $this->factory()->post->create();137 $post_id = self::factory()->post->create(); 138 138 139 139 add_post_meta( $post_id, '_oembed_foo', 'bar' ); … … 148 148 149 149 public function test_cache_oembed_invalid_post_type() { 150 $post_id = $this->factory()->post->create( array( 'post_type' => 'nav_menu_item' ) );150 $post_id = self::factory()->post->create( array( 'post_type' => 'nav_menu_item' ) ); 151 151 152 152 $this->wp_embed->cache_oembed( $post_id ); … … 155 155 156 156 public function test_cache_oembed_empty_content() { 157 $post_id = $this->factory()->post->create( array( 'post_content' => '' ) );157 $post_id = self::factory()->post->create( array( 'post_content' => '' ) ); 158 158 159 159 $this->wp_embed->cache_oembed( $post_id ); … … 168 168 $cachekey_time = '_oembed_time_' . $key_suffix; 169 169 170 $post_id = $this->factory()->post->create( array( 'post_content' => 'https://example.com/' ) );170 $post_id = self::factory()->post->create( array( 'post_content' => 'https://example.com/' ) ); 171 171 172 172 add_filter( 'pre_oembed_result', array( $this, '_pre_oembed_result_callback' ) ); … … 182 182 global $post; 183 183 184 $post = $this->factory()->post->create_and_get();184 $post = self::factory()->post->create_and_get(); 185 185 $url = 'https://example.com/'; 186 186 $expected = '<b>Embedded content</b>'; … … 209 209 global $post; 210 210 211 $post = $this->factory()->post->create_and_get();211 $post = self::factory()->post->create_and_get(); 212 212 $url = 'https://example.com/'; 213 213 $expected = '<a href="' . esc_url( $url ) . '">' . esc_html( $url ) . '</a>'; -
trunk/tests/phpunit/tests/oembed/controller.php
r52010 r54088 291 291 292 292 public function test_request_invalid_format() { 293 $post_id = $this->factory()->post->create();293 $post_id = self::factory()->post->create(); 294 294 295 295 $request = new WP_REST_Request( 'GET', '/oembed/1.0/embed' ); … … 462 462 463 463 public function test_rest_pre_serve_request() { 464 $user = $this->factory()->user->create_and_get(464 $user = self::factory()->user->create_and_get( 465 465 array( 466 466 'display_name' => 'John Doe', 467 467 ) 468 468 ); 469 $post = $this->factory()->post->create_and_get(469 $post = self::factory()->post->create_and_get( 470 470 array( 471 471 'post_author' => $user->ID, … … 486 486 487 487 public function test_rest_pre_serve_request_wrong_format() { 488 $post = $this->factory()->post->create_and_get();488 $post = self::factory()->post->create_and_get(); 489 489 490 490 $request = new WP_REST_Request( 'GET', '/oembed/1.0/embed' ); … … 498 498 499 499 public function test_rest_pre_serve_request_wrong_method() { 500 $post = $this->factory()->post->create_and_get();500 $post = self::factory()->post->create_and_get(); 501 501 502 502 $request = new WP_REST_Request( 'HEAD', '/oembed/1.0/embed' ); … … 514 514 $this->assertSame( home_url() . '/index.php?rest_route=/oembed/1.0/embed', get_oembed_endpoint_url( '', 'xml' ) ); 515 515 516 $post_id = $this->factory()->post->create();516 $post_id = self::factory()->post->create(); 517 517 $url = get_permalink( $post_id ); 518 518 $url_encoded = urlencode( $url ); … … 528 528 $this->assertSame( home_url() . '/wp-json/oembed/1.0/embed', get_oembed_endpoint_url( '', 'xml' ) ); 529 529 530 $post_id = $this->factory()->post->create();530 $post_id = self::factory()->post->create(); 531 531 $url = get_permalink( $post_id ); 532 532 $url_encoded = urlencode( $url ); -
trunk/tests/phpunit/tests/oembed/headers.php
r52010 r54088 14 14 */ 15 15 public function test_rest_pre_serve_request_headers() { 16 $post = $this->factory()->post->create_and_get(16 $post = self::factory()->post->create_and_get( 17 17 array( 18 18 'post_title' => 'Hello World', -
trunk/tests/phpunit/tests/post.php
r54068 r54088 727 727 public function test_use_block_editor_for_post() { 728 728 $this->assertFalse( use_block_editor_for_post( -1 ) ); 729 $bogus_post_id = $this->factory()->post->create(729 $bogus_post_id = self::factory()->post->create( 730 730 array( 731 731 'post_type' => 'bogus', … … 740 740 ) 741 741 ); 742 $restless_post_id = $this->factory()->post->create(742 $restless_post_id = self::factory()->post->create( 743 743 array( 744 744 'post_type' => 'restless', … … 747 747 $this->assertFalse( use_block_editor_for_post( $restless_post_id ) ); 748 748 749 $generic_post_id = $this->factory()->post->create();749 $generic_post_id = self::factory()->post->create(); 750 750 751 751 add_filter( 'use_block_editor_for_post', '__return_false' ); -
trunk/tests/phpunit/tests/post/isPostPubliclyViewable.php
r51587 r54088 55 55 } 56 56 57 $post_id = $this->factory()->post->create(57 $post_id = self::factory()->post->create( 58 58 array( 59 59 'post_type' => $post_type, -
trunk/tests/phpunit/tests/post/nav-menu.php
r53510 r54088 746 746 */ 747 747 public function test_wp_delete_customize_changeset_dependent_auto_drafts() { 748 $auto_draft_post_id = $this->factory()->post->create(748 $auto_draft_post_id = self::factory()->post->create( 749 749 array( 750 750 'post_status' => 'auto-draft', 751 751 ) 752 752 ); 753 $draft_post_id = $this->factory()->post->create(753 $draft_post_id = self::factory()->post->create( 754 754 array( 755 755 'post_status' => 'draft', 756 756 ) 757 757 ); 758 $private_post_id = $this->factory()->post->create(758 $private_post_id = self::factory()->post->create( 759 759 array( 760 760 'post_status' => 'private', -
trunk/tests/phpunit/tests/post/wpInsertPost.php
r53883 r54088 1426 1426 wp_set_current_user( self::$user_ids['contributor'] ); 1427 1427 1428 $post_id = $this->factory()->post->create(1428 $post_id = self::factory()->post->create( 1429 1429 array( 1430 1430 'post_title' => 'Jefferson claim: nice to have Washington on your side.', … … 1465 1465 wp_set_current_user( self::$user_ids['administrator'] ); 1466 1466 1467 $post_id = $this->factory()->post->create(1467 $post_id = self::factory()->post->create( 1468 1468 array( 1469 1469 'post_title' => 'What is the Conner Project?', … … 1506 1506 wp_set_current_user( self::$user_ids['administrator'] ); 1507 1507 1508 $post_id = $this->factory()->post->create(1508 $post_id = self::factory()->post->create( 1509 1509 array( 1510 1510 'post_title' => 'Everything is legal in New Jersey', … … 1543 1543 $now = new DateTimeImmutable( 'now', new DateTimeZone( 'UTC' ) ); 1544 1544 1545 $post_id = $this->factory()->post->create(1545 $post_id = self::factory()->post->create( 1546 1546 array( 1547 1547 'post_date_gmt' => $now->modify( '-1 year' )->format( 'Y-m-d H:i:s' ), … … 1552 1552 $this->assertSame( 'publish', get_post_status( $post_id ) ); 1553 1553 1554 $post_id = $this->factory()->post->create(1554 $post_id = self::factory()->post->create( 1555 1555 array( 1556 1556 'post_date_gmt' => $now->modify( '+50 years' )->format( 'Y-m-d H:i:s' ), -
trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php
r54055 r54088 5257 5257 public function test_draft_post_does_not_have_the_same_slug_as_existing_post() { 5258 5258 wp_set_current_user( self::$editor_id ); 5259 $this->factory()->post->create( array( 'post_name' => 'sample-slug' ) );5259 self::factory()->post->create( array( 'post_name' => 'sample-slug' ) ); 5260 5260 5261 5261 $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', self::$post_id ) ); -
trunk/tests/phpunit/tests/rest-api/wpRestBlockPatternCategoriesController.php
r54058 r54088 137 137 public function test_get_items_forbidden() { 138 138 // Set current user without `edit_posts` capability. 139 wp_set_current_user( $this->factory()->user->create( array( 'role' => 'subscriber' ) ) );139 wp_set_current_user( self::factory()->user->create( array( 'role' => 'subscriber' ) ) ); 140 140 141 141 $request = new WP_REST_Request( 'GET', static::REQUEST_ROUTE ); -
trunk/tests/phpunit/tests/rest-api/wpRestBlockPatternsController.php
r54058 r54088 163 163 public function test_get_items_forbidden() { 164 164 // Set current user without `edit_posts` capability. 165 wp_set_current_user( $this->factory()->user->create( array( 'role' => 'subscriber' ) ) );165 wp_set_current_user( self::factory()->user->create( array( 'role' => 'subscriber' ) ) ); 166 166 167 167 $request = new WP_REST_Request( 'GET', static::REQUEST_ROUTE ); -
trunk/tests/phpunit/tests/term/isTermPubliclyViewable.php
r53894 r54088 26 26 */ 27 27 public function test_is_term_publicly_viewable( $taxonomy, $expected ) { 28 $term_id = $this->factory()->term->create(28 $term_id = self::factory()->term->create( 29 29 array( 30 30 'taxonomy' => $taxonomy, -
trunk/tests/phpunit/tests/term/termCounts.php
r52010 r54088 91 91 $term_count = get_term( get_option( 'default_category' ) )->count; 92 92 // Do not use shared fixture for this test as it relies on a new post. 93 $post_id = $this->factory()->post->create( array( 'post_status' => $post_status ) );93 $post_id = self::factory()->post->create( array( 'post_status' => $post_status ) ); 94 94 95 95 $expected = $term_count + $change; … … 245 245 add_filter( 'update_post_term_count_statuses', array( $this, 'add_custom_status_to_counted_statuses' ) ); 246 246 247 $post_id = $this->factory()->post->create( array( 'post_status' => $post_status ) );247 $post_id = self::factory()->post->create( array( 'post_status' => $post_status ) ); 248 248 wp_add_object_terms( $post_id, self::$attachment_term, 'wp_test_tax_counts' ); 249 249 $attachment_id = self::factory()->attachment->create_object( … … 297 297 $term_count = get_term( self::$attachment_term )->count; 298 298 // Do not use shared fixture for this test as it relies on a new post. 299 $post_id = $this->factory()->post->create( array( 'post_status' => $post_status ) );299 $post_id = self::factory()->post->create( array( 'post_status' => $post_status ) ); 300 300 wp_add_object_terms( $post_id, self::$attachment_term, 'wp_test_tax_counts' ); 301 301 $attachment_id = self::factory()->attachment->create_object( -
trunk/tests/phpunit/tests/theme.php
r54040 r54088 367 367 */ 368 368 public function test_wp_keep_alive_customize_changeset_dependent_auto_drafts() { 369 $nav_created_post_ids = $this->factory()->post->create_many(369 $nav_created_post_ids = self::factory()->post->create_many( 370 370 2, 371 371 array( -
trunk/tests/phpunit/tests/user.php
r53818 r54088 1697 1697 $was_confirmation_email_sent = false; 1698 1698 1699 $user = $this->factory()->user->create_and_get(1699 $user = self::factory()->user->create_and_get( 1700 1700 array( 1701 1701 'user_email' => 'before@example.com', … … 1734 1734 $was_confirmation_email_sent = false; 1735 1735 1736 $user = $this->factory()->user->create_and_get(1736 $user = self::factory()->user->create_and_get( 1737 1737 array( 1738 1738 'user_email' => 'before@example.com', -
trunk/tests/phpunit/tests/widgets/wpWidgetCustomHtml.php
r52248 r54088 173 173 174 174 wp_set_current_user( 175 $this->factory()->user->create(175 self::factory()->user->create( 176 176 array( 177 177 'role' => 'administrator', … … 242 242 */ 243 243 public function test_enqueue_admin_scripts_when_logged_in_and_syntax_highlighting_on() { 244 $user = $this->factory()->user->create();244 $user = self::factory()->user->create(); 245 245 wp_set_current_user( $user ); 246 246 wp_get_current_user()->syntax_highlighting = 'true'; … … 263 263 */ 264 264 public function test_enqueue_admin_scripts_when_logged_in_and_syntax_highlighting_off() { 265 $user = $this->factory()->user->create();265 $user = self::factory()->user->create(); 266 266 wp_set_current_user( $user ); 267 267 update_user_meta( $user, 'syntax_highlighting', 'false' ); -
trunk/tests/phpunit/tests/widgets/wpWidgetMedia.php
r52248 r54088 117 117 global $wp_customize; 118 118 wp_set_current_user( 119 $this->factory()->user->create(119 self::factory()->user->create( 120 120 array( 121 121 'role' => 'administrator', … … 160 160 $this->assertFalse( $widget->is_attachment_with_mime_type( -123, 'image' ) ); 161 161 162 $post_id = $this->factory()->post->create();162 $post_id = self::factory()->post->create(); 163 163 $this->assertFalse( $widget->is_attachment_with_mime_type( $post_id, 'image' ) ); 164 164 $this->assertFalse( $widget->is_attachment_with_mime_type( $attachment_id, 'video' ) ); -
trunk/tests/phpunit/tests/widgets/wpWidgetText.php
r52010 r54088 82 82 global $wp_customize; 83 83 wp_set_current_user( 84 $this->factory()->user->create(84 self::factory()->user->create( 85 85 array( 86 86 'role' => 'administrator', … … 316 316 public function test_widget_shortcodes() { 317 317 global $post; 318 $post_id = $this->factory()->post->create();318 $post_id = self::factory()->post->create(); 319 319 $post = get_post( $post_id ); 320 320 … … 717 717 718 718 wp_set_current_user( 719 $this->factory()->user->create(719 self::factory()->user->create( 720 720 array( 721 721 'role' => 'administrator',
Note: See TracChangeset
for help on using the changeset viewer.