From 4f8057f7d5bc9136189c24dd912dbcfbc74e0c7f Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Sat, 22 Apr 2017 18:58:46 +0000 Subject: [PATCH] Build/Test Tools: Introduce `ms-required` and `ms-excluded` groups for tests. Tests in the `ms-excluded` group are now excluded when running tests with multisite enabled, and tests in the `ms-required` group are excluded when running tests without multisite enabled. The end result is a significantly reduced number of skipped tests polluting PHPUnit's output, which means verbose mode can be used to more easily see which tests are skipped or incomplete, and why. See #40531 git-svn-id: https://develop.svn.wordpress.org/trunk@40520 602fd350-edb4-49c9-b593-d223f7449a82 --- phpunit.xml.dist | 1 + tests/phpunit/multisite.xml | 1 + tests/phpunit/tests/adminbar.php | 10 +++++++ tests/phpunit/tests/customize/setting.php | 1 + tests/phpunit/tests/general/template.php | 8 ++++++ tests/phpunit/tests/l10n/getLocale.php | 9 +++++++ tests/phpunit/tests/l10n/getUserLocale.php | 3 +++ tests/phpunit/tests/link/getDashboardUrl.php | 2 ++ tests/phpunit/tests/oembed/controller.php | 1 + tests/phpunit/tests/option/networkOption.php | 12 +++++++++ tests/phpunit/tests/option/siteTransient.php | 1 + .../tests/rest-api/rest-users-controller.php | 21 +++++++++++++++ tests/phpunit/tests/rewrite.php | 5 ++-- tests/phpunit/tests/theme/WPTheme.php | 4 +++ tests/phpunit/tests/user.php | 1 + tests/phpunit/tests/user/capabilities.php | 27 +++++++++++++++---- tests/phpunit/tests/user/countUsers.php | 2 ++ tests/phpunit/tests/user/query.php | 16 +++++++++++ .../tests/user/wpAuthenticateSpamCheck.php | 10 +++++++ tests/phpunit/tests/user/wpDeleteUser.php | 4 +++ 20 files changed, 131 insertions(+), 8 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 415ec76994..aaecb8612c 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -23,6 +23,7 @@ ajax ms-files + ms-required external-http diff --git a/tests/phpunit/multisite.xml b/tests/phpunit/multisite.xml index f30452f1c8..503cfdafa6 100644 --- a/tests/phpunit/multisite.xml +++ b/tests/phpunit/multisite.xml @@ -24,6 +24,7 @@ ajax ms-files + ms-excluded external-http oembed-headers diff --git a/tests/phpunit/tests/adminbar.php b/tests/phpunit/tests/adminbar.php index c9f0873130..3c98a50aa3 100644 --- a/tests/phpunit/tests/adminbar.php +++ b/tests/phpunit/tests/adminbar.php @@ -72,6 +72,7 @@ class Tests_AdminBar extends WP_UnitTestCase { /** * @ticket 25162 + * @group ms-excluded */ public function test_admin_bar_contains_correct_links_for_users_with_no_role() { if ( is_multisite() ) { @@ -100,6 +101,7 @@ class Tests_AdminBar extends WP_UnitTestCase { /** * @ticket 25162 + * @group ms-excluded */ public function test_admin_bar_contains_correct_links_for_users_with_role() { if ( is_multisite() ) { @@ -131,6 +133,7 @@ class Tests_AdminBar extends WP_UnitTestCase { /** * @ticket 25162 * @group multisite + * @group ms-required */ public function test_admin_bar_contains_correct_links_for_users_with_no_role_on_blog() { if ( ! is_multisite() ) { @@ -181,6 +184,7 @@ class Tests_AdminBar extends WP_UnitTestCase { /** * @ticket 25162 * @group multisite + * @group ms-required */ public function test_admin_bar_contains_correct_links_for_users_with_no_role_on_network() { if ( ! is_multisite() ) { @@ -425,6 +429,7 @@ class Tests_AdminBar extends WP_UnitTestCase { /** * @ticket 37949 + * @group ms-excluded */ public function test_admin_bar_contains_correct_about_link_for_users_with_role() { if ( is_multisite() ) { @@ -445,6 +450,7 @@ class Tests_AdminBar extends WP_UnitTestCase { /** * @ticket 37949 + * @group ms-excluded */ public function test_admin_bar_contains_correct_about_link_for_users_with_no_role() { if ( is_multisite() ) { @@ -467,6 +473,7 @@ class Tests_AdminBar extends WP_UnitTestCase { /** * @ticket 37949 * @group multisite + * @group ms-required */ public function test_admin_bar_contains_correct_about_link_for_users_with_no_role_in_multisite() { if ( ! is_multisite() ) { @@ -586,6 +593,7 @@ class Tests_AdminBar extends WP_UnitTestCase { /** * @ticket 39082 + * @group ms-required */ public function test_my_sites_network_menu_for_regular_user() { if ( ! is_multisite() ) { @@ -604,6 +612,7 @@ class Tests_AdminBar extends WP_UnitTestCase { /** * @ticket 39082 + * @group ms-required */ public function test_my_sites_network_menu_for_super_admin() { if ( ! is_multisite() ) { @@ -624,6 +633,7 @@ class Tests_AdminBar extends WP_UnitTestCase { /** * @ticket 39082 + * @group ms-required */ public function test_my_sites_network_menu_for_regular_user_with_network_caps() { global $current_user; diff --git a/tests/phpunit/tests/customize/setting.php b/tests/phpunit/tests/customize/setting.php index 3ee1a8c53f..a857b3d629 100644 --- a/tests/phpunit/tests/customize/setting.php +++ b/tests/phpunit/tests/customize/setting.php @@ -561,6 +561,7 @@ class Tests_WP_Customize_Setting extends WP_UnitTestCase { * * @ticket 31428 * @group multisite + * @group ms-required */ function test_previewing_with_switch_to_blog() { if ( ! is_multisite() ) { diff --git a/tests/phpunit/tests/general/template.php b/tests/phpunit/tests/general/template.php index 16007cf9a9..d6108d6dc6 100644 --- a/tests/phpunit/tests/general/template.php +++ b/tests/phpunit/tests/general/template.php @@ -72,6 +72,7 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @group site_icon * @group multisite + * @group ms-required */ function test_has_site_icon_returns_true_when_called_for_other_site_with_site_icon_set() { if ( ! is_multisite() ) { @@ -89,6 +90,7 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @group site_icon * @group multisite + * @group ms-required */ function test_has_site_icon_returns_false_when_called_for_other_site_without_site_icon_set() { if ( ! is_multisite() ) { @@ -264,6 +266,7 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @group custom_logo * @group multisite + * @group ms-required */ function test_has_custom_logo_returns_true_when_called_for_other_site_with_custom_logo_set() { if ( ! is_multisite() ) { @@ -281,6 +284,7 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @group custom_logo * @group multisite + * @group ms-required */ function test_has_custom_logo_returns_false_when_called_for_other_site_without_custom_logo_set() { if ( ! is_multisite() ) { @@ -312,6 +316,7 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @group custom_logo * @group multisite + * @group ms-required */ function test_get_custom_logo_returns_logo_when_called_for_other_site_with_custom_logo_set() { if ( ! is_multisite() ) { @@ -534,6 +539,7 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @ticket 38253 + * @group ms-required */ function test_get_site_icon_url_preserves_switched_state() { if ( ! is_multisite() ) { @@ -556,6 +562,7 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @ticket 38253 + * @group ms-required */ function test_has_custom_logo_preserves_switched_state() { if ( ! is_multisite() ) { @@ -578,6 +585,7 @@ class Tests_General_Template extends WP_UnitTestCase { /** * @ticket 38253 + * @group ms-required */ function test_get_custom_logo_preserves_switched_state() { if ( ! is_multisite() ) { diff --git a/tests/phpunit/tests/l10n/getLocale.php b/tests/phpunit/tests/l10n/getLocale.php index 64b9900ab4..f6032b3aaf 100644 --- a/tests/phpunit/tests/l10n/getLocale.php +++ b/tests/phpunit/tests/l10n/getLocale.php @@ -17,6 +17,9 @@ class Tests_L10n_GetLocale extends WP_UnitTestCase { $this->assertSame( 'foo', $found ); } + /** + * @group ms-required + */ public function test_local_option_should_take_precedence_on_multisite() { if ( ! is_multisite() ) { $this->markTestSkipped( __METHOD__ . ' requires Multisite' ); @@ -35,6 +38,9 @@ class Tests_L10n_GetLocale extends WP_UnitTestCase { $this->assertSame( 'en_GB', $found ); } + /** + * @group ms-required + */ public function test_network_option_should_be_fallback_on_multisite() { if ( ! is_multisite() ) { $this->markTestSkipped( __METHOD__ . ' requires Multisite' ); @@ -52,6 +58,9 @@ class Tests_L10n_GetLocale extends WP_UnitTestCase { $this->assertSame( 'es_ES', $found ); } + /** + * @group ms-excluded + */ public function test_option_should_be_respected_on_nonmultisite() { if ( is_multisite() ) { $this->markTestSkipped( __METHOD__ . ' does not apply to Multisite' ); diff --git a/tests/phpunit/tests/l10n/getUserLocale.php b/tests/phpunit/tests/l10n/getUserLocale.php index c55642622c..d83b3e9c3e 100644 --- a/tests/phpunit/tests/l10n/getUserLocale.php +++ b/tests/phpunit/tests/l10n/getUserLocale.php @@ -66,6 +66,9 @@ class Tests_Get_User_Locale extends WP_UnitTestCase { $this->assertSame( 'en_US', get_locale() ); } + /** + * @group ms-required + */ public function test_user_locale_is_same_across_network() { if ( ! is_multisite() ) { $this->markTestSkipped( __METHOD__ . ' requires multisite' ); diff --git a/tests/phpunit/tests/link/getDashboardUrl.php b/tests/phpunit/tests/link/getDashboardUrl.php index 4a6be8b901..0d1b1bd82c 100644 --- a/tests/phpunit/tests/link/getDashboardUrl.php +++ b/tests/phpunit/tests/link/getDashboardUrl.php @@ -38,6 +38,7 @@ class Tests_Link_GetDashboardUrl extends WP_UnitTestCase { /** * @ticket 39065 + * @group ms-required */ public function test_get_dashboard_url_for_network_administrator_with_no_sites() { if ( ! is_multisite() ) { @@ -58,6 +59,7 @@ class Tests_Link_GetDashboardUrl extends WP_UnitTestCase { /** * @ticket 39065 + * @group ms-required */ public function test_get_dashboard_url_for_administrator_of_different_site() { if ( ! is_multisite() ) { diff --git a/tests/phpunit/tests/oembed/controller.php b/tests/phpunit/tests/oembed/controller.php index 3c9d051e6f..25d613cad1 100644 --- a/tests/phpunit/tests/oembed/controller.php +++ b/tests/phpunit/tests/oembed/controller.php @@ -253,6 +253,7 @@ class Test_oEmbed_Controller extends WP_UnitTestCase { /** * @group multisite + * @group ms-required */ function test_request_ms_child_in_root_blog() { if ( ! is_multisite() ) { diff --git a/tests/phpunit/tests/option/networkOption.php b/tests/phpunit/tests/option/networkOption.php index 17e96bd8fc..496bb4733c 100644 --- a/tests/phpunit/tests/option/networkOption.php +++ b/tests/phpunit/tests/option/networkOption.php @@ -11,6 +11,10 @@ * @group multisite */ class Tests_Option_NetworkOption extends WP_UnitTestCase { + + /** + * @group ms-required + */ function test_add_network_option_not_available_on_other_network() { if ( ! is_multisite() ) { $this->markTestSkipped( 'Test requires multisite' ); @@ -24,6 +28,9 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase { $this->assertFalse( get_network_option( $id, $option, false ) ); } + /** + * @group ms-required + */ function test_add_network_option_available_on_same_network() { if ( ! is_multisite() ) { $this->markTestSkipped( 'Test requires multisite' ); @@ -37,6 +44,9 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase { $this->assertEquals( $value, get_network_option( $id, $option, false ) ); } + /** + * @group ms-required + */ function test_delete_network_option_on_only_one_network() { if ( ! is_multisite() ) { $this->markTestSkipped( 'Test requires multisite' ); @@ -54,6 +64,7 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase { /** * @ticket 22846 + * @group ms-excluded */ public function test_add_network_option_is_not_stored_as_autoload_option() { $key = __FUNCTION__; @@ -71,6 +82,7 @@ class Tests_Option_NetworkOption extends WP_UnitTestCase { /** * @ticket 22846 + * @group ms-excluded */ public function test_update_network_option_is_not_stored_as_autoload_option() { $key = __FUNCTION__; diff --git a/tests/phpunit/tests/option/siteTransient.php b/tests/phpunit/tests/option/siteTransient.php index 4a9f0e2d38..708712d838 100644 --- a/tests/phpunit/tests/option/siteTransient.php +++ b/tests/phpunit/tests/option/siteTransient.php @@ -44,6 +44,7 @@ class Tests_Option_SiteTransient extends WP_UnitTestCase { /** * @ticket 22846 + * @group ms-excluded */ public function test_set_site_transient_is_not_stored_as_autoload_option() { $key = 'not_autoloaded'; diff --git a/tests/phpunit/tests/rest-api/rest-users-controller.php b/tests/phpunit/tests/rest-api/rest-users-controller.php index 1a81e422d1..9f26371547 100644 --- a/tests/phpunit/tests/rest-api/rest-users-controller.php +++ b/tests/phpunit/tests/rest-api/rest-users-controller.php @@ -992,6 +992,9 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { $this->assertEquals( 'Sorry, that username is not allowed.', $errors['username'] ); } + /** + * @group ms-required + */ public function test_create_new_network_user_on_site_does_not_add_user_to_sub_site() { if ( ! is_multisite() ) { $this->markTestSkipped( 'Test requires multisite.' ); @@ -1021,6 +1024,9 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { $this->assertFalse( $user_is_member ); } + /** + * @group ms-required + */ public function test_create_new_network_user_on_sub_site_adds_user_to_site() { if ( ! is_multisite() ) { $this->markTestSkipped( 'Test requires multisite.' ); @@ -1054,6 +1060,9 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { $this->assertTrue( $user_is_member ); } + /** + * @group ms-required + */ public function test_create_existing_network_user_on_sub_site_has_error() { if ( ! is_multisite() ) { $this->markTestSkipped( 'Test requires multisite.' ); @@ -1441,6 +1450,9 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { $this->assertArrayNotHasKey( 'administrator', $user->caps ); } + /** + * @group ms-excluded + */ public function test_update_user_role_invalid_privilege_deescalation() { if ( is_multisite() ) { return $this->markTestSkipped( 'Test only intended for single site.' ); @@ -1471,6 +1483,9 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { $this->assertArrayNotHasKey( 'editor', $user->caps ); } + /** + * @group ms-required + */ public function test_update_user_role_privilege_deescalation_multisite() { if ( ! is_multisite() ) { return $this->markTestSkipped( 'Test only intended for multisite.' ); @@ -2220,6 +2235,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { /** * @ticket 39701 + * @group ms-required */ public function test_get_item_from_different_site_as_site_administrator() { if ( ! is_multisite() ) { @@ -2241,6 +2257,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { /** * @ticket 39701 + * @group ms-required */ public function test_get_item_from_different_site_as_network_administrator() { if ( ! is_multisite() ) { @@ -2262,6 +2279,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { /** * @ticket 39701 + * @group ms-required */ public function test_update_item_from_different_site_as_site_administrator() { if ( ! is_multisite() ) { @@ -2285,6 +2303,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { /** * @ticket 39701 + * @group ms-required */ public function test_update_item_from_different_site_as_network_administrator() { if ( ! is_multisite() ) { @@ -2308,6 +2327,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { /** * @ticket 39701 + * @group ms-required */ public function test_delete_item_from_different_site_as_site_administrator() { if ( ! is_multisite() ) { @@ -2331,6 +2351,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { /** * @ticket 39701 + * @group ms-required */ public function test_delete_item_from_different_site_as_network_administrator() { if ( ! is_multisite() ) { diff --git a/tests/phpunit/tests/rewrite.php b/tests/phpunit/tests/rewrite.php index dfa9749821..b0b1d551a5 100644 --- a/tests/phpunit/tests/rewrite.php +++ b/tests/phpunit/tests/rewrite.php @@ -119,6 +119,7 @@ class Tests_Rewrite extends WP_UnitTestCase { /** * @ticket 35531 * @group multisite + * @group ms-required */ function test_url_to_postid_of_http_site_when_current_site_uses_https() { if ( ! is_multisite() ) { @@ -315,14 +316,12 @@ class Tests_Rewrite extends WP_UnitTestCase { /** * Reveals bug introduced in WP 3.0 - * - * Run tests using multisite `phpunit -c multisite` + * @group ms-required */ function test_url_to_postid_ms_home_url_collision() { if ( ! is_multisite() ) { $this->markTestSkipped( 'test_url_to_postid_ms_home_url_collision requires multisite' ); - return false; } $blog_id = self::factory()->blog->create( array( 'path' => '/example' ) ); diff --git a/tests/phpunit/tests/theme/WPTheme.php b/tests/phpunit/tests/theme/WPTheme.php index 5f01a25e11..fc660f6201 100644 --- a/tests/phpunit/tests/theme/WPTheme.php +++ b/tests/phpunit/tests/theme/WPTheme.php @@ -145,6 +145,7 @@ class Tests_Theme_WPTheme extends WP_UnitTestCase { * Enable a single theme on a network. * * @ticket 30594 + * @group ms-required */ function test_wp_theme_network_enable_single_theme() { if ( ! is_multisite() ) { @@ -165,6 +166,7 @@ class Tests_Theme_WPTheme extends WP_UnitTestCase { * Enable multiple themes on a network. * * @ticket 30594 + * @group ms-required */ function test_wp_theme_network_enable_multiple_themes() { if ( ! is_multisite() ) { @@ -185,6 +187,7 @@ class Tests_Theme_WPTheme extends WP_UnitTestCase { * Disable a single theme on a network. * * @ticket 30594 + * @group ms-required */ function test_network_disable_single_theme() { if ( ! is_multisite() ) { @@ -209,6 +212,7 @@ class Tests_Theme_WPTheme extends WP_UnitTestCase { * Disable multiple themes on a network. * * @ticket 30594 + * @group ms-required */ function test_network_disable_multiple_themes() { if ( ! is_multisite() ) { diff --git a/tests/phpunit/tests/user.php b/tests/phpunit/tests/user.php index 3d380897e6..917cbc65d3 100644 --- a/tests/phpunit/tests/user.php +++ b/tests/phpunit/tests/user.php @@ -649,6 +649,7 @@ class Tests_User extends WP_UnitTestCase { /** * @ticket 27317 + * @group ms-required */ function test_illegal_user_logins_multisite() { if ( ! is_multisite() ) { diff --git a/tests/phpunit/tests/user/capabilities.php b/tests/phpunit/tests/user/capabilities.php index a47901136c..81ba7cd0ff 100644 --- a/tests/phpunit/tests/user/capabilities.php +++ b/tests/phpunit/tests/user/capabilities.php @@ -611,10 +611,12 @@ class Tests_User_Capabilities extends WP_UnitTestCase { return $data; } + /** + * @group ms-required + */ function test_super_admin_caps() { if ( ! is_multisite() ) { $this->markTestSkipped( 'Test only runs in multisite' ); - return; } $caps = $this->getAllCapsAndRoles(); $user = self::$super_admin; @@ -1355,10 +1357,12 @@ class Tests_User_Capabilities extends WP_UnitTestCase { wp_set_current_user( $old_uid ); } + /** + * @group ms-required + */ function test_borked_current_user_can_for_blog() { if ( ! is_multisite() ) { $this->markTestSkipped( 'Test only runs in multisite' ); - return; } $orig_blog_id = get_current_blog_id(); @@ -1416,10 +1420,12 @@ class Tests_User_Capabilities extends WP_UnitTestCase { $this->assertFalse( current_user_can( 'edit_post', $post + 1 ) ); } + /** + * @group ms-required + */ function test_multisite_administrator_can_not_edit_users() { if ( ! is_multisite() ) { $this->markTestSkipped( 'Test only runs in multisite' ); - return; } $user = self::$users['administrator']; @@ -1450,6 +1456,9 @@ class Tests_User_Capabilities extends WP_UnitTestCase { $this->assertFalse( user_can( self::$users['subscriber']->ID, 'remove_user', self::$users['subscriber']->ID ) ); } + /** + * @group ms-required + */ public function test_only_super_admins_can_delete_users_on_multisite() { if ( ! is_multisite() ) { $this->markTestSkipped( 'Test only runs on multisite' ); @@ -1464,6 +1473,9 @@ class Tests_User_Capabilities extends WP_UnitTestCase { $this->assertFalse( user_can( self::$users['subscriber']->ID, 'delete_user', self::$users['subscriber']->ID ) ); } + /** + * @group ms-excluded + */ public function test_only_admins_can_delete_users_on_single_site() { if ( is_multisite() ) { $this->markTestSkipped( 'Test does not run on multisite' ); @@ -1522,10 +1534,12 @@ class Tests_User_Capabilities extends WP_UnitTestCase { } + /** + * @group ms-required + */ function test_multisite_administrator_with_manage_network_users_can_edit_users() { if ( ! is_multisite() ) { $this->markTestSkipped( 'Test only runs in multisite' ); - return; } $user = self::$users['administrator']; @@ -1541,10 +1555,12 @@ class Tests_User_Capabilities extends WP_UnitTestCase { $this->assertTrue( $can_edit_user ); } + /** + * @group ms-required + */ function test_multisite_administrator_with_manage_network_users_can_not_edit_super_admin() { if ( ! is_multisite() ) { $this->markTestSkipped( 'Test only runs in multisite' ); - return; } $user = self::$users['administrator']; @@ -1764,6 +1780,7 @@ class Tests_User_Capabilities extends WP_UnitTestCase { /** * @ticket 39063 + * @group ms-required */ public function test_only_super_admins_can_remove_themselves_on_multisite() { if ( ! is_multisite() ) { diff --git a/tests/phpunit/tests/user/countUsers.php b/tests/phpunit/tests/user/countUsers.php index d3192bbfa5..337ce1c707 100644 --- a/tests/phpunit/tests/user/countUsers.php +++ b/tests/phpunit/tests/user/countUsers.php @@ -9,6 +9,7 @@ class Tests_User_CountUsers extends WP_UnitTestCase { * @ticket 22993 * * @dataProvider data_count_users_strategies + * @group ms-excluded */ public function test_count_users_is_accurate( $strategy ) { @@ -57,6 +58,7 @@ class Tests_User_CountUsers extends WP_UnitTestCase { /** * @ticket 22993 * @group multisite + * @group ms-required * * @dataProvider data_count_users_strategies */ diff --git a/tests/phpunit/tests/user/query.php b/tests/phpunit/tests/user/query.php index 2cadc916fe..7b5e3c1f6a 100644 --- a/tests/phpunit/tests/user/query.php +++ b/tests/phpunit/tests/user/query.php @@ -551,6 +551,9 @@ class Tests_User_Query extends WP_UnitTestCase { $this->assertSame( array( 'author' => true ), $user->caps ); } + /** + * @group ms-required + */ public function test_roles_and_caps_should_be_populated_for_explicit_value_of_blog_id_on_nonms() { if ( is_multisite() ) { $this->markTestSkipped( __METHOD__ . ' is a non-multisite-only test.' ); @@ -569,6 +572,9 @@ class Tests_User_Query extends WP_UnitTestCase { $this->assertSame( array( 'author' => true ), $user->caps ); } + /** + * @group ms-required + */ public function test_roles_and_caps_should_be_populated_for_explicit_value_of_current_blog_id_on_ms() { if ( ! is_multisite() ) { $this->markTestSkipped( __METHOD__ . ' is a multisite-only test.' ); @@ -587,6 +593,9 @@ class Tests_User_Query extends WP_UnitTestCase { $this->assertSame( array( 'author' => true ), $user->caps ); } + /** + * @group ms-required + */ public function test_roles_and_caps_should_be_populated_for_explicit_value_of_different_blog_id_on_ms_when_fields_all_with_meta() { if ( ! is_multisite() ) { $this->markTestSkipped( __METHOD__ . ' is a multisite-only test.' ); @@ -612,6 +621,7 @@ class Tests_User_Query extends WP_UnitTestCase { /** * @ticket 31878 + * @group ms-required */ public function test_roles_and_caps_should_be_populated_for_explicit_value_of_different_blog_id_on_ms_when_fields_all() { if ( ! is_multisite() ) { @@ -637,6 +647,7 @@ class Tests_User_Query extends WP_UnitTestCase { /** * @ticket 32019 + * @group ms-required */ public function test_who_authors() { if ( ! is_multisite() ) { @@ -663,6 +674,7 @@ class Tests_User_Query extends WP_UnitTestCase { /** * @ticket 32019 + * @group ms-required */ public function test_who_authors_should_work_alongside_meta_query() { if ( ! is_multisite() ) { @@ -698,6 +710,7 @@ class Tests_User_Query extends WP_UnitTestCase { /** * @ticket 36724 + * @group ms-required */ public function test_who_authors_should_work_alongside_meta_params() { if ( ! is_multisite() ) { @@ -791,6 +804,7 @@ class Tests_User_Query extends WP_UnitTestCase { /** * @ticket 32250 + * @group ms-required */ public function test_has_published_posts_should_respect_blog_id() { if ( ! is_multisite() ) { @@ -1358,6 +1372,7 @@ class Tests_User_Query extends WP_UnitTestCase { /** * @ticket 22212 + * @group ms-required */ public function test_blog_id_should_restrict_by_blog_without_requiring_a_named_role() { if ( ! is_multisite() ) { @@ -1380,6 +1395,7 @@ class Tests_User_Query extends WP_UnitTestCase { /** * @ticket 22212 * @ticket 21119 + * @group ms-required */ public function test_calling_prepare_query_a_second_time_should_not_add_another_cap_query_on_multisite() { if ( ! is_multisite() ) { diff --git a/tests/phpunit/tests/user/wpAuthenticateSpamCheck.php b/tests/phpunit/tests/user/wpAuthenticateSpamCheck.php index 7f3b164058..799e219856 100644 --- a/tests/phpunit/tests/user/wpAuthenticateSpamCheck.php +++ b/tests/phpunit/tests/user/wpAuthenticateSpamCheck.php @@ -4,6 +4,10 @@ * @group user */ class Tests_User_WpAuthenticateSpamCheck extends WP_UnitTestCase { + + /** + * @group ms-excluded + */ function test_wp_authenticate_spam_check_returns_user_when_single_site() { if ( is_multisite() ) { $this->markTestSkipped( 'This test applies to single site only.' ); @@ -17,6 +21,9 @@ class Tests_User_WpAuthenticateSpamCheck extends WP_UnitTestCase { $this->assertEquals( $user->user_login, $actual_user->user_login ); } + /** + * @group ms-required + */ function test_wp_authenticate_spam_check_returns_user_when_not_flagged() { if ( ! is_multisite() ) { $this->markTestSkipped( 'This test applies to multisite only.' ); @@ -30,6 +37,9 @@ class Tests_User_WpAuthenticateSpamCheck extends WP_UnitTestCase { $this->assertEquals( $user->user_login, $actual_user->user_login ); } + /** + * @group ms-required + */ function test_wp_authenticate_spam_check_returns_wp_error_when_flagged() { if ( ! is_multisite() ) { $this->markTestSkipped( 'This test applies to multisite only.' ); diff --git a/tests/phpunit/tests/user/wpDeleteUser.php b/tests/phpunit/tests/user/wpDeleteUser.php index 60e7cafede..b733f92bb0 100644 --- a/tests/phpunit/tests/user/wpDeleteUser.php +++ b/tests/phpunit/tests/user/wpDeleteUser.php @@ -123,6 +123,9 @@ class Tests_User_WpDeleteUser extends WP_UnitTestCase { $this->assertEquals( $reassign, $post->post_author ); } + /** + * @group ms-excluded + */ public function test_numeric_string_user_id() { if ( is_multisite() ) { $this->markTestSkipped( 'wp_delete_user() does not delete user records in Multisite.' ); @@ -144,6 +147,7 @@ class Tests_User_WpDeleteUser extends WP_UnitTestCase { /** * @ticket 33800 + * @group ms-excluded */ public function test_should_return_false_for_object_user_id() { if ( is_multisite() ) {