-
From 9adb06afbb99ff5cff8b4398e4200460f7919852 Mon Sep 17 00:00:00 2001
From: GITUSER <hudson@inboundnow.com>
Date: Thu, 24 Sep 2020 18:25:50 -0500
Subject: [PATCH] tests/admin
---
tests/phpunit/tests/admin/includesMisc.php | 3 ++
tests/phpunit/tests/admin/includesPlugin.php | 22 ++++++++++
tests/phpunit/tests/admin/includesPost.php | 59 ++++++++++++++++++++++++++
tests/phpunit/tests/admin/includesSchema.php | 3 ++
tests/phpunit/tests/admin/includesScreen.php | 53 +++++++++++++++++++++++
tests/phpunit/tests/admin/includesTemplate.php | 17 ++++++++
tests/phpunit/tests/admin/includesTheme.php | 8 ++++
7 files changed, 165 insertions(+)
diff --git a/tests/phpunit/tests/admin/includesMisc.php b/tests/phpunit/tests/admin/includesMisc.php
index 93951af..a6bf413 100644
|
a
|
b
|
|
| 4 | 4 | * @group admin |
| 5 | 5 | */ |
| 6 | 6 | class Tests_Admin_includesMisc extends WP_UnitTestCase { |
| | 7 | /** |
| | 8 | * @covers ::shorten_url |
| | 9 | */ |
| 7 | 10 | function test_shorten_url() { |
| 8 | 11 | $tests = array( |
| 9 | 12 | 'wordpress\.org/about/philosophy' |
-
diff --git a/tests/phpunit/tests/admin/includesPlugin.php b/tests/phpunit/tests/admin/includesPlugin.php
index 310173b..0d9e532 100644
|
a
|
b
|
|
| 4 | 4 | * @group admin |
| 5 | 5 | */ |
| 6 | 6 | class Tests_Admin_includesPlugin extends WP_UnitTestCase { |
| | 7 | |
| | 8 | /** |
| | 9 | * @covers ::get_plugin_data |
| | 10 | */ |
| 7 | 11 | function test_get_plugin_data() { |
| 8 | 12 | $data = get_plugin_data( DIR_TESTDATA . '/plugins/hello.php' ); |
| 9 | 13 | |
| … |
… |
class Tests_Admin_includesPlugin extends WP_UnitTestCase { |
| 27 | 31 | } |
| 28 | 32 | } |
| 29 | 33 | |
| | 34 | /** |
| | 35 | * @covers ::menu_page_url |
| | 36 | */ |
| 30 | 37 | function test_menu_page_url() { |
| 31 | 38 | $current_user = get_current_user_id(); |
| 32 | 39 | wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) ); |
| … |
… |
class Tests_Admin_includesPlugin extends WP_UnitTestCase { |
| 259 | 266 | * Test that when a submenu has the same slug as a parent item, that it's just appended and ignores the priority. |
| 260 | 267 | * |
| 261 | 268 | * @ticket 48599 |
| | 269 | * @covers ::add_submenu_page |
| | 270 | * |
| 262 | 271 | */ |
| 263 | 272 | function test_priority_when_parent_slug_child_slug_are_the_same() { |
| 264 | 273 | global $submenu, $menu; |
| … |
… |
class Tests_Admin_includesPlugin extends WP_UnitTestCase { |
| 291 | 300 | * Passing a string as priority will fail. |
| 292 | 301 | * |
| 293 | 302 | * @ticket 48599 |
| | 303 | * @covers ::add_submenu_page |
| 294 | 304 | */ |
| 295 | 305 | function test_passing_string_as_priority_fires_doing_it_wrong() { |
| 296 | 306 | $this->setExpectedIncorrectUsage( 'add_submenu_page' ); |
| … |
… |
class Tests_Admin_includesPlugin extends WP_UnitTestCase { |
| 316 | 326 | $this->assertSame( 'submenu_page_1', $submenu['main_slug'][1][2] ); |
| 317 | 327 | } |
| 318 | 328 | |
| | 329 | /** |
| | 330 | * @covers ::is_plugin_active |
| | 331 | */ |
| 319 | 332 | function test_is_plugin_active_true() { |
| 320 | 333 | activate_plugin( 'hello.php' ); |
| 321 | 334 | $test = is_plugin_active( 'hello.php' ); |
| … |
… |
class Tests_Admin_includesPlugin extends WP_UnitTestCase { |
| 324 | 337 | deactivate_plugins( 'hello.php' ); |
| 325 | 338 | } |
| 326 | 339 | |
| | 340 | /** |
| | 341 | * @covers ::is_plugin_active |
| | 342 | */ |
| 327 | 343 | function test_is_plugin_active_false() { |
| 328 | 344 | deactivate_plugins( 'hello.php' ); |
| 329 | 345 | $test = is_plugin_active( 'hello.php' ); |
| 330 | 346 | $this->assertFalse( $test ); |
| 331 | 347 | } |
| 332 | 348 | |
| | 349 | /** |
| | 350 | * @covers ::is_plugin_inactive |
| | 351 | */ |
| 333 | 352 | function test_is_plugin_inactive_true() { |
| 334 | 353 | deactivate_plugins( 'hello.php' ); |
| 335 | 354 | $test = is_plugin_inactive( 'hello.php' ); |
| 336 | 355 | $this->assertTrue( $test ); |
| 337 | 356 | } |
| 338 | 357 | |
| | 358 | /** |
| | 359 | * @covers ::is_plugin_inactive |
| | 360 | */ |
| 339 | 361 | function test_is_plugin_inactive_false() { |
| 340 | 362 | activate_plugin( 'hello.php' ); |
| 341 | 363 | $test = is_plugin_inactive( 'hello.php' ); |
-
diff --git a/tests/phpunit/tests/admin/includesPost.php b/tests/phpunit/tests/admin/includesPost.php
index fcb74ce..ec1dddd 100644
|
a
|
b
|
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 26 | 26 | self::$post_id = $factory->post->create(); |
| 27 | 27 | } |
| 28 | 28 | |
| | 29 | /** |
| | 30 | * @covers ::_wp_translate_postdata |
| | 31 | */ |
| 29 | 32 | function test__wp_translate_postdata_cap_checks_contributor() { |
| 30 | 33 | wp_set_current_user( self::$contributor_id ); |
| 31 | 34 | |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 76 | 79 | $this->assertSame( 'Sorry, you are not allowed to edit posts as this user.', $_results->get_error_message() ); |
| 77 | 80 | } |
| 78 | 81 | |
| | 82 | /** |
| | 83 | * @covers ::_wp_translate_postdata |
| | 84 | */ |
| 79 | 85 | function test__wp_translate_postdata_cap_checks_editor() { |
| 80 | 86 | wp_set_current_user( self::$editor_id ); |
| 81 | 87 | |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 130 | 136 | * edit_post() should convert an existing auto-draft to a draft. |
| 131 | 137 | * |
| 132 | 138 | * @ticket 25272 |
| | 139 | * @covers ::edit_post |
| 133 | 140 | */ |
| 134 | 141 | function test_edit_post_auto_draft() { |
| 135 | 142 | wp_set_current_user( self::$editor_id ); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 147 | 154 | |
| 148 | 155 | /** |
| 149 | 156 | * @ticket 30615 |
| | 157 | * @covers ::edit_post |
| 150 | 158 | */ |
| 151 | 159 | public function test_edit_post_should_parse_tax_input_by_name_rather_than_slug_for_nonhierarchical_taxonomies() { |
| 152 | 160 | wp_set_current_user( self::$editor_id ); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 187 | 195 | |
| 188 | 196 | /** |
| 189 | 197 | * @ticket 30615 |
| | 198 | * @covers ::edit_post |
| 190 | 199 | */ |
| 191 | 200 | public function test_edit_post_should_not_create_terms_for_an_empty_tag_input_field() { |
| 192 | 201 | wp_set_current_user( self::$editor_id ); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 216 | 225 | |
| 217 | 226 | /** |
| 218 | 227 | * @ticket 27792 |
| | 228 | * @covers ::bulk_edit_posts |
| 219 | 229 | */ |
| 220 | 230 | public function test_bulk_edit_posts_stomping() { |
| 221 | 231 | wp_set_current_user( self::$admin_id ); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 263 | 273 | * when it's unchanged. |
| 264 | 274 | * |
| 265 | 275 | * @ticket 44914 |
| | 276 | * @covers ::bulk_edit_posts |
| 266 | 277 | */ |
| 267 | 278 | public function test_bulk_edit_posts_should_preserve_post_format_when_unchanged() { |
| 268 | 279 | wp_set_current_user( self::$admin_id ); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 295 | 306 | |
| 296 | 307 | /** |
| 297 | 308 | * @ticket 41396 |
| | 309 | * @covers ::bulk_edit_posts |
| 298 | 310 | */ |
| 299 | 311 | public function test_bulk_edit_posts_should_set_post_format_before_wp_update_post_runs() { |
| 300 | 312 | wp_set_current_user( self::$admin_id ); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 320 | 332 | |
| 321 | 333 | /** |
| 322 | 334 | * @ticket 38293 |
| | 335 | * @covers ::edit_post |
| 323 | 336 | */ |
| 324 | 337 | public function test_user_cant_delete_protected_meta() { |
| 325 | 338 | $protected_meta_key = '_test_meta_data_that_is_protected'; |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 354 | 367 | |
| 355 | 368 | /** |
| 356 | 369 | * @ticket 30910 |
| | 370 | * @covers ::get_sample_permalink |
| 357 | 371 | */ |
| 358 | 372 | public function test_get_sample_permalink_should_return_pretty_permalink_for_posts_with_post_status_future() { |
| 359 | 373 | $permalink_structure = '%postname%'; |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 377 | 391 | /** |
| 378 | 392 | * @ticket 30910 |
| 379 | 393 | * @ticket 18306 |
| | 394 | * @covers ::get_sample_permalink_html |
| 380 | 395 | */ |
| 381 | 396 | public function test_get_sample_permalink_html_should_use_default_permalink_for_view_post_link_when_pretty_permalinks_are_disabled() { |
| 382 | 397 | wp_set_current_user( self::$admin_id ); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 398 | 413 | /** |
| 399 | 414 | * @ticket 30910 |
| 400 | 415 | * @ticket 18306 |
| | 416 | * @covers ::get_sample_permalink_html |
| 401 | 417 | */ |
| 402 | 418 | public function test_get_sample_permalink_html_should_use_pretty_permalink_for_view_post_link_when_pretty_permalinks_are_enabled() { |
| 403 | 419 | $this->set_permalink_structure( '/%postname%/' ); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 421 | 437 | |
| 422 | 438 | /** |
| 423 | 439 | * @ticket 35980 |
| | 440 | * @covers ::get_sample_permalink_html |
| 424 | 441 | */ |
| 425 | 442 | public function test_get_sample_permalink_html_should_use_pretty_permalink_for_view_attachment_link_when_pretty_permalinks_are_enabled() { |
| 426 | 443 | $this->set_permalink_structure( '/%postname%/' ); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 447 | 464 | /** |
| 448 | 465 | * @ticket 32954 |
| 449 | 466 | * @ticket 18306 |
| | 467 | * @covers ::get_sample_permalink_html |
| 450 | 468 | */ |
| 451 | 469 | public function test_get_sample_permalink_html_should_use_correct_permalink_for_view_post_link_when_changing_slug() { |
| 452 | 470 | $this->set_permalink_structure( '/%postname%/' ); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 505 | 523 | /** |
| 506 | 524 | * @ticket 30910 |
| 507 | 525 | * @ticket 18306 |
| | 526 | * @covers ::get_sample_permalink_html |
| 508 | 527 | */ |
| 509 | 528 | public function test_get_sample_permalink_html_should_use_preview_links_for_draft_and_pending_posts_with_no_post_name() { |
| 510 | 529 | $this->set_permalink_structure( '/%postname%/' ); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 527 | 546 | |
| 528 | 547 | /** |
| 529 | 548 | * @ticket 5305 |
| | 549 | * @covers ::get_sample_permalink |
| 530 | 550 | */ |
| 531 | 551 | public function test_get_sample_permalink_should_avoid_slugs_that_would_create_clashes_with_year_archives() { |
| 532 | 552 | $this->set_permalink_structure( '/%postname%/' ); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 543 | 563 | |
| 544 | 564 | /** |
| 545 | 565 | * @ticket 5305 |
| | 566 | * @covers ::get_sample_permalink |
| 546 | 567 | */ |
| 547 | 568 | public function test_get_sample_permalink_should_allow_yearlike_slugs_if_permastruct_does_not_cause_an_archive_conflict() { |
| 548 | 569 | $this->set_permalink_structure( '/%year%/%postname%/' ); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 559 | 580 | |
| 560 | 581 | /** |
| 561 | 582 | * @ticket 5305 |
| | 583 | * @covers ::get_sample_permalink |
| 562 | 584 | */ |
| 563 | 585 | public function test_get_sample_permalink_should_avoid_slugs_that_would_create_clashes_with_month_archives() { |
| 564 | 586 | $this->set_permalink_structure( '/%year%/%postname%/' ); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 575 | 597 | |
| 576 | 598 | /** |
| 577 | 599 | * @ticket 5305 |
| | 600 | * @covers ::get_sample_permalink |
| 578 | 601 | */ |
| 579 | 602 | public function test_get_sample_permalink_should_ignore_potential_month_conflicts_for_invalid_monthnum() { |
| 580 | 603 | $this->set_permalink_structure( '/%year%/%postname%/' ); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 591 | 614 | |
| 592 | 615 | /** |
| 593 | 616 | * @ticket 5305 |
| | 617 | * @covers ::get_sample_permalink |
| 594 | 618 | */ |
| 595 | 619 | public function test_get_sample_permalink_should_avoid_slugs_that_would_create_clashes_with_day_archives() { |
| 596 | 620 | $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 607 | 631 | |
| 608 | 632 | /** |
| 609 | 633 | * @ticket 5305 |
| | 634 | * @covers ::get_sample_permalink |
| 610 | 635 | */ |
| 611 | 636 | public function test_get_sample_permalink_should_iterate_slug_suffix_when_a_date_conflict_is_found() { |
| 612 | 637 | $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 629 | 654 | |
| 630 | 655 | /** |
| 631 | 656 | * @ticket 5305 |
| | 657 | * @covers ::get_sample_permalink |
| 632 | 658 | */ |
| 633 | 659 | public function test_get_sample_permalink_should_ignore_potential_day_conflicts_for_invalid_day() { |
| 634 | 660 | $this->set_permalink_structure( '/%year%/%monthnum%/%postname%/' ); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 645 | 671 | |
| 646 | 672 | /** |
| 647 | 673 | * @ticket 5305 |
| | 674 | * @covers ::get_sample_permalink |
| 648 | 675 | */ |
| 649 | 676 | public function test_get_sample_permalink_should_allow_daylike_slugs_if_permastruct_does_not_cause_an_archive_conflict() { |
| 650 | 677 | $this->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' ); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 661 | 688 | |
| 662 | 689 | /** |
| 663 | 690 | * @ticket 35368 |
| | 691 | * @covers ::get_sample_permalink |
| 664 | 692 | */ |
| 665 | 693 | public function test_get_sample_permalink_should_respect_hierarchy_of_draft_pages() { |
| 666 | 694 | $this->set_permalink_structure( '/%postname%/' ); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 686 | 714 | $this->assertSame( 'child-page', $actual[1] ); |
| 687 | 715 | } |
| 688 | 716 | |
| | 717 | /** |
| | 718 | * @covers ::post_exists |
| | 719 | */ |
| 689 | 720 | public function test_post_exists_should_match_title() { |
| 690 | 721 | $p = self::factory()->post->create( |
| 691 | 722 | array( |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 696 | 727 | $this->assertSame( $p, post_exists( 'Foo Bar' ) ); |
| 697 | 728 | } |
| 698 | 729 | |
| | 730 | /** |
| | 731 | * @covers ::post_exists |
| | 732 | */ |
| 699 | 733 | public function test_post_exists_should_not_match_nonexistent_title() { |
| 700 | 734 | $p = self::factory()->post->create( |
| 701 | 735 | array( |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 706 | 740 | $this->assertSame( 0, post_exists( 'Foo Bar Baz' ) ); |
| 707 | 741 | } |
| 708 | 742 | |
| | 743 | /** |
| | 744 | * @covers ::post_exists |
| | 745 | */ |
| 709 | 746 | public function test_post_exists_should_match_nonempty_content() { |
| 710 | 747 | $title = 'Foo Bar'; |
| 711 | 748 | $content = 'Foo Bar Baz'; |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 721 | 758 | |
| 722 | 759 | /** |
| 723 | 760 | * @ticket 35246 |
| | 761 | * @covers ::post_exists |
| 724 | 762 | */ |
| 725 | 763 | public function test_post_exists_should_match_content_with_no_title() { |
| 726 | 764 | $title = ''; |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 735 | 773 | $this->assertSame( $p, post_exists( $title, $content ) ); |
| 736 | 774 | } |
| 737 | 775 | |
| | 776 | /** |
| | 777 | * @covers ::post_exists |
| | 778 | */ |
| 738 | 779 | public function test_post_exists_should_not_match_when_nonempty_content_doesnt_match() { |
| 739 | 780 | $title = 'Foo Bar'; |
| 740 | 781 | $content = 'Foo Bar Baz'; |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 748 | 789 | $this->assertSame( 0, post_exists( $title, $content ) ); |
| 749 | 790 | } |
| 750 | 791 | |
| | 792 | /** |
| | 793 | * @covers ::post_exists |
| | 794 | */ |
| 751 | 795 | public function test_post_exists_should_match_nonempty_date() { |
| 752 | 796 | $title = 'Foo Bar'; |
| 753 | 797 | $date = '2014-05-08 12:00:00'; |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 761 | 805 | $this->assertSame( $p, post_exists( $title, '', $date ) ); |
| 762 | 806 | } |
| 763 | 807 | |
| | 808 | /** |
| | 809 | * @covers ::post_exists |
| | 810 | */ |
| 764 | 811 | public function test_post_exists_should_not_match_when_nonempty_date_doesnt_match() { |
| 765 | 812 | $title = 'Foo Bar'; |
| 766 | 813 | $date = '2014-05-08 12:00:00'; |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 774 | 821 | $this->assertSame( 0, post_exists( $title, '', $date ) ); |
| 775 | 822 | } |
| 776 | 823 | |
| | 824 | /** |
| | 825 | * @covers ::post_exists |
| | 826 | */ |
| 777 | 827 | public function test_post_exists_should_match_nonempty_title_content_and_date() { |
| 778 | 828 | $title = 'Foo Bar'; |
| 779 | 829 | $content = 'Foo Bar Baz'; |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 789 | 839 | $this->assertSame( $p, post_exists( $title, $content, $date ) ); |
| 790 | 840 | } |
| 791 | 841 | |
| | 842 | /** |
| | 843 | * @covers ::use_block_editor_for_post |
| | 844 | */ |
| 792 | 845 | function test_use_block_editor_for_post() { |
| 793 | 846 | $this->assertFalse( use_block_editor_for_post( -1 ) ); |
| 794 | 847 | $bogus_post_id = $this->factory()->post->create( |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 822 | 875 | remove_filter( 'use_block_editor_for_post', '__return_true' ); |
| 823 | 876 | } |
| 824 | 877 | |
| | 878 | /** |
| | 879 | * @covers ::get_block_editor_server_block_settings |
| | 880 | */ |
| 825 | 881 | function test_get_block_editor_server_block_settings() { |
| 826 | 882 | $name = 'core/test'; |
| 827 | 883 | $settings = array( |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 853 | 909 | |
| 854 | 910 | /** |
| 855 | 911 | * @ticket 43559 |
| | 912 | * @covers ::add_meta |
| 856 | 913 | */ |
| 857 | 914 | public function test_post_add_meta_empty_is_allowed() { |
| 858 | 915 | $p = self::factory()->post->create(); |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 872 | 929 | * Test the post type support in post_exists(). |
| 873 | 930 | * |
| 874 | 931 | * @ticket 37406 |
| | 932 | * @covers ::post_exists |
| 875 | 933 | */ |
| 876 | 934 | public function test_post_exists_should_support_post_type() { |
| 877 | 935 | $title = 'Foo Bar'; |
| … |
… |
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 889 | 947 | * Test that post_exists() doesn't find an existing page as a post. |
| 890 | 948 | * |
| 891 | 949 | * @ticket 37406 |
| | 950 | * @covers ::post_exists |
| 892 | 951 | */ |
| 893 | 952 | public function test_post_exists_should_not_match_a_page_for_post() { |
| 894 | 953 | $title = 'Foo Bar'; |
-
diff --git a/tests/phpunit/tests/admin/includesSchema.php b/tests/phpunit/tests/admin/includesSchema.php
index d770128..4c67982 100644
|
a
|
b
|
class Tests_Admin_Includes_Schema extends WP_UnitTestCase { |
| 90 | 90 | /** |
| 91 | 91 | * @ticket 44893 |
| 92 | 92 | * @dataProvider data_populate_options |
| | 93 | * @covers ::populate_options |
| 93 | 94 | */ |
| 94 | 95 | function test_populate_options( $options, $expected ) { |
| 95 | 96 | global $wpdb; |
| … |
… |
class Tests_Admin_Includes_Schema extends WP_UnitTestCase { |
| 182 | 183 | * @group multisite |
| 183 | 184 | * @group ms-required |
| 184 | 185 | * @dataProvider data_populate_site_meta |
| | 186 | * @covers ::populate_site_meta |
| 185 | 187 | */ |
| 186 | 188 | function test_populate_site_meta( $meta, $expected ) { |
| 187 | 189 | global $wpdb; |
| … |
… |
class Tests_Admin_Includes_Schema extends WP_UnitTestCase { |
| 226 | 228 | * @ticket 44895 |
| 227 | 229 | * @group multisite |
| 228 | 230 | * @dataProvider data_populate_network_meta |
| | 231 | * @covers ::populate_network_meta |
| 229 | 232 | */ |
| 230 | 233 | function test_populate_network_meta( $meta, $expected ) { |
| 231 | 234 | global $wpdb; |
-
diff --git a/tests/phpunit/tests/admin/includesScreen.php b/tests/phpunit/tests/admin/includesScreen.php
index c482ae3..c66e559 100644
|
a
|
b
|
class Tests_Admin_includesScreen extends WP_UnitTestCase { |
| 167 | 167 | parent::tearDown(); |
| 168 | 168 | } |
| 169 | 169 | |
| | 170 | /** |
| | 171 | * @covers ::set_current_screen |
| | 172 | */ |
| 170 | 173 | function test_set_current_screen_with_hook_suffix() { |
| 171 | 174 | global $current_screen; |
| 172 | 175 | |
| … |
… |
class Tests_Admin_includesScreen extends WP_UnitTestCase { |
| 235 | 238 | } |
| 236 | 239 | } |
| 237 | 240 | |
| | 241 | /** |
| | 242 | * @covers ::convert_to_screen |
| | 243 | */ |
| 238 | 244 | function test_post_type_as_hookname() { |
| 239 | 245 | $screen = convert_to_screen( 'page' ); |
| 240 | 246 | $this->assertSame( $screen->post_type, 'page' ); |
| … |
… |
class Tests_Admin_includesScreen extends WP_UnitTestCase { |
| 243 | 249 | $this->assertTrue( $screen->is_block_editor ); |
| 244 | 250 | } |
| 245 | 251 | |
| | 252 | /** |
| | 253 | * @covers ::register_post_type |
| | 254 | * @covers ::convert_to_screen |
| | 255 | */ |
| 246 | 256 | function test_post_type_with_special_suffix_as_hookname() { |
| 247 | 257 | register_post_type( 'value-add' ); |
| 248 | 258 | $screen = convert_to_screen( 'value-add' ); // The '-add' part is key. |
| … |
… |
class Tests_Admin_includesScreen extends WP_UnitTestCase { |
| 258 | 268 | $this->assertFalse( $screen->is_block_editor ); // Post types do not support `show_in_rest` by default. |
| 259 | 269 | } |
| 260 | 270 | |
| | 271 | /** |
| | 272 | * @covers ::register_taxonomy |
| | 273 | * @covers ::convert_to_screen |
| | 274 | */ |
| 261 | 275 | function test_taxonomy_with_special_suffix_as_hookname() { |
| 262 | 276 | register_taxonomy( 'old-or-new', 'post' ); |
| 263 | 277 | $screen = convert_to_screen( 'edit-old-or-new' ); // The '-new' part is key. |
| … |
… |
class Tests_Admin_includesScreen extends WP_UnitTestCase { |
| 267 | 281 | $this->assertFalse( $screen->is_block_editor ); |
| 268 | 282 | } |
| 269 | 283 | |
| | 284 | /** |
| | 285 | * @covers ::register_post_type |
| | 286 | * @covers ::convert_to_screen |
| | 287 | */ |
| 270 | 288 | function test_post_type_with_edit_prefix() { |
| 271 | 289 | register_post_type( 'edit-some-thing' ); |
| 272 | 290 | $screen = convert_to_screen( 'edit-some-thing' ); |
| … |
… |
class Tests_Admin_includesScreen extends WP_UnitTestCase { |
| 282 | 300 | $this->assertFalse( $screen->is_block_editor ); // Post types do not support `show_in_rest` by default. |
| 283 | 301 | } |
| 284 | 302 | |
| | 303 | /** |
| | 304 | * @covers ::register_post_type |
| | 305 | * @covers ::convert_to_screen |
| | 306 | */ |
| 285 | 307 | function test_post_type_edit_collisions() { |
| 286 | 308 | register_post_type( 'comments' ); |
| 287 | 309 | register_post_type( 'tags' ); |
| … |
… |
class Tests_Admin_includesScreen extends WP_UnitTestCase { |
| 302 | 324 | $this->assertSame( $screen->base, 'post' ); |
| 303 | 325 | } |
| 304 | 326 | |
| | 327 | /** |
| | 328 | * @covers ::get_current_screen |
| | 329 | * @covers get_current_screen::add_help_tab |
| | 330 | * @covers get_current_screen::add_help_tabs |
| | 331 | * @covers get_current_screen::get_help_tab |
| | 332 | * @covers get_current_screen::get_help_tabs |
| | 333 | * @covers get_current_screen::remove_help_tab |
| | 334 | * @covers get_current_screen::remove_help_tabs |
| | 335 | */ |
| 305 | 336 | function test_help_tabs() { |
| 306 | 337 | $tab = __FUNCTION__; |
| 307 | 338 | $tab_args = array( |
| … |
… |
class Tests_Admin_includesScreen extends WP_UnitTestCase { |
| 336 | 367 | |
| 337 | 368 | /** |
| 338 | 369 | * @ticket 19828 |
| | 370 | * @covers ::get_current_screen |
| | 371 | * @covers get_current_screen::add_help_tab |
| | 372 | * @covers get_current_screen::add_help_tabs |
| | 373 | * @covers get_current_screen::get_help_tab |
| | 374 | * @covers get_current_screen::get_help_tabs |
| | 375 | * @covers get_current_screen::remove_help_tab |
| | 376 | * @covers get_current_screen::remove_help_tabs |
| 339 | 377 | */ |
| 340 | 378 | function test_help_tabs_priority() { |
| 341 | 379 | $tab_1 = 'tab1'; |
| … |
… |
class Tests_Admin_includesScreen extends WP_UnitTestCase { |
| 431 | 469 | |
| 432 | 470 | /** |
| 433 | 471 | * @ticket 25799 |
| | 472 | * @covers ::get_current_screen |
| | 473 | * @covers get_current_screen::add_option |
| | 474 | * @covers get_current_screen::get_option |
| | 475 | * @covers get_current_screen::get_options |
| | 476 | * @covers get_current_screen::remove_option |
| | 477 | * @covers get_current_screen::remove_options |
| 434 | 478 | */ |
| 435 | 479 | function test_options() { |
| 436 | 480 | $option = __FUNCTION__; |
| … |
… |
class Tests_Admin_includesScreen extends WP_UnitTestCase { |
| 455 | 499 | $this->assertSame( $screen->get_options(), array() ); |
| 456 | 500 | } |
| 457 | 501 | |
| | 502 | /** |
| | 503 | * @covers ::get_current_screen |
| | 504 | * @covers ::set_current_screen |
| | 505 | * @covers get_current_screen::in_admin |
| | 506 | * @covers get_current_screen::get_options |
| | 507 | * @covers get_current_screen::remove_option |
| | 508 | * @covers get_current_screen::remove_options |
| | 509 | */ |
| 458 | 510 | function test_in_admin() { |
| 459 | 511 | $screen = get_current_screen(); |
| 460 | 512 | |
| … |
… |
class Tests_Admin_includesScreen extends WP_UnitTestCase { |
| 606 | 658 | * $function string Function name to hook to the filter. |
| 607 | 659 | * } |
| 608 | 660 | * @param bool $expected The expected `is_block_editor` value. |
| | 661 | * @covers get_current_screen::is_block_editor |
| 609 | 662 | */ |
| 610 | 663 | public function test_is_block_editor( $hook, $filter, $expected ) { |
| 611 | 664 | if ( ! empty( $filter['name'] ) && ! empty( $filter['function'] ) ) { |
-
diff --git a/tests/phpunit/tests/admin/includesTemplate.php b/tests/phpunit/tests/admin/includesTemplate.php
index 80a74eb..fb580a7 100644
|
a
|
b
|
class Tests_Admin_includesTemplate extends WP_UnitTestCase { |
| 7 | 7 | /** |
| 8 | 8 | * @ticket 51147 |
| 9 | 9 | * @dataProvider data_wp_terms_checklist_with_selected_cats |
| | 10 | * @covers ::wp_terms_checklist |
| 10 | 11 | */ |
| 11 | 12 | public function test_wp_terms_checklist_with_selected_cats( $term_id ) { |
| 12 | 13 | $output = wp_terms_checklist( |
| … |
… |
class Tests_Admin_includesTemplate extends WP_UnitTestCase { |
| 23 | 24 | /** |
| 24 | 25 | * @ticket 51147 |
| 25 | 26 | * @dataProvider data_wp_terms_checklist_with_selected_cats |
| | 27 | * @covers ::wp_terms_checklist |
| 26 | 28 | */ |
| 27 | 29 | public function test_wp_terms_checklist_with_popular_cats( $term_id ) { |
| 28 | 30 | $output = wp_terms_checklist( |
| … |
… |
class Tests_Admin_includesTemplate extends WP_UnitTestCase { |
| 43 | 45 | ); |
| 44 | 46 | } |
| 45 | 47 | |
| | 48 | /** |
| | 49 | * @covers ::add_meta_box |
| | 50 | */ |
| 46 | 51 | public function test_add_meta_box() { |
| 47 | 52 | global $wp_meta_boxes; |
| 48 | 53 | |
| … |
… |
class Tests_Admin_includesTemplate extends WP_UnitTestCase { |
| 51 | 56 | $this->assertArrayHasKey( 'testbox1', $wp_meta_boxes['post']['advanced']['default'] ); |
| 52 | 57 | } |
| 53 | 58 | |
| | 59 | /** |
| | 60 | * @covers ::add_meta_box |
| | 61 | * @covers ::remove_meta_box |
| | 62 | */ |
| 54 | 63 | public function test_remove_meta_box() { |
| 55 | 64 | global $wp_meta_boxes; |
| 56 | 65 | |
| … |
… |
class Tests_Admin_includesTemplate extends WP_UnitTestCase { |
| 69 | 78 | |
| 70 | 79 | /** |
| 71 | 80 | * @ticket 15000 |
| | 81 | * @covers ::add_meta_box |
| 72 | 82 | */ |
| 73 | 83 | public function test_add_meta_box_on_multiple_screens() { |
| 74 | 84 | global $wp_meta_boxes; |
| … |
… |
class Tests_Admin_includesTemplate extends WP_UnitTestCase { |
| 83 | 93 | |
| 84 | 94 | /** |
| 85 | 95 | * @ticket 15000 |
| | 96 | * @covers ::add_meta_box |
| | 97 | * @covers ::remove_meta_box |
| 86 | 98 | */ |
| 87 | 99 | public function test_remove_meta_box_from_multiple_screens() { |
| 88 | 100 | global $wp_meta_boxes; |
| … |
… |
class Tests_Admin_includesTemplate extends WP_UnitTestCase { |
| 107 | 119 | |
| 108 | 120 | /** |
| 109 | 121 | * @ticket 50019 |
| | 122 | * @covers ::add_meta_box |
| | 123 | * @covers ::remove_meta_box |
| 110 | 124 | */ |
| 111 | 125 | public function test_add_meta_box_with_previously_removed_box_and_sorted_priority() { |
| 112 | 126 | global $wp_meta_boxes; |
| … |
… |
class Tests_Admin_includesTemplate extends WP_UnitTestCase { |
| 130 | 144 | * @ticket 42498 |
| 131 | 145 | * @covers ::get_settings_errors |
| 132 | 146 | * @global array $wp_settings_errors |
| | 147 | * @covers ::add_settings_error |
| | 148 | * @covers ::get_settings_errors |
| 133 | 149 | */ |
| 134 | 150 | public function test_get_settings_errors_sources() { |
| 135 | 151 | global $wp_settings_errors; |
| … |
… |
class Tests_Admin_includesTemplate extends WP_UnitTestCase { |
| 171 | 187 | * @covers ::settings_errors |
| 172 | 188 | * @global array $wp_settings_errors |
| 173 | 189 | * @dataProvider settings_errors_css_classes_provider |
| | 190 | * @covers ::settings_errors |
| 174 | 191 | */ |
| 175 | 192 | public function test_settings_errors_css_classes( $type, $expected ) { |
| 176 | 193 | global $wp_settings_errors; |
-
diff --git a/tests/phpunit/tests/admin/includesTheme.php b/tests/phpunit/tests/admin/includesTheme.php
index ca842df..f3dff41 100644
|
a
|
b
|
class Tests_Admin_includesTheme extends WP_UnitTestCase { |
| 41 | 41 | * @ticket 11216 |
| 42 | 42 | * @expectedDeprecated get_theme |
| 43 | 43 | * @expectedDeprecated get_themes |
| | 44 | * @covers ::get_page_templates |
| 44 | 45 | */ |
| 45 | 46 | function test_page_templates() { |
| 46 | 47 | $theme = get_theme( 'Page Template Theme' ); |
| … |
… |
class Tests_Admin_includesTheme extends WP_UnitTestCase { |
| 74 | 75 | |
| 75 | 76 | /** |
| 76 | 77 | * @ticket 18375 |
| | 78 | * @covers ::get_page_templates |
| 77 | 79 | */ |
| 78 | 80 | function test_page_templates_different_post_types() { |
| 79 | 81 | $theme = wp_get_theme( 'page-templates' ); |
| … |
… |
class Tests_Admin_includesTheme extends WP_UnitTestCase { |
| 100 | 102 | |
| 101 | 103 | /** |
| 102 | 104 | * @ticket 38766 |
| | 105 | * @covers ::get_page_templates |
| 103 | 106 | */ |
| 104 | 107 | function test_page_templates_for_post_types_with_trailing_periods() { |
| 105 | 108 | $theme = wp_get_theme( 'page-templates' ); |
| … |
… |
class Tests_Admin_includesTheme extends WP_UnitTestCase { |
| 132 | 135 | |
| 133 | 136 | /** |
| 134 | 137 | * @ticket 38696 |
| | 138 | * @covers ::get_page_templates |
| 135 | 139 | */ |
| 136 | 140 | function test_page_templates_child_theme() { |
| 137 | 141 | $theme = wp_get_theme( 'page-templates-child' ); |
| … |
… |
class Tests_Admin_includesTheme extends WP_UnitTestCase { |
| 171 | 175 | |
| 172 | 176 | /** |
| 173 | 177 | * @ticket 41717 |
| | 178 | * @covers ::wp_get_theme |
| | 179 | * @covers wp_get_theme::get_post_templates |
| 174 | 180 | */ |
| 175 | 181 | public function test_get_post_templates_child_theme() { |
| 176 | 182 | $theme = wp_get_theme( 'page-templates-child' ); |
| … |
… |
class Tests_Admin_includesTheme extends WP_UnitTestCase { |
| 215 | 221 | * |
| 216 | 222 | * @group external-http |
| 217 | 223 | * @ticket 28121 |
| | 224 | * @covers ::get_theme_feature_list |
| 218 | 225 | */ |
| 219 | 226 | function test_get_theme_featured_list_api() { |
| 220 | 227 | wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) ); |
| … |
… |
class Tests_Admin_includesTheme extends WP_UnitTestCase { |
| 229 | 236 | * |
| 230 | 237 | * @group external-http |
| 231 | 238 | * @ticket 28121 |
| | 239 | * @covers ::get_theme_feature_list |
| 232 | 240 | */ |
| 233 | 241 | function test_get_theme_featured_list_hardcoded() { |
| 234 | 242 | $featured_list_hardcoded = get_theme_feature_list( false ); |
-
--
2.6.2.windows.1
From 6a94978c6d0aa3905edd34f42f5efe9c0cf62920 Mon Sep 17 00:00:00 2001
From: GITUSER <hudson@inboundnow.com>
Date: Wed, 9 Sep 2020 16:35:26 -0500
Subject: [PATCH] Working with Paul
---
tests/phpunit/tests/admin/includesListTable.php | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/tests/phpunit/tests/admin/includesListTable.php b/tests/phpunit/tests/admin/includesListTable.php
index 90669a3..4ef140c 100644
|
a
|
b
|
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * @ticket 15459 |
| 78 | | * @covers class::WP_Posts_List_Table |
| | 78 | * @covers WP_Posts_List_Table::list_hierarchical_page |
| 79 | 79 | */ |
| 80 | 80 | function test_list_hierarchical_pages_first_page() { |
| 81 | 81 | $this->_test_list_hierarchical_page( |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | 94 | * @ticket 15459 |
| 95 | | * @covers class::WP_Posts_List_Table |
| | 95 | * @covers WP_Posts_List_Table::list_hierarchical_page |
| 96 | 96 | */ |
| 97 | 97 | function test_list_hierarchical_pages_second_page() { |
| 98 | 98 | $this->_test_list_hierarchical_page( |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 110 | 110 | |
| 111 | 111 | /** |
| 112 | 112 | * @ticket 15459 |
| 113 | | * @covers class::WP_Posts_List_Table |
| | 113 | * @covers WP_Posts_List_Table::list_hierarchical_page |
| 114 | 114 | */ |
| 115 | 115 | function test_search_hierarchical_pages_first_page() { |
| 116 | 116 | $this->_test_list_hierarchical_page( |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 128 | 128 | |
| 129 | 129 | /** |
| 130 | 130 | * @ticket 15459 |
| 131 | | * @covers class::WP_Posts_List_Table |
| | 131 | * @covers WP_Posts_List_Table::list_hierarchical_page |
| 132 | 132 | */ |
| 133 | 133 | function test_search_hierarchical_pages_second_page() { |
| 134 | 134 | $this->_test_list_hierarchical_page( |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 146 | 146 | |
| 147 | 147 | /** |
| 148 | 148 | * @ticket 15459 |
| 149 | | * @covers class::WP_Posts_List_Table |
| | 149 | * @covers WP_Posts_List_Table::list_hierarchical_page |
| 150 | 150 | */ |
| 151 | 151 | function test_grandchildren_hierarchical_pages_first_page() { |
| 152 | 152 | // Page 6 is the first page with grandchildren. |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 166 | 166 | |
| 167 | 167 | /** |
| 168 | 168 | * @ticket 15459 |
| 169 | | * @covers class::WP_Posts_List_Table |
| | 169 | * @covers WP_Posts_List_Table::list_hierarchical_page |
| 170 | 170 | */ |
| 171 | 171 | function test_grandchildren_hierarchical_pages_second_page() { |
| 172 | 172 | // Page 7 is the second page with grandchildren. |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 189 | 189 | * |
| 190 | 190 | * @param array $args Query args for the list of pages. |
| 191 | 191 | * @param array $expected_ids Expected IDs of pages returned. |
| 192 | | * @covers class::WP_Posts_List_Table |
| | 192 | * @covers WP_Posts_List_Table::list_hierarchical_page |
| 193 | 193 | * @covers WP_Posts_List_Table::set_hierarchical_display |
| 194 | 194 | * @covers WP_Posts_List_Table::display_rows |
| 195 | 195 | */ |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 236 | 236 | |
| 237 | 237 | /** |
| 238 | 238 | * @ticket 37407 |
| 239 | | * @covers class::WP_Posts_List_Table |
| 240 | 239 | * @covers WP_Posts_List_Table::extra_tablenav |
| 241 | 240 | */ |
| 242 | 241 | function test_filter_button_should_not_be_shown_if_there_are_no_posts() { |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 252 | 251 | |
| 253 | 252 | /** |
| 254 | 253 | * @ticket 37407 |
| 255 | | * @covers class::WP_Posts_List_Table |
| 256 | 254 | * @covers WP_Posts_List_Table::extra_tablenav |
| 257 | 255 | */ |
| 258 | 256 | function test_months_dropdown_should_not_be_shown_if_there_are_no_posts() { |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 268 | 266 | |
| 269 | 267 | /** |
| 270 | 268 | * @ticket 37407 |
| 271 | | * @covers class::WP_Posts_List_Table |
| 272 | 269 | * @covers WP_Posts_List_Table::extra_tablenav |
| 273 | 270 | */ |
| 274 | 271 | function test_category_dropdown_should_not_be_shown_if_there_are_no_posts() { |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 284 | 281 | |
| 285 | 282 | /** |
| 286 | 283 | * @ticket 38341 |
| 287 | | * @covers class::WP_Posts_List_Table |
| 288 | 284 | * @covers WP_Posts_List_Table::extra_tablenav |
| 289 | 285 | */ |
| 290 | 286 | public function test_empty_trash_button_should_not_be_shown_if_there_are_no_posts() { |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 301 | 297 | /** |
| 302 | 298 | * @ticket 40188 |
| 303 | 299 | * @covers ::_get_list_table |
| 304 | | * @covers class::WP_Posts_List_Table |
| 305 | 300 | * @covers WP_Posts_List_Table::extra_tablenav |
| 306 | 301 | */ |
| 307 | 302 | public function test_filter_button_should_not_be_shown_if_there_are_no_comments() { |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 317 | 312 | /** |
| 318 | 313 | * @ticket 40188 |
| 319 | 314 | * @covers ::_get_list_table |
| 320 | | * @covers class::WP_Posts_List_Table |
| 321 | 315 | * @covers WP_Posts_List_Table::extra_tablenav |
| 322 | 316 | */ |
| 323 | 317 | public function test_filter_button_should_be_shown_if_there_are_comments() { |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 342 | 336 | /** |
| 343 | 337 | * @ticket 40188 |
| 344 | 338 | * @covers ::_get_list_table |
| 345 | | * @covers class::WP_Posts_List_Table |
| 346 | 339 | * @covers WP_Posts_List_Table::extra_tablenav |
| 347 | 340 | */ |
| 348 | 341 | public function test_filter_comment_status_dropdown_should_be_shown_if_there_are_comments() { |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 383 | 376 | |
| 384 | 377 | /** |
| 385 | 378 | * @ticket 45089 |
| 386 | | * @covers class::WP_Posts_List_Table |
| 387 | 379 | * @covers WP_Posts_List_Table::get_sortable_columns |
| 388 | 380 | * @covers WP_Posts_List_Table::print_column_headers |
| 389 | 381 | */ |
-
--
2.6.2.windows.1
From 9c6c7e3090810070a533774577688cc87b31e874 Mon Sep 17 00:00:00 2001
From: GITUSER <hudson@inboundnow.com>
Date: Tue, 8 Sep 2020 13:07:25 -0500
Subject: [PATCH] adding covers to includesListTable.php, need to get help to
see if I am doing this correctly.
---
tests/phpunit/tests/admin/includesListTable.php | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/tests/phpunit/tests/admin/includesListTable.php b/tests/phpunit/tests/admin/includesListTable.php
index e7268d0..90669a3 100644
|
a
|
b
|
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 300 | 300 | |
| 301 | 301 | /** |
| 302 | 302 | * @ticket 40188 |
| | 303 | * @covers ::_get_list_table |
| | 304 | * @covers class::WP_Posts_List_Table |
| | 305 | * @covers WP_Posts_List_Table::extra_tablenav |
| 303 | 306 | */ |
| 304 | 307 | public function test_filter_button_should_not_be_shown_if_there_are_no_comments() { |
| 305 | 308 | $table = _get_list_table( 'WP_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 313 | 316 | |
| 314 | 317 | /** |
| 315 | 318 | * @ticket 40188 |
| | 319 | * @covers ::_get_list_table |
| | 320 | * @covers class::WP_Posts_List_Table |
| | 321 | * @covers WP_Posts_List_Table::extra_tablenav |
| 316 | 322 | */ |
| 317 | 323 | public function test_filter_button_should_be_shown_if_there_are_comments() { |
| 318 | 324 | $post_id = self::factory()->post->create(); |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 335 | 341 | |
| 336 | 342 | /** |
| 337 | 343 | * @ticket 40188 |
| | 344 | * @covers ::_get_list_table |
| | 345 | * @covers class::WP_Posts_List_Table |
| | 346 | * @covers WP_Posts_List_Table::extra_tablenav |
| 338 | 347 | */ |
| 339 | 348 | public function test_filter_comment_status_dropdown_should_be_shown_if_there_are_comments() { |
| 340 | 349 | $post_id = self::factory()->post->create(); |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 358 | 367 | |
| 359 | 368 | /** |
| 360 | 369 | * @ticket 38341 |
| | 370 | * @covers ::_get_list_table |
| | 371 | * @covers class::WP_Posts_List_Table |
| | 372 | * @covers WP_Posts_List_Table::extra_tablenav |
| 361 | 373 | */ |
| 362 | 374 | public function test_empty_trash_button_should_not_be_shown_if_there_are_no_comments() { |
| 363 | 375 | $table = _get_list_table( 'WP_Comments_List_Table', array( 'screen' => 'edit-comments' ) ); |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 371 | 383 | |
| 372 | 384 | /** |
| 373 | 385 | * @ticket 45089 |
| | 386 | * @covers class::WP_Posts_List_Table |
| | 387 | * @covers WP_Posts_List_Table::get_sortable_columns |
| | 388 | * @covers WP_Posts_List_Table::print_column_headers |
| 374 | 389 | */ |
| 375 | 390 | public function test_sortable_columns() { |
| 376 | 391 | require_once ABSPATH . 'wp-admin/includes/class-wp-comments-list-table.php'; |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 405 | 420 | |
| 406 | 421 | /** |
| 407 | 422 | * @ticket 45089 |
| | 423 | * @covers class::WP_Posts_List_Table |
| | 424 | * @covers WP_Posts_List_Table::get_sortable_columns |
| | 425 | * @covers WP_Posts_List_Table::print_column_headers |
| 408 | 426 | */ |
| 409 | 427 | public function test_sortable_columns_with_current_ordering() { |
| 410 | 428 | require_once ABSPATH . 'wp-admin/includes/class-wp-comments-list-table.php'; |
-
--
2.6.2.windows.1
From 688fbda8a818ed0cbacc8596ec6bd14dff80528e Mon Sep 17 00:00:00 2001
From: GITUSER <hudson@inboundnow.com>
Date: Tue, 8 Sep 2020 12:58:13 -0500
Subject: [PATCH] saving changes
---
.gitignore | 1 +
tests/phpunit/tests/actions/callbacks.php | 1 +
tests/phpunit/tests/actions/closures.php | 1 +
tests/phpunit/tests/admin/includesComment.php | 6 ++++++
tests/phpunit/tests/admin/includesCommunityEvents.php | 12 ++++++++++++
tests/phpunit/tests/admin/includesFile.php | 2 ++
tests/phpunit/tests/admin/includesListTable.php | 17 +++++++++++++++++
7 files changed, 40 insertions(+)
diff --git a/.gitignore b/.gitignore
index 01757f7..6eff812 100644
|
a
|
b
|
wp-tests-config.php |
| 77 | 77 | |
| 78 | 78 | # Files for local environment config |
| 79 | 79 | /docker-compose.override.yml |
| | 80 | .idea/ |
-
diff --git a/tests/phpunit/tests/actions/callbacks.php b/tests/phpunit/tests/actions/callbacks.php
index fc58c33..2db504d 100644
|
a
|
b
|
class Tests_Actions_Callbacks extends WP_UnitTestCase { |
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * @ticket 23265 |
| | 10 | * @covers ::has_action |
| 10 | 11 | */ |
| 11 | 12 | function test_callback_representations() { |
| 12 | 13 | $tag = __FUNCTION__; |
-
diff --git a/tests/phpunit/tests/actions/closures.php b/tests/phpunit/tests/actions/closures.php
index d1a458e..a255419 100644
|
a
|
b
|
class Tests_Actions_Closures extends WP_UnitTestCase { |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * @ticket 10493 |
| | 12 | * @covers ::has_action |
| 12 | 13 | */ |
| 13 | 14 | function test_action_closure() { |
| 14 | 15 | $tag = 'test_action_closure'; |
-
diff --git a/tests/phpunit/tests/admin/includesComment.php b/tests/phpunit/tests/admin/includesComment.php
index 1dcc6bb..5f687f0 100644
|
a
|
b
|
class Tests_Admin_IncludesComment extends WP_UnitTestCase { |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * Verify that both the comment date and author must match for a comment to exist. |
| | 50 | * |
| | 51 | * @covers ::comment_exists |
| 50 | 52 | */ |
| 51 | 53 | public function test_must_match_date_and_author() { |
| 52 | 54 | $this->assertNull( comment_exists( 1, '2004-01-02 12:00:00' ) ); |
| … |
… |
class Tests_Admin_IncludesComment extends WP_UnitTestCase { |
| 55 | 57 | |
| 56 | 58 | /** |
| 57 | 59 | * @ticket 33871 |
| | 60 | * @covers ::comment_exists |
| 58 | 61 | */ |
| 59 | 62 | public function test_default_value_of_timezone_should_be_blog() { |
| 60 | 63 | $this->assertEquals( self::$post_id, comment_exists( 1, '2014-05-06 12:00:00' ) ); |
| … |
… |
class Tests_Admin_IncludesComment extends WP_UnitTestCase { |
| 62 | 65 | |
| 63 | 66 | /** |
| 64 | 67 | * @ticket 33871 |
| | 68 | * @covers ::comment_exists |
| 65 | 69 | */ |
| 66 | 70 | public function test_should_respect_timezone_blog() { |
| 67 | 71 | $this->assertEquals( self::$post_id, comment_exists( 1, '2014-05-06 12:00:00', 'blog' ) ); |
| … |
… |
class Tests_Admin_IncludesComment extends WP_UnitTestCase { |
| 69 | 73 | |
| 70 | 74 | /** |
| 71 | 75 | * @ticket 33871 |
| | 76 | * @covers ::comment_exists |
| 72 | 77 | */ |
| 73 | 78 | public function test_should_respect_timezone_gmt() { |
| 74 | 79 | $this->assertEquals( self::$post_id, comment_exists( 1, '2014-05-06 07:00:00', 'gmt' ) ); |
| … |
… |
class Tests_Admin_IncludesComment extends WP_UnitTestCase { |
| 76 | 81 | |
| 77 | 82 | /** |
| 78 | 83 | * @ticket 33871 |
| | 84 | * @covers ::comment_exists |
| 79 | 85 | */ |
| 80 | 86 | public function test_invalid_timezone_should_fall_back_on_blog() { |
| 81 | 87 | $this->assertEquals( self::$post_id, comment_exists( 1, '2014-05-06 12:00:00', 'not_a_valid_value' ) ); |
-
diff --git a/tests/phpunit/tests/admin/includesCommunityEvents.php b/tests/phpunit/tests/admin/includesCommunityEvents.php
index 5bae0d8..26c6dad 100644
|
a
|
b
|
class Test_WP_Community_Events extends WP_UnitTestCase { |
| 60 | 60 | * Test: get_events() should return an instance of WP_Error if the response code is not 200. |
| 61 | 61 | * |
| 62 | 62 | * @since 4.8.0 |
| | 63 | * |
| | 64 | * @covers WP_Community_Events::get_events |
| 63 | 65 | */ |
| 64 | 66 | public function test_get_events_bad_response_code() { |
| 65 | 67 | add_filter( 'pre_http_request', array( $this, '_http_request_bad_response_code' ) ); |
| … |
… |
class Test_WP_Community_Events extends WP_UnitTestCase { |
| 73 | 75 | * Test: The response body should not be cached if the response code is not 200. |
| 74 | 76 | * |
| 75 | 77 | * @since 4.8.0 |
| | 78 | * |
| | 79 | * @covers WP_Community_Events::get_cached_events |
| 76 | 80 | */ |
| 77 | 81 | public function test_get_cached_events_bad_response_code() { |
| 78 | 82 | add_filter( 'pre_http_request', array( $this, '_http_request_bad_response_code' ) ); |
| … |
… |
class Test_WP_Community_Events extends WP_UnitTestCase { |
| 108 | 112 | * the required properties. |
| 109 | 113 | * |
| 110 | 114 | * @since 4.8.0 |
| | 115 | * @covers WP_Community_Events::get_events |
| 111 | 116 | */ |
| 112 | 117 | public function test_get_events_invalid_response() { |
| 113 | 118 | add_filter( 'pre_http_request', array( $this, '_http_request_invalid_response' ) ); |
| … |
… |
class Test_WP_Community_Events extends WP_UnitTestCase { |
| 121 | 126 | * Test: The response body should not be cached if it does not have the required properties. |
| 122 | 127 | * |
| 123 | 128 | * @since 4.8.0 |
| | 129 | * @covers WP_Community_Events::get_cached_events |
| 124 | 130 | */ |
| 125 | 131 | public function test_get_cached_events_invalid_response() { |
| 126 | 132 | add_filter( 'pre_http_request', array( $this, '_http_request_invalid_response' ) ); |
| … |
… |
class Test_WP_Community_Events extends WP_UnitTestCase { |
| 156 | 162 | * an events array with individual events that have formatted time and date. |
| 157 | 163 | * |
| 158 | 164 | * @since 4.8.0 |
| | 165 | * @covers WP_Community_Events::get_events |
| 159 | 166 | */ |
| 160 | 167 | public function test_get_events_valid_response() { |
| 161 | 168 | add_filter( 'pre_http_request', array( $this, '_http_request_valid_response' ) ); |
| … |
… |
class Test_WP_Community_Events extends WP_UnitTestCase { |
| 175 | 182 | * and date values for each event. |
| 176 | 183 | * |
| 177 | 184 | * @since 4.8.0 |
| | 185 | * @covers WP_Community_Events::get_events |
| | 186 | * @covers WP_Community_Events::get_cached_events |
| 178 | 187 | */ |
| 179 | 188 | public function test_get_cached_events_valid_response() { |
| 180 | 189 | add_filter( 'pre_http_request', array( $this, '_http_request_valid_response' ) ); |
| … |
… |
class Test_WP_Community_Events extends WP_UnitTestCase { |
| 262 | 271 | * Test: get_events() should return the events with the WordCamp pinned in the prepared list. |
| 263 | 272 | * |
| 264 | 273 | * @since 4.9.7 |
| | 274 | * @covers WP_Community_Events::get_events |
| 265 | 275 | */ |
| 266 | 276 | public function test_get_events_pin_wordcamp() { |
| 267 | 277 | add_filter( 'pre_http_request', array( $this, '_http_request_valid_response_unpinned_wordcamp' ) ); |
| … |
… |
class Test_WP_Community_Events extends WP_UnitTestCase { |
| 364 | 374 | * falls into the list. |
| 365 | 375 | * |
| 366 | 376 | * @since 4.9.7 |
| | 377 | * @covers WP_Community_Events::get_events |
| 367 | 378 | */ |
| 368 | 379 | public function test_get_events_dont_pin_multiple_wordcamps() { |
| 369 | 380 | add_filter( 'pre_http_request', array( $this, '_http_request_valid_response_multiple_wordcamps' ) ); |
| … |
… |
class Test_WP_Community_Events extends WP_UnitTestCase { |
| 482 | 493 | * @dataProvider data_get_unsafe_client_ip |
| 483 | 494 | * |
| 484 | 495 | * @ticket 41083 |
| | 496 | * @covers WP_Community_Events::get_unsafe_client_ip |
| 485 | 497 | */ |
| 486 | 498 | public function test_get_unsafe_client_ip( $raw_ip, $expected_result ) { |
| 487 | 499 | $_SERVER['REMOTE_ADDR'] = 'this should not be used'; |
-
diff --git a/tests/phpunit/tests/admin/includesFile.php b/tests/phpunit/tests/admin/includesFile.php
index a3af5da..e1e252f 100644
|
a
|
b
|
class Tests_Admin_includesFile extends WP_UnitTestCase { |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * @ticket 20449 |
| | 11 | * @covers ::get_home_path |
| 11 | 12 | */ |
| 12 | 13 | function test_get_home_path() { |
| 13 | 14 | $home = get_option( 'home' ); |
| … |
… |
class Tests_Admin_includesFile extends WP_UnitTestCase { |
| 34 | 35 | |
| 35 | 36 | /** |
| 36 | 37 | * @ticket 43329 |
| | 38 | * @covers ::download_url |
| 37 | 39 | */ |
| 38 | 40 | public function test_download_url_non_200_response_code() { |
| 39 | 41 | add_filter( 'pre_http_request', array( $this, '_fake_download_url_non_200_response_code' ), 10, 3 ); |
-
diff --git a/tests/phpunit/tests/admin/includesListTable.php b/tests/phpunit/tests/admin/includesListTable.php
index 6ca5b61..e7268d0 100644
|
a
|
b
|
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * @ticket 15459 |
| | 78 | * @covers class::WP_Posts_List_Table |
| 78 | 79 | */ |
| 79 | 80 | function test_list_hierarchical_pages_first_page() { |
| 80 | 81 | $this->_test_list_hierarchical_page( |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 91 | 92 | |
| 92 | 93 | /** |
| 93 | 94 | * @ticket 15459 |
| | 95 | * @covers class::WP_Posts_List_Table |
| 94 | 96 | */ |
| 95 | 97 | function test_list_hierarchical_pages_second_page() { |
| 96 | 98 | $this->_test_list_hierarchical_page( |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 108 | 110 | |
| 109 | 111 | /** |
| 110 | 112 | * @ticket 15459 |
| | 113 | * @covers class::WP_Posts_List_Table |
| 111 | 114 | */ |
| 112 | 115 | function test_search_hierarchical_pages_first_page() { |
| 113 | 116 | $this->_test_list_hierarchical_page( |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 125 | 128 | |
| 126 | 129 | /** |
| 127 | 130 | * @ticket 15459 |
| | 131 | * @covers class::WP_Posts_List_Table |
| 128 | 132 | */ |
| 129 | 133 | function test_search_hierarchical_pages_second_page() { |
| 130 | 134 | $this->_test_list_hierarchical_page( |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 142 | 146 | |
| 143 | 147 | /** |
| 144 | 148 | * @ticket 15459 |
| | 149 | * @covers class::WP_Posts_List_Table |
| 145 | 150 | */ |
| 146 | 151 | function test_grandchildren_hierarchical_pages_first_page() { |
| 147 | 152 | // Page 6 is the first page with grandchildren. |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 161 | 166 | |
| 162 | 167 | /** |
| 163 | 168 | * @ticket 15459 |
| | 169 | * @covers class::WP_Posts_List_Table |
| 164 | 170 | */ |
| 165 | 171 | function test_grandchildren_hierarchical_pages_second_page() { |
| 166 | 172 | // Page 7 is the second page with grandchildren. |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 183 | 189 | * |
| 184 | 190 | * @param array $args Query args for the list of pages. |
| 185 | 191 | * @param array $expected_ids Expected IDs of pages returned. |
| | 192 | * @covers class::WP_Posts_List_Table |
| | 193 | * @covers WP_Posts_List_Table::set_hierarchical_display |
| | 194 | * @covers WP_Posts_List_Table::display_rows |
| 186 | 195 | */ |
| 187 | 196 | protected function _test_list_hierarchical_page( array $args, array $expected_ids ) { |
| 188 | 197 | $matches = array(); |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 227 | 236 | |
| 228 | 237 | /** |
| 229 | 238 | * @ticket 37407 |
| | 239 | * @covers class::WP_Posts_List_Table |
| | 240 | * @covers WP_Posts_List_Table::extra_tablenav |
| 230 | 241 | */ |
| 231 | 242 | function test_filter_button_should_not_be_shown_if_there_are_no_posts() { |
| 232 | 243 | // Set post type to a non-existent one. |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 241 | 252 | |
| 242 | 253 | /** |
| 243 | 254 | * @ticket 37407 |
| | 255 | * @covers class::WP_Posts_List_Table |
| | 256 | * @covers WP_Posts_List_Table::extra_tablenav |
| 244 | 257 | */ |
| 245 | 258 | function test_months_dropdown_should_not_be_shown_if_there_are_no_posts() { |
| 246 | 259 | // Set post type to a non-existent one. |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 255 | 268 | |
| 256 | 269 | /** |
| 257 | 270 | * @ticket 37407 |
| | 271 | * @covers class::WP_Posts_List_Table |
| | 272 | * @covers WP_Posts_List_Table::extra_tablenav |
| 258 | 273 | */ |
| 259 | 274 | function test_category_dropdown_should_not_be_shown_if_there_are_no_posts() { |
| 260 | 275 | // Set post type to a non-existent one. |
| … |
… |
class Tests_Admin_includesListTable extends WP_UnitTestCase { |
| 269 | 284 | |
| 270 | 285 | /** |
| 271 | 286 | * @ticket 38341 |
| | 287 | * @covers class::WP_Posts_List_Table |
| | 288 | * @covers WP_Posts_List_Table::extra_tablenav |
| 272 | 289 | */ |
| 273 | 290 | public function test_empty_trash_button_should_not_be_shown_if_there_are_no_posts() { |
| 274 | 291 | // Set post type to a non-existent one. |