From cb623c351c2407ea1180a18e8db25949b3e58254 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 13 Feb 2021 13:47:12 +0000 Subject: [PATCH] Tests: Add missing `@covers` tags for files in `phpunit/tests/general/`. Props patopaiar, jrf. See #39265. git-svn-id: https://develop.svn.wordpress.org/trunk@50339 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/general/paginateLinks.php | 5 + tests/phpunit/tests/general/template.php | 46 ++++++- tests/phpunit/tests/general/wpError.php | 127 +++++++++++++++++- tests/phpunit/tests/general/wpGetArchives.php | 2 + .../tests/general/wpGetDocumentTitle.php | 3 + .../phpunit/tests/general/wpResourceHints.php | 2 + 6 files changed, 178 insertions(+), 7 deletions(-) diff --git a/tests/phpunit/tests/general/paginateLinks.php b/tests/phpunit/tests/general/paginateLinks.php index 4b24e17bf0..9d4fd4a14d 100644 --- a/tests/phpunit/tests/general/paginateLinks.php +++ b/tests/phpunit/tests/general/paginateLinks.php @@ -1,5 +1,10 @@ assertEmpty( get_site_icon_url() ); @@ -46,6 +48,7 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @group site_icon + * @covers ::site_icon_url */ function test_site_icon_url() { $this->expectOutputString( '' ); @@ -58,6 +61,7 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @group site_icon + * @covers ::has_site_icon */ function test_has_site_icon() { $this->assertFalse( has_site_icon() ); @@ -73,6 +77,7 @@ class Tests_General_Template extends WP_UnitTestCase { * @group site_icon * @group multisite * @group ms-required + * @covers ::has_site_icon */ function test_has_site_icon_returns_true_when_called_for_other_site_with_site_icon_set() { $blog_id = $this->factory->blog->create(); @@ -87,6 +92,7 @@ class Tests_General_Template extends WP_UnitTestCase { * @group site_icon * @group multisite * @group ms-required + * @covers ::has_site_icon */ function test_has_site_icon_returns_false_when_called_for_other_site_without_site_icon_set() { $blog_id = $this->factory->blog->create(); @@ -96,6 +102,7 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @group site_icon + * @covers ::wp_site_icon */ function test_wp_site_icon() { $this->expectOutputString( '' ); @@ -117,6 +124,7 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @group site_icon + * @covers ::wp_site_icon */ function test_wp_site_icon_with_filter() { $this->expectOutputString( '' ); @@ -140,8 +148,9 @@ class Tests_General_Template extends WP_UnitTestCase { } /** - * @group site_icon * @ticket 38377 + * @group site_icon + * @covers ::wp_site_icon */ function test_customize_preview_wp_site_icon_empty() { global $wp_customize; @@ -157,8 +166,9 @@ class Tests_General_Template extends WP_UnitTestCase { } /** - * @group site_icon * @ticket 38377 + * @group site_icon + * @covers ::wp_site_icon */ function test_customize_preview_wp_site_icon_dirty() { global $wp_customize; @@ -241,6 +251,7 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @group custom_logo + * @covers ::has_custom_logo * * @since 4.5.0 */ @@ -258,6 +269,7 @@ class Tests_General_Template extends WP_UnitTestCase { * @group custom_logo * @group multisite * @group ms-required + * @covers ::has_custom_logo */ function test_has_custom_logo_returns_true_when_called_for_other_site_with_custom_logo_set() { $blog_id = $this->factory->blog->create(); @@ -272,6 +284,7 @@ class Tests_General_Template extends WP_UnitTestCase { * @group custom_logo * @group multisite * @group ms-required + * @covers ::has_custom_logo */ function test_has_custom_logo_returns_false_when_called_for_other_site_without_custom_logo_set() { $blog_id = $this->factory->blog->create(); @@ -281,6 +294,7 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @group custom_logo + * @covers ::get_custom_logo * * @since 4.5.0 */ @@ -300,6 +314,7 @@ class Tests_General_Template extends WP_UnitTestCase { * @group custom_logo * @group multisite * @group ms-required + * @covers ::get_custom_logo */ function test_get_custom_logo_returns_logo_when_called_for_other_site_with_custom_logo_set() { $blog_id = $this->factory->blog->create(); @@ -328,6 +343,7 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @group custom_logo + * @covers ::the_custom_logo * * @since 4.5.0 */ @@ -355,8 +371,9 @@ class Tests_General_Template extends WP_UnitTestCase { } /** - * @group custom_logo * @ticket 38768 + * @group custom_logo + * @covers ::the_custom_logo */ function test_the_custom_logo_with_alt() { $this->_set_custom_logo(); @@ -420,6 +437,7 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @ticket 38253 * @group ms-required + * @covers ::get_site_icon_url */ function test_get_site_icon_url_preserves_switched_state() { $blog_id = $this->factory->blog->create(); @@ -439,6 +457,7 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @ticket 38253 * @group ms-required + * @covers ::has_custom_logo */ function test_has_custom_logo_preserves_switched_state() { $blog_id = $this->factory->blog->create(); @@ -458,6 +477,7 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @ticket 38253 * @group ms-required + * @covers ::get_custom_logo */ function test_get_custom_logo_preserves_switched_state() { $blog_id = $this->factory->blog->create(); @@ -476,6 +496,8 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @ticket 40969 + * + * @covers ::get_header */ function test_get_header_returns_nothing_on_success() { $this->expectOutputRegex( '/Header/' ); @@ -487,6 +509,8 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @ticket 40969 + * + * @covers ::get_footer */ function test_get_footer_returns_nothing_on_success() { $this->expectOutputRegex( '/Footer/' ); @@ -498,6 +522,8 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @ticket 40969 + * + * @covers ::get_sidebar */ function test_get_sidebar_returns_nothing_on_success() { $this->expectOutputRegex( '/Sidebar/' ); @@ -509,6 +535,8 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @ticket 40969 + * + * @covers ::get_template_part */ function test_get_template_part_returns_nothing_on_success() { $this->expectOutputRegex( '/Template Part/' ); @@ -520,6 +548,8 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @ticket 40969 + * + * @covers ::get_template_part */ function test_get_template_part_returns_false_on_failure() { $this->assertFalse( get_template_part( 'non-existing-template' ) ); @@ -527,6 +557,8 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @ticket 21676 + * + * @covers ::get_template_part */ function test_get_template_part_passes_arguments_to_template() { $this->expectOutputRegex( '/{"foo":"baz"}/' ); @@ -537,6 +569,9 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @ticket 9862 * @dataProvider data_selected_and_checked_with_equal_values + * + * @covers ::selected + * @covers ::checked */ function test_selected_and_checked_with_equal_values( $selected, $current ) { $this->assertSame( " selected='selected'", selected( $selected, $current, false ) ); @@ -561,6 +596,9 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @ticket 9862 * @dataProvider data_selected_and_checked_with_non_equal_values + * + * @covers ::selected + * @covers ::checked */ function test_selected_and_checked_with_non_equal_values( $selected, $current ) { $this->assertSame( '', selected( $selected, $current, false ) ); @@ -577,6 +615,8 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @ticket 44183 + * + * @covers ::get_the_archive_title */ function test_get_the_archive_title_is_correct_for_author_queries() { $user_with_posts = $this->factory()->user->create_and_get( diff --git a/tests/phpunit/tests/general/wpError.php b/tests/phpunit/tests/general/wpError.php index bb4edd2e79..1cd8444de2 100644 --- a/tests/phpunit/tests/general/wpError.php +++ b/tests/phpunit/tests/general/wpError.php @@ -5,6 +5,7 @@ * @group general * @group errors * + * @covers WP_Error * @coversDefaultClass WP_Error */ class Tests_General_wpError extends WP_UnitTestCase { @@ -25,74 +26,127 @@ class Tests_General_wpError extends WP_UnitTestCase { $this->wp_error = new WP_Error(); } + /** + * @covers ::__construct + */ public function test_WP_Error_should_be_of_type_WP_Error() { $this->assertWPError( $this->wp_error ); } + /** + * @covers ::__construct + */ public function test_WP_Error_with_default_empty_parameters_should_add_no_errors() { $this->assertEmpty( $this->wp_error->errors ); } + /** + * @covers ::__construct + * @covers ::get_error_code + */ public function test_WP_Error_with_empty_code_should_add_no_code() { $this->assertSame( '', $this->wp_error->get_error_code() ); } + /** + * @covers ::__construct + * @covers ::get_error_message + */ public function test_WP_Error_with_empty_code_should_add_no_message() { $this->assertSame( '', $this->wp_error->get_error_message() ); } + /** + * @covers ::__construct + */ public function test_WP_Error_with_empty_code_should_add_no_error_data() { $this->assertEmpty( $this->wp_error->error_data ); } + /** + * @covers ::__construct + * @covers ::get_error_code + */ public function test_WP_Error_with_code_and_empty_message_should_add_error_with_that_code() { $wp_error = new WP_Error( 'code' ); $this->assertSame( 'code', $wp_error->get_error_code() ); } + /** + * @covers ::__construct + * @covers ::get_error_message + */ public function test_WP_Error_with_code_and_empty_message_should_add_error_with_that_code_and_empty_message() { $wp_error = new WP_Error( 'code' ); $this->assertSame( '', $wp_error->get_error_message( 'code' ) ); } + /** + * @covers ::__construct + * @covers ::get_error_data + */ public function test_WP_Error_with_code_and_empty_message_and_empty_data_should_add_error_but_not_associated_data() { $wp_error = new WP_Error( 'code' ); $this->assertNull( $wp_error->get_error_data( 'code' ) ); } + /** + * @covers ::__construct + * @covers ::get_error_data + */ public function test_WP_Error_with_code_and_empty_message_and_non_empty_data_should_add_error_with_empty_message_and_that_stored_data() { $wp_error = new WP_Error( 'code', '', 'data' ); $this->assertSame( 'data', $wp_error->get_error_data( 'code' ) ); } + /** + * @covers ::__construct + * @covers ::get_error_code + */ public function test_WP_Error_with_code_and_message_should_add_error_with_that_code() { $wp_error = new WP_Error( 'code', 'message' ); $this->assertSame( 'code', $wp_error->get_error_code() ); } + /** + * @covers ::__construct + * @covers ::get_error_message + */ public function test_WP_Error_with_code_and_message_should_add_error_with_that_message() { $wp_error = new WP_Error( 'code', 'message' ); $this->assertSame( 'message', $wp_error->get_error_message( 'code' ) ); } + /** + * @covers ::__construct + * @covers ::get_error_code + */ public function test_WP_Error_with_code_and_message_and_data_should_add_error_with_that_code() { $wp_error = new WP_Error( 'code', 'message', 'data' ); $this->assertSame( 'code', $wp_error->get_error_code() ); } + /** + * @covers ::__construct + * @covers ::get_error_message + */ public function test_WP_Error_with_code_and_message_and_data_should_add_error_with_that_message() { $wp_error = new WP_Error( 'code', 'message', 'data' ); $this->assertSame( 'message', $wp_error->get_error_message( 'code' ) ); } + /** + * @covers ::__construct + * @covers ::get_error_data + */ public function test_WP_Error_with_code_and_message_and_data_should_add_error_with_that_data() { $wp_error = new WP_Error( 'code', 'message', 'data' ); @@ -100,6 +154,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::__construct * @covers ::get_error_codes */ public function test_get_error_codes_with_no_errors_should_return_empty_array() { @@ -107,6 +162,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_codes */ public function test_get_error_codes_with_one_error_should_return_an_array_with_only_that_code() { @@ -116,6 +172,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_codes */ public function test_get_error_codes_with_multiple_errors_should_return_an_array_of_those_codes() { @@ -128,6 +185,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::__construct * @covers ::get_error_code */ public function test_get_error_code_with_no_errors_should_return_an_empty_string() { @@ -135,6 +193,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_code */ public function test_get_error_code_with_one_error_should_return_that_error_code() { @@ -144,6 +203,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_code */ public function test_get_error_code_with_multiple_errors_should_return_only_the_first_error_code() { @@ -154,6 +214,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::__construct * @covers ::get_error_messages */ public function test_get_error_messages_with_empty_code_and_no_errors_should_return_an_empty_array() { @@ -161,6 +222,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_messages */ public function test_get_error_messages_with_empty_code_one_error_should_return_an_array_with_that_message() { @@ -170,6 +232,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_messages */ public function test_get_error_messages_with_empty_code_multiple_errors_should_return_an_array_of_messages() { @@ -180,6 +243,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::__construct * @covers ::get_error_messages */ public function test_get_error_messages_with_an_invalid_code_should_return_an_empty_array() { @@ -187,6 +251,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_messages */ public function test_get_error_messages_with_one_error_should_return_an_array_with_that_message() { @@ -196,6 +261,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_messages */ public function test_get_error_messages_with_multiple_errors_same_code_should_return_an_array_with_all_messages() { @@ -206,6 +272,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::__construct * @covers ::get_error_message */ public function test_get_error_message_with_empty_code_and_no_errors_should_return_an_empty_string() { @@ -213,6 +280,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_message */ public function test_get_error_message_with_empty_code_and_one_error_should_return_that_message() { @@ -222,6 +290,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_message */ public function test_get_error_message_with_empty_code_and_multiple_errors_should_return_the_first_message() { @@ -232,6 +301,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_message */ public function test_get_error_message_with_empty_code_and_multiple_errors_multiple_codes_should_return_the_first_message() { @@ -243,6 +313,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::__construct * @covers ::get_error_message */ public function test_get_error_message_with_invalid_code_and_no_errors_should_return_empty_string() { @@ -250,6 +321,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_message */ public function test_get_error_message_with_invalid_code_and_one_error_should_return_an_empty_string() { @@ -259,6 +331,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_message */ public function test_get_error_message_with_invalid_code_and_multiple_errors_should_return_an_empty_string() { @@ -269,6 +342,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::__construct * @covers ::get_error_data */ public function test_get_error_data_with_empty_code_and_no_errors_should_evaluate_as_null() { @@ -276,6 +350,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_data */ public function test_get_error_data_with_empty_code_one_error_no_data_should_evaluate_as_null() { @@ -285,6 +360,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_data */ public function test_get_error_data_with_empty_code_multiple_errors_no_data_should_evaluate_as_null() { @@ -295,6 +371,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_data */ public function test_get_error_data_with_empty_code_and_one_error_with_data_should_return_that_data() { @@ -305,6 +382,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_data */ public function test_get_error_data_with_empty_code_and_multiple_errors_different_codes_should_return_the_last_data_of_the_first_code() { @@ -316,6 +394,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_data */ public function test_get_error_data_with_empty_code_and_multiple_errors_same_code_should_return_the_last_data_of_the_first_code() { @@ -327,6 +406,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::__construct * @covers ::get_error_data */ public function test_get_error_data_with_code_and_no_errors_should_evaluate_as_null() { @@ -334,6 +414,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_data */ public function test_get_error_data_with_code_and_one_error_with_no_data_should_evaluate_as_null() { @@ -343,6 +424,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_data */ public function test_get_error_data_with_code_and_one_error_with_data_should_return_that_data() { @@ -353,6 +435,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_data */ public function test_get_error_data_with_code_and_multiple_errors_different_codes_should_return_the_last_stored_data_of_the_code() { @@ -365,6 +448,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_error_data */ public function test_get_error_data_with_code_and_multiple_errors_same_code_should_return_the_last_stored_data() { @@ -376,6 +460,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::__construct * @covers ::get_all_error_data */ public function test_get_all_error_data_with_code_and_no_errors_should_evaluate_as_empty_array() { @@ -383,6 +468,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_all_error_data */ public function test_get_all_error_data_with_code_and_one_error_with_no_data_should_evaluate_as_empty_array() { @@ -392,6 +478,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_all_error_data */ public function test_get_all_error_data_with_code_and_one_error_with_data_should_return_that_data() { @@ -404,6 +491,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_all_error_data */ public function test_get_all_error_data_with_code_and_multiple_errors_same_code_should_return_all_data() { @@ -415,6 +503,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::get_all_error_data */ public function test_get_all_error_data_should_handle_manipulation_of_error_data_property() { @@ -428,6 +517,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::__construct * @covers ::has_errors */ public function test_has_errors_with_no_errors_returns_false() { @@ -435,6 +525,7 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** + * @covers ::add * @covers ::has_errors */ public function test_has_errors_with_errors_returns_true() { @@ -480,6 +571,7 @@ class Tests_General_wpError extends WP_UnitTestCase { /** * @covers ::add + * @covers ::get_error_code */ public function test_add_with_code_empty_message_empty_data_should_add_error_with_code() { $this->wp_error->add( 'code', '' ); @@ -489,6 +581,7 @@ class Tests_General_wpError extends WP_UnitTestCase { /** * @covers ::add + * @covers ::get_error_message */ public function test_add_with_code_empty_message_empty_data_should_add_error_with_empty_message() { $this->wp_error->add( 'code', '' ); @@ -498,6 +591,7 @@ class Tests_General_wpError extends WP_UnitTestCase { /** * @covers ::add + * @covers ::get_error_data */ public function test_add_with_code_empty_message_empty_data_should_not_add_error_data() { $this->wp_error->add( 'code', '' ); @@ -507,6 +601,7 @@ class Tests_General_wpError extends WP_UnitTestCase { /** * @covers ::add + * @covers ::get_error_message */ public function test_add_with_code_and_message_and_empty_data_should_should_add_error_with_that_message() { $this->wp_error->add( 'code', 'message' ); @@ -516,6 +611,7 @@ class Tests_General_wpError extends WP_UnitTestCase { /** * @covers ::add + * @covers ::get_error_data */ public function test_add_with_code_and_message_and_empty_data_should_not_alter_stored_data() { $this->wp_error->add( 'code', 'message' ); @@ -525,6 +621,7 @@ class Tests_General_wpError extends WP_UnitTestCase { /** * @covers ::add + * @covers ::get_error_code */ public function test_add_with_code_and_empty_message_and_data_should_add_error_with_that_code() { $this->wp_error->add( 'code', '', 'data' ); @@ -534,6 +631,7 @@ class Tests_General_wpError extends WP_UnitTestCase { /** * @covers ::add + * @covers ::get_error_data */ public function test_add_with_code_and_empty_message_and_data_should_store_that_data() { $this->wp_error->add( 'code', '', 'data' ); @@ -543,6 +641,7 @@ class Tests_General_wpError extends WP_UnitTestCase { /** * @covers ::add + * @covers ::get_error_code */ public function test_add_with_code_and_message_and_data_should_add_an_error_with_that_code() { $this->wp_error->add( 'code', 'message', 'data' ); @@ -552,6 +651,7 @@ class Tests_General_wpError extends WP_UnitTestCase { /** * @covers ::add + * @covers ::get_error_message */ public function test_add_with_code_and_message_and_data_should_add_an_error_with_that_message() { $this->wp_error->add( 'code', 'message', 'data' ); @@ -561,6 +661,7 @@ class Tests_General_wpError extends WP_UnitTestCase { /** * @covers ::add + * @covers ::get_error_data */ public function test_add_with_code_and_message_and_data_should_store_that_data() { $this->wp_error->add( 'code', 'message', 'data' ); @@ -570,6 +671,7 @@ class Tests_General_wpError extends WP_UnitTestCase { /** * @covers ::add + * @covers ::get_error_messages */ public function test_add_multiple_times_with_the_same_code_should_add_additional_messages_for_that_code() { $this->wp_error->add( 'code', 'message' ); @@ -582,6 +684,7 @@ class Tests_General_wpError extends WP_UnitTestCase { /** * @covers ::add + * @covers ::get_error_data */ public function test_add_multiple_times_with_the_same_code_and_different_data_should_store_only_the_last_added_data() { $this->wp_error->add( 'code', 'message', 'data-bar' ); @@ -610,6 +713,7 @@ class Tests_General_wpError extends WP_UnitTestCase { /** * @covers ::add_data + * @covers ::get_error_data */ public function test_add_data_with_data_empty_code_and_one_error_should_store_the_data_under_that_code() { $this->wp_error->add( 'code', 'message' ); @@ -620,6 +724,7 @@ class Tests_General_wpError extends WP_UnitTestCase { /** * @covers ::add_data + * @covers ::get_error_data */ public function test_add_data_with_data_empty_code_and_multiple_errors_with_different_codes_should_store_it_under_the_first_code() { $this->wp_error->add( 'code', 'message' ); @@ -632,6 +737,7 @@ class Tests_General_wpError extends WP_UnitTestCase { /** * @covers ::add_data + * @covers ::get_error_data */ public function test_add_data_with_data_empty_code_and_multiple_errors_with_same_code_should_store_it_under_the_first_code() { $this->wp_error->add( 'code', 'message' ); @@ -685,6 +791,7 @@ class Tests_General_wpError extends WP_UnitTestCase { /** * @covers ::add_data + * @covers ::get_error_data */ public function test_add_data_with_data_and_code_should_add_data() { $this->wp_error->add( 'code', 'message' ); @@ -761,6 +868,8 @@ class Tests_General_wpError extends WP_UnitTestCase { /** * @covers ::remove + * @covers ::get_error_data + * @covers ::get_all_error_data */ public function test_remove_should_remove_the_error_data_associated_with_the_given_code() { $this->wp_error->add( 'code', 'message', 'data' ); @@ -774,7 +883,11 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** - * @covers ::merge_from() + * @covers ::merge_from + * @covers ::get_error_messages + * @covers ::get_error_data + * @covers ::get_all_error_data + * @covers ::get_error_message */ public function test_merge_from_should_copy_other_error_into_instance() { $this->wp_error->add( 'code1', 'message1', 'data1' ); @@ -790,7 +903,8 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** - * @covers ::merge_from() + * @covers ::merge_from + * @covers ::has_errors */ public function test_merge_from_with_no_errors_should_not_add_to_instance() { $other = new WP_Error(); @@ -801,7 +915,11 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** - * @covers ::export_to() + * @covers ::export_to + * @covers ::get_error_messages + * @covers ::get_error_data + * @covers ::get_all_error_data + * @covers ::get_error_message */ public function test_export_to_should_copy_instance_into_other_error() { $other = new WP_Error(); @@ -819,7 +937,8 @@ class Tests_General_wpError extends WP_UnitTestCase { } /** - * @covers ::export_to() + * @covers ::export_to + * @covers ::has_errors */ public function test_export_to_with_no_errors_should_not_add_to_other_error() { $other = new WP_Error(); diff --git a/tests/phpunit/tests/general/wpGetArchives.php b/tests/phpunit/tests/general/wpGetArchives.php index 73814e00b6..0f17fd1330 100644 --- a/tests/phpunit/tests/general/wpGetArchives.php +++ b/tests/phpunit/tests/general/wpGetArchives.php @@ -2,6 +2,8 @@ /** * @group general + * @group template + * @covers ::wp_get_archives */ class Tests_General_wpGetArchives extends WP_UnitTestCase { function setUp() { diff --git a/tests/phpunit/tests/general/wpGetDocumentTitle.php b/tests/phpunit/tests/general/wpGetDocumentTitle.php index f9b0d5b4a9..d86fd537e5 100644 --- a/tests/phpunit/tests/general/wpGetDocumentTitle.php +++ b/tests/phpunit/tests/general/wpGetDocumentTitle.php @@ -3,8 +3,11 @@ /** * A set of unit tests for functions in wp-includes/general-template.php * + * @group general * @group template * @group document-title + * @covers ::wp_get_document_title + * @covers ::_wp_render_title_tag */ class Tests_General_wpGetDocumentTitle extends WP_UnitTestCase { diff --git a/tests/phpunit/tests/general/wpResourceHints.php b/tests/phpunit/tests/general/wpResourceHints.php index d60c782c2a..8ffcb94cff 100644 --- a/tests/phpunit/tests/general/wpResourceHints.php +++ b/tests/phpunit/tests/general/wpResourceHints.php @@ -1,8 +1,10 @@