Tests: Add missing @covers
tags for files in phpunit/tests/functions/
.
Props pbearne, jrf. See #39265. git-svn-id: https://develop.svn.wordpress.org/trunk@49006 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
898eb5fc51
commit
835e9c48a4
@ -3,6 +3,7 @@
|
||||
/**
|
||||
* @group formatting
|
||||
* @group functions.php
|
||||
* @covers ::add_magic_quotes
|
||||
*/
|
||||
class Tests_Functions_AddMagicQuotes extends WP_UnitTestCase {
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
/**
|
||||
* @group formatting
|
||||
* @group functions.php
|
||||
* @covers ::wp_allowed_protocols
|
||||
*/
|
||||
class Tests_Functions_AllowedProtocols extends WP_UnitTestCase {
|
||||
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -1,11 +1,13 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
/**
|
||||
* Validate that badly named charsets always return the correct format for UTF-8 and ISO-8859-1.
|
||||
*
|
||||
* @since 4.8.0
|
||||
* @since 4.8.0
|
||||
*
|
||||
* @group functions.php
|
||||
* @covers ::_canonical_charset
|
||||
*/
|
||||
|
||||
class Tests_Functions_CanonicalCharset extends WP_UnitTestCase {
|
||||
|
||||
public function test_utf_8_lower() {
|
||||
@ -50,6 +52,8 @@ class Tests_Functions_CanonicalCharset extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 23688
|
||||
*
|
||||
* @covers ::get_option
|
||||
*/
|
||||
function test_update_option_blog_charset() {
|
||||
$orig_blog_charset = get_option( 'blog_charset' );
|
||||
|
@ -1,16 +1,18 @@
|
||||
<?php
|
||||
/*
|
||||
/**
|
||||
* Test _cleanup_header_comment().
|
||||
*
|
||||
* @group functions.php
|
||||
* @ticket 8497
|
||||
* @ticket 38101
|
||||
*
|
||||
* @group functions.php
|
||||
* @covers ::_cleanup_header_comment
|
||||
*/
|
||||
class Tests_Functions_CleanupHeaderComment extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* Test cleanup header of header comment.
|
||||
*
|
||||
* @covers ::_cleanup_header_comment
|
||||
* @dataProvider data_cleanup_header_comment
|
||||
*
|
||||
* @param string $test_string
|
||||
|
@ -3,10 +3,13 @@
|
||||
/**
|
||||
* Test cases for deprecated functions, arguments, and files
|
||||
*
|
||||
* @package WordPress
|
||||
* @package WordPress
|
||||
* @subpackage Unit Tests
|
||||
* @since 3.5.0
|
||||
* @group deprecated
|
||||
*
|
||||
* @since 3.5.0
|
||||
*
|
||||
* @group functions.php
|
||||
* @group deprecated
|
||||
*/
|
||||
class Tests_Functions_Deprecated extends WP_UnitTestCase {
|
||||
|
||||
@ -140,6 +143,8 @@ class Tests_Functions_Deprecated extends WP_UnitTestCase {
|
||||
*
|
||||
* @ticket 6821
|
||||
* @expectedDeprecated wp_save_image_file
|
||||
*
|
||||
* @covers ::wp_save_image_file
|
||||
*/
|
||||
public function test_wp_save_image_file_deprecated_with_gd_resource() {
|
||||
if ( ! function_exists( 'imagejpeg' ) ) {
|
||||
@ -163,6 +168,8 @@ class Tests_Functions_Deprecated extends WP_UnitTestCase {
|
||||
* Tests that wp_save_image_file() doesn't have a deprecated argument when passed a WP_Image_Editor.
|
||||
*
|
||||
* @ticket 6821
|
||||
*
|
||||
* @covers ::wp_save_image_file
|
||||
*/
|
||||
public function test_wp_save_image_file_not_deprecated_with_wp_image_editor() {
|
||||
if ( ! function_exists( 'imagejpeg' ) ) {
|
||||
|
@ -10,11 +10,11 @@
|
||||
/**
|
||||
* Tests_Functions_DoEnclose class.
|
||||
*
|
||||
* @since 5.3.0
|
||||
*
|
||||
* @group functions.php
|
||||
* @group post
|
||||
* @covers ::do_enclose
|
||||
*
|
||||
* @since 5.3.0
|
||||
*/
|
||||
class Tests_Functions_DoEnclose extends WP_UnitTestCase {
|
||||
|
||||
@ -253,7 +253,7 @@ class Tests_Functions_DoEnclose extends WP_UnitTestCase {
|
||||
* @since 5.3.0
|
||||
*
|
||||
* @param int $post_id Post ID.
|
||||
* @return string All enclosure data for the given post.
|
||||
* @return string All enclosure data for the given post.
|
||||
*/
|
||||
protected function get_enclosed_by_post_id( $post_id ) {
|
||||
return implode( '', (array) get_post_meta( $post_id, 'enclosure', false ) );
|
||||
|
@ -6,6 +6,7 @@
|
||||
* @since 5.3.0
|
||||
*
|
||||
* @group functions.php
|
||||
* @covers ::get_status_header_desc
|
||||
*/
|
||||
class Tests_Functions_GetStatusHeaderDesc extends WP_UnitTestCase {
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
/**
|
||||
* @group functions.php
|
||||
* @covers ::get_weekstartend
|
||||
*/
|
||||
class Tests_Functions_GetWeekstartend extends WP_UnitTestCase {
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
* @since 5.2.0
|
||||
*
|
||||
* @group functions.php
|
||||
* @covers ::is_new_day
|
||||
*/
|
||||
class Tests_Functions_IsNewDate extends WP_UnitTestCase {
|
||||
|
||||
|
@ -3,8 +3,10 @@
|
||||
/**
|
||||
* Tests for `is_serialized_string()`.
|
||||
*
|
||||
* @group functions.php
|
||||
* @ticket 42870
|
||||
*
|
||||
* @group functions.php
|
||||
* @covers ::is_serialized_string
|
||||
*/
|
||||
class Tests_Functions_IsSerializedString extends WP_UnitTestCase {
|
||||
|
||||
|
@ -4,8 +4,10 @@
|
||||
* Test list_files().
|
||||
*
|
||||
* @group functions.php
|
||||
* @covers ::list_files
|
||||
*/
|
||||
class Tests_Functions_ListFiles extends WP_UnitTestCase {
|
||||
|
||||
public function test_list_files_returns_a_list_of_files() {
|
||||
$admin_files = list_files( ABSPATH . 'wp-admin/' );
|
||||
$this->assertInternalType( 'array', $admin_files );
|
||||
|
@ -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;
|
||||
|
@ -5,6 +5,7 @@
|
||||
*
|
||||
* @group functions.php
|
||||
* @group plugins
|
||||
* @covers ::plugin_basename
|
||||
*/
|
||||
class Tests_Functions_PluginBasename extends WP_UnitTestCase {
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -2,8 +2,10 @@
|
||||
|
||||
/**
|
||||
* @group functions.php
|
||||
* @covers ::remove_query_arg
|
||||
*/
|
||||
class Tests_Functions_RemoveQueryArg extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @dataProvider remove_query_arg_provider
|
||||
*/
|
||||
|
@ -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 ),
|
||||
|
@ -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() );
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
/**
|
||||
* @group functions.php
|
||||
* @group query
|
||||
* @covers ::wp
|
||||
*/
|
||||
class Tests_Functions_WP extends WP_UnitTestCase {
|
||||
|
||||
|
@ -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 {
|
||||
|
||||
|
@ -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 {
|
||||
|
||||
|
@ -1,12 +1,9 @@
|
||||
<?php
|
||||
/*
|
||||
$defaults = array(
|
||||
'type' => '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;
|
||||
|
@ -4,6 +4,7 @@
|
||||
* Test wp_get_mime_types().
|
||||
*
|
||||
* @group functions.php
|
||||
* @covers ::wp_get_mime_types
|
||||
*/
|
||||
class Tests_Functions_wpGetMimeTypes extends WP_UnitTestCase {
|
||||
|
||||
|
@ -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 );
|
||||
|
@ -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(
|
||||
|
@ -3,6 +3,7 @@
|
||||
* @group http
|
||||
* @group external-http
|
||||
* @group functions.php
|
||||
* @covers ::wp_remote_fopen
|
||||
*/
|
||||
class Tests_Functions_wpRemoteFopen extends WP_UnitTestCase {
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user