Tests: Use the data_ prefix for various data provider methods.

This aims to bring more consistency to the test suite, as the vast majority of data providers already use that prefix.

Includes moving some data providers next to the tests they are used in.

Follow-up to [55464].

See #57841.

git-svn-id: https://develop.svn.wordpress.org/trunk@55562 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2023-03-19 12:03:30 +00:00
parent 81fd448129
commit d1046dc5f3
60 changed files with 680 additions and 679 deletions

View File

@@ -1767,7 +1767,7 @@ class Tests_Functions extends WP_UnitTestCase {
* Test file path validation
*
* @ticket 42016
* @dataProvider data_test_validate_file
* @dataProvider data_validate_file
*
* @param string $file File path.
* @param array $allowed_files List of allowed files.
@@ -1788,7 +1788,7 @@ class Tests_Functions extends WP_UnitTestCase {
* }
* }
*/
public function data_test_validate_file() {
public function data_validate_file() {
return array(
// Allowed files:
@@ -1910,7 +1910,7 @@ class Tests_Functions extends WP_UnitTestCase {
/**
* Test stream URL validation.
*
* @dataProvider data_test_wp_is_stream
* @dataProvider data_wp_is_stream
*
* @param string $path The resource path or URL.
* @param bool $expected Expected result.
@@ -1933,7 +1933,7 @@ class Tests_Functions extends WP_UnitTestCase {
* }
* }
*/
public function data_test_wp_is_stream() {
public function data_wp_is_stream() {
return array(
// Legitimate stream examples.
array( 'http://example.com', true ),
@@ -1954,7 +1954,7 @@ class Tests_Functions extends WP_UnitTestCase {
* Test human_readable_duration().
*
* @ticket 39667
* @dataProvider data_test_human_readable_duration
* @dataProvider data_human_readable_duration
*
* @param string $input Duration.
* @param string $expected Expected human readable duration.
@@ -1973,7 +1973,7 @@ class Tests_Functions extends WP_UnitTestCase {
* }
* }
*/
public function data_test_human_readable_duration() {
public function data_human_readable_duration() {
return array(
// Valid ii:ss cases.
array( '0:0', '0 minutes, 0 seconds' ),
@@ -2030,14 +2030,14 @@ class Tests_Functions extends WP_UnitTestCase {
/**
* @ticket 49404
* @dataProvider data_test_wp_is_json_media_type
* @dataProvider data_wp_is_json_media_type
*/
public function test_wp_is_json_media_type( $input, $expected ) {
$this->assertSame( $expected, wp_is_json_media_type( $input ) );
}
public function data_test_wp_is_json_media_type() {
public function data_wp_is_json_media_type() {
return array(
array( 'application/ld+json', true ),
array( 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"', true ),