diff --git a/tests/phpunit/tests/functions/addMagicQuotes.php b/tests/phpunit/tests/functions/addMagicQuotes.php index 81e1f010cb..447a4e3d6d 100644 --- a/tests/phpunit/tests/functions/addMagicQuotes.php +++ b/tests/phpunit/tests/functions/addMagicQuotes.php @@ -3,6 +3,7 @@ /** * @group formatting * @group functions.php + * @covers ::add_magic_quotes */ class Tests_Functions_AddMagicQuotes extends WP_UnitTestCase { diff --git a/tests/phpunit/tests/functions/allowedProtocols.php b/tests/phpunit/tests/functions/allowedProtocols.php index ad80a6c855..8803bed8a2 100644 --- a/tests/phpunit/tests/functions/allowedProtocols.php +++ b/tests/phpunit/tests/functions/allowedProtocols.php @@ -3,6 +3,7 @@ /** * @group formatting * @group functions.php + * @covers ::wp_allowed_protocols */ class Tests_Functions_AllowedProtocols extends WP_UnitTestCase { diff --git a/tests/phpunit/tests/functions/anonymization.php b/tests/phpunit/tests/functions/anonymization.php index 786b4cd238..4d84383828 100644 --- a/tests/phpunit/tests/functions/anonymization.php +++ b/tests/phpunit/tests/functions/anonymization.php @@ -10,12 +10,14 @@ /** * Class Tests_Functions_Anonymization. * + * @since 4.9.6 + * * @group functions.php * @group privacy - * - * @since 4.9.6 + * @covers ::wp_privacy_anonymize_data */ class Tests_Functions_Anonymization extends WP_UnitTestCase { + /** * Test that wp_privacy_anonymize_ip() properly anonymizes all possible IP address formats. * diff --git a/tests/phpunit/tests/functions/canonicalCharset.php b/tests/phpunit/tests/functions/canonicalCharset.php index ac89b1ec08..891cb9e767 100644 --- a/tests/phpunit/tests/functions/canonicalCharset.php +++ b/tests/phpunit/tests/functions/canonicalCharset.php @@ -1,11 +1,13 @@ assertInternalType( 'array', $admin_files ); diff --git a/tests/phpunit/tests/functions/numberFormatI18n.php b/tests/phpunit/tests/functions/numberFormatI18n.php index 803b8ec02c..c57405887d 100644 --- a/tests/phpunit/tests/functions/numberFormatI18n.php +++ b/tests/phpunit/tests/functions/numberFormatI18n.php @@ -5,8 +5,10 @@ * * @group functions.php * @group i18n + * @covers ::number_format_i18n */ class Tests_Functions_NumberFormatI18n extends WP_UnitTestCase { + public function test_should_fall_back_to_number_format_when_wp_locale_is_not_set() { $locale = clone $GLOBALS['wp_locale']; $GLOBALS['wp_locale'] = null; diff --git a/tests/phpunit/tests/functions/pluginBasename.php b/tests/phpunit/tests/functions/pluginBasename.php index e664d8fbd6..d7f7bcd6a0 100644 --- a/tests/phpunit/tests/functions/pluginBasename.php +++ b/tests/phpunit/tests/functions/pluginBasename.php @@ -5,6 +5,7 @@ * * @group functions.php * @group plugins + * @covers ::plugin_basename */ class Tests_Functions_PluginBasename extends WP_UnitTestCase { diff --git a/tests/phpunit/tests/functions/referer.php b/tests/phpunit/tests/functions/referer.php index 148fe89888..a6a1aaed99 100644 --- a/tests/phpunit/tests/functions/referer.php +++ b/tests/phpunit/tests/functions/referer.php @@ -4,8 +4,11 @@ * Test wp_get_referer(). * * @group functions.php + * @covers ::wp_get_referer + * @covers ::wp_get_raw_referer */ class Tests_Functions_Referer extends WP_UnitTestCase { + public function setUp() { parent::setUp(); diff --git a/tests/phpunit/tests/functions/removeQueryArg.php b/tests/phpunit/tests/functions/removeQueryArg.php index 3d53f881e0..b8130abe8d 100644 --- a/tests/phpunit/tests/functions/removeQueryArg.php +++ b/tests/phpunit/tests/functions/removeQueryArg.php @@ -2,8 +2,10 @@ /** * @group functions.php + * @covers ::remove_query_arg */ class Tests_Functions_RemoveQueryArg extends WP_UnitTestCase { + /** * @dataProvider remove_query_arg_provider */ diff --git a/tests/phpunit/tests/functions/sizeFormat.php b/tests/phpunit/tests/functions/sizeFormat.php index 7d473f23b9..281db07f5d 100644 --- a/tests/phpunit/tests/functions/sizeFormat.php +++ b/tests/phpunit/tests/functions/sizeFormat.php @@ -3,10 +3,13 @@ /** * Tests for size_format() * - * @group functions.php * @ticket 36635 + * + * @group functions.php + * @covers ::size_format */ class Tests_Functions_SizeFormat extends WP_UnitTestCase { + public function _data_size_format() { return array( array( array(), 0, false ), diff --git a/tests/phpunit/tests/functions/underscoreReturn.php b/tests/phpunit/tests/functions/underscoreReturn.php index 40222633f8..4973c2d328 100644 --- a/tests/phpunit/tests/functions/underscoreReturn.php +++ b/tests/phpunit/tests/functions/underscoreReturn.php @@ -8,26 +8,44 @@ */ class Tests_Functions_UnderscoreReturn extends WP_UnitTestCase { + /** + * @covers ::__return_true + */ public function test__return_true() { $this->assertTrue( __return_true() ); } + /** + * @covers ::__return_false + */ public function test__return_false() { $this->assertFalse( __return_false() ); } + /** + * @covers ::__return_zero + */ public function test__return_zero() { $this->assertSame( 0, __return_zero() ); } + /** + * @covers ::__return_empty_array + */ public function test__return_empty_array() { $this->assertSame( array(), __return_empty_array() ); } + /** + * @covers ::__return_null + */ public function test__return_null() { $this->assertNull( __return_null() ); } + /** + * @covers ::__return_empty_string + */ public function test__return_empty_string() { $this->assertSame( '', __return_empty_string() ); } diff --git a/tests/phpunit/tests/functions/wp.php b/tests/phpunit/tests/functions/wp.php index 80654a8526..04df43b348 100644 --- a/tests/phpunit/tests/functions/wp.php +++ b/tests/phpunit/tests/functions/wp.php @@ -3,6 +3,7 @@ /** * @group functions.php * @group query + * @covers ::wp */ class Tests_Functions_WP extends WP_UnitTestCase { diff --git a/tests/phpunit/tests/functions/wpArraySliceAssoc.php b/tests/phpunit/tests/functions/wpArraySliceAssoc.php index 98afc785c9..f7ce7293a2 100644 --- a/tests/phpunit/tests/functions/wpArraySliceAssoc.php +++ b/tests/phpunit/tests/functions/wpArraySliceAssoc.php @@ -5,8 +5,8 @@ * * @since 5.3.0 * - * @covers ::wp_array_slice_assoc * @group functions.php + * @covers ::wp_array_slice_assoc */ class Tests_Functions_wpArraySliceAssoc extends WP_UnitTestCase { diff --git a/tests/phpunit/tests/functions/wpAuthCheck.php b/tests/phpunit/tests/functions/wpAuthCheck.php index a583d01606..f69ab9e183 100644 --- a/tests/phpunit/tests/functions/wpAuthCheck.php +++ b/tests/phpunit/tests/functions/wpAuthCheck.php @@ -4,6 +4,8 @@ * Tests for the behavior of `wp_auth_check()` * * @group functions.php + * @covers ::is_user_logged_in + * @covers ::wp_auth_check */ class Tests_Functions_wpAuthCheck extends WP_UnitTestCase { diff --git a/tests/phpunit/tests/functions/wpGetArchives.php b/tests/phpunit/tests/functions/wpGetArchives.php index 35d011921d..ec983abe7a 100644 --- a/tests/phpunit/tests/functions/wpGetArchives.php +++ b/tests/phpunit/tests/functions/wpGetArchives.php @@ -1,12 +1,9 @@ 'monthly', 'limit' => '', - 'format' => 'html', 'before' => '', - 'after' => '', 'show_post_count' => false, - 'echo' => 1, 'order' => 'DESC', -); -*/ + +/** + * @group functions.php + * @covers ::wp_get_archives + */ class Tests_Functions_wpGetArchives extends WP_UnitTestCase { protected static $post_ids; protected $month_url; diff --git a/tests/phpunit/tests/functions/wpGetMimeTypes.php b/tests/phpunit/tests/functions/wpGetMimeTypes.php index 8188ecd518..46d2fdfc06 100644 --- a/tests/phpunit/tests/functions/wpGetMimeTypes.php +++ b/tests/phpunit/tests/functions/wpGetMimeTypes.php @@ -4,6 +4,7 @@ * Test wp_get_mime_types(). * * @group functions.php + * @covers ::wp_get_mime_types */ class Tests_Functions_wpGetMimeTypes extends WP_UnitTestCase { diff --git a/tests/phpunit/tests/functions/wpListFilter.php b/tests/phpunit/tests/functions/wpListFilter.php index e347308804..24d43b504d 100644 --- a/tests/phpunit/tests/functions/wpListFilter.php +++ b/tests/phpunit/tests/functions/wpListFilter.php @@ -4,6 +4,8 @@ * Test wp_filter_object_list(), wp_list_filter(), wp_list_pluck(). * * @group functions.php + * @covers ::wp_filter_object_list + * @covers ::wp_list_pluck */ class Tests_Functions_wpListFilter extends WP_UnitTestCase { var $object_list = array(); @@ -317,7 +319,6 @@ class Tests_Functions_wpListFilter extends WP_UnitTestCase { $this->assertArrayHasKey( 'baz', $list ); } - function test_filter_object_list_nested_array_and_field() { $list = wp_filter_object_list( $this->object_list, array( 'field4' => array( 'blue' ) ), 'AND', 'name' ); $this->assertSame( array( 'baz' => 'baz' ), $list ); diff --git a/tests/phpunit/tests/functions/wpListUtil.php b/tests/phpunit/tests/functions/wpListUtil.php index 82265845b9..69b32d95f4 100644 --- a/tests/phpunit/tests/functions/wpListUtil.php +++ b/tests/phpunit/tests/functions/wpListUtil.php @@ -155,6 +155,8 @@ class Tests_Functions_wpListUtil extends WP_UnitTestCase { /** * @dataProvider data_test_wp_list_pluck * + * @covers ::wp_list_pluck + * * @param array $list List of objects or arrays. * @param int|string $field Field from the object to place instead of the entire object * @param int|string $index_key Field from the object to use as keys for the new array. @@ -359,6 +361,8 @@ class Tests_Functions_wpListUtil extends WP_UnitTestCase { /** * @dataProvider data_test_wp_list_filter * + * @covers ::wp_list_filter + * * @param array $list An array of objects to filter. * @param array $args An array of key => value arguments to match * against each object. @@ -686,6 +690,8 @@ class Tests_Functions_wpListUtil extends WP_UnitTestCase { /** * @dataProvider data_test_wp_list_sort * + * @covers ::wp_list_sort + * * @param string|array $orderby Either the field name to order by or an array * of multiple orderby fields as $orderby => $order. * @param string $order Either 'ASC' or 'DESC'. @@ -1011,6 +1017,8 @@ class Tests_Functions_wpListUtil extends WP_UnitTestCase { /** * @dataProvider data_test_wp_list_sort_preserve_keys * + * @covers ::wp_list_sort + * * @param string|array $orderby Either the field name to order by or an array * of multiple orderby fields as $orderby => $order. * @param string $order Either 'ASC' or 'DESC'. @@ -1019,6 +1027,9 @@ class Tests_Functions_wpListUtil extends WP_UnitTestCase { $this->assertSame( $expected, wp_list_sort( $list, $orderby, $order, true ) ); } + /** + * @covers WP_List_Util::get_input + */ public function test_wp_list_util_get_input() { $input = array( 'foo', 'bar' ); $util = new WP_List_Util( $input ); @@ -1026,6 +1037,9 @@ class Tests_Functions_wpListUtil extends WP_UnitTestCase { $this->assertSameSets( $input, $util->get_input() ); } + /** + * @covers WP_List_Util::get_output + */ public function test_wp_list_util_get_output_immediately() { $input = array( 'foo', 'bar' ); $util = new WP_List_Util( $input ); @@ -1033,6 +1047,9 @@ class Tests_Functions_wpListUtil extends WP_UnitTestCase { $this->assertSameSets( $input, $util->get_output() ); } + /** + * @covers WP_List_Util::get_output + */ public function test_wp_list_util_get_output() { $expected = array( (object) array( diff --git a/tests/phpunit/tests/functions/wpRemoteFopen.php b/tests/phpunit/tests/functions/wpRemoteFopen.php index ce3d8f37dd..1a4fa19619 100644 --- a/tests/phpunit/tests/functions/wpRemoteFopen.php +++ b/tests/phpunit/tests/functions/wpRemoteFopen.php @@ -3,6 +3,7 @@ * @group http * @group external-http * @group functions.php + * @covers ::wp_remote_fopen */ class Tests_Functions_wpRemoteFopen extends WP_UnitTestCase { diff --git a/tests/phpunit/tests/functions/wpValidateBoolean.php b/tests/phpunit/tests/functions/wpValidateBoolean.php index 848bccf236..3bc2c20108 100644 --- a/tests/phpunit/tests/functions/wpValidateBoolean.php +++ b/tests/phpunit/tests/functions/wpValidateBoolean.php @@ -3,8 +3,8 @@ /** * Tests the wp_validate_boolean function. * - * @covers ::wp_validate_boolean * @group functions.php + * @covers ::wp_validate_boolean */ class Tests_Functions_wpValidateBoolean extends WP_UnitTestCase { /** @@ -47,8 +47,8 @@ class Tests_Functions_wpValidateBoolean extends WP_UnitTestCase { * * @dataProvider data_provider * - * @param mixed $test_value. - * @param bool $expected. + * @param mixed $test_value + * @param bool $expected * * @ticket 30238 * @ticket 39868