Skip to content

Commit 9cbfedb

Browse files
committed
Tests: Make admin test data providers static.
Declare the data providers in `tests/phpunit/tests/admin/` as `public static` for compatibility with newer PHPUnit versions. Preserve their datasets and assertions. Update direct calls to the submenu provider to use `self::`. Developed in: #14389 Props rejaulalomkhan. See #66211. git-svn-id: https://develop.svn.wordpress.org/trunk@64441 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 30a849a commit 9cbfedb

33 files changed

Lines changed: 62 additions & 62 deletions

‎tests/phpunit/tests/admin/exportWp.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function test_should_include_attachments( array $args, array $expected )
136136
*
137137
* @return array
138138
*/
139-
public function data_should_include_attachments() {
139+
public static function data_should_include_attachments() {
140140
return array(
141141
'for all content' => array(
142142
'args' => array(

‎tests/phpunit/tests/admin/includes/comment/EditComment_Test.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ public function test_should_reject_spam_or_trashed_parent( $comment_approved ) {
415415
*
416416
* @return array[]
417417
*/
418-
public function data_should_reject_spam_or_trashed_parent() {
418+
public static function data_should_reject_spam_or_trashed_parent() {
419419
return array(
420420
'a spam parent' => array( 'spam' ),
421421
'a trashed parent' => array( 'trash' ),

‎tests/phpunit/tests/admin/includes/misc/CustomizerMobileViewportMeta_Test.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function test_customizer_mobile_viewport_meta( $viewport_meta, $expected
2929
* expected: string,
3030
* }>
3131
*/
32-
public function data_customizer_mobile_viewport_meta(): array {
32+
public static function data_customizer_mobile_viewport_meta(): array {
3333
return array(
3434
'default' => array(
3535
'viewport_meta' => 'width=device-width,initial-scale=1.0',

‎tests/phpunit/tests/admin/includes/misc/WpAdminCanonicalUrl_Test.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function test_wp_admin_canonical_url( array $server_vars, $expected ) {
5757
* expected: string
5858
* }>
5959
*/
60-
public function data_wp_admin_canonical_url(): array {
60+
public static function data_wp_admin_canonical_url(): array {
6161
return array(
6262
'no removable query args' => array(
6363
'server_vars' => array(

‎tests/phpunit/tests/admin/includes/misc/WpAdminViewportMeta_Test.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function () use ( $filter_value ) {
3939
* expected: string,
4040
* }>
4141
*/
42-
public function data_wp_admin_viewport_meta(): array {
42+
public static function data_wp_admin_viewport_meta(): array {
4343
return array(
4444
'default value' => array(
4545
'filter_value' => null,

‎tests/phpunit/tests/admin/includes/misc/WpDocLinkParse_Test.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function test_wp_doc_link_parse( $content, $expected ) {
2828
* expected: string[],
2929
* }>
3030
*/
31-
public function data_wp_doc_link_parse(): array {
31+
public static function data_wp_doc_link_parse(): array {
3232
return array(
3333
'empty string' => array(
3434
'content' => '',

‎tests/phpunit/tests/admin/includes/misc/WpHeartbeatSetSuspension_Test.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function test_wp_heartbeat_set_suspension( $pagenow_value, $expected ) {
5959
* expected: string,
6060
* }>
6161
*/
62-
public function data_wp_heartbeat_set_suspension(): array {
62+
public static function data_wp_heartbeat_set_suspension(): array {
6363
return array(
6464
'post.php' => array(
6565
'pagenow_value' => 'post.php',

‎tests/phpunit/tests/admin/includes/misc/WpMakeThemeFileTree_Test.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function test_wp_make_theme_file_tree( $allowed_files, $expected ) {
2828
* expected: array<string, string|array>,
2929
* }>
3030
*/
31-
public function data_wp_make_theme_file_tree(): array {
31+
public static function data_wp_make_theme_file_tree(): array {
3232
return array(
3333
'empty list' => array(
3434
'allowed_files' => array(),

‎tests/phpunit/tests/admin/includes/misc/WpPrivacySettingsFilterDraftPageTitles_Test.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function test_wp_privacy_settings_filter_draft_page_titles( $expected, $t
4040
* screen_id: string,
4141
* }>
4242
*/
43-
public function data_wp_privacy_settings_filter_draft_page_titles(): array {
43+
public static function data_wp_privacy_settings_filter_draft_page_titles(): array {
4444
return array(
4545
'draft page on privacy screen' => array(
4646
'expected' => 'Privacy Policy (Draft)',

‎tests/phpunit/tests/admin/includes/plugin-install/WpGetPluginActionButton_Test.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function test_should_not_return_empty_string_with_proper_capabilities_sin
123123
*
124124
* @return array[]
125125
*/
126-
public function data_capabilities() {
126+
public static function data_capabilities() {
127127
return self::text_array_to_dataprovider( array( 'install_plugins', 'update_plugins' ) );
128128
}
129129

0 commit comments

Comments
 (0)