mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 07:40:07 +00:00
Build/Test Tools: Introduce skipWithoutMultisite() and skipWithMultisite() methods into the test suite.
This brings much needed uniformity to test skipping when a test requires Multisite or when a test should be excluded from running when Multisite is enabled. Used in conjunction with the `@group ms-required` and `@group ms-excluded` notation, this removes a significant number of skipped tests from the default test suite run. Fixes #40531 git-svn-id: https://develop.svn.wordpress.org/trunk@40543 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -996,9 +996,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
* @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.' );
|
||||
}
|
||||
$this->skipWithoutMultisite();
|
||||
|
||||
$this->allow_user_to_manage_multisite();
|
||||
|
||||
@@ -1028,9 +1026,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
* @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.' );
|
||||
}
|
||||
$this->skipWithoutMultisite();
|
||||
|
||||
$this->allow_user_to_manage_multisite();
|
||||
|
||||
@@ -1064,9 +1060,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
* @group ms-required
|
||||
*/
|
||||
public function test_create_existing_network_user_on_sub_site_has_error() {
|
||||
if ( ! is_multisite() ) {
|
||||
$this->markTestSkipped( 'Test requires multisite.' );
|
||||
}
|
||||
$this->skipWithoutMultisite();
|
||||
|
||||
$this->allow_user_to_manage_multisite();
|
||||
|
||||
@@ -1454,9 +1448,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
* @group ms-excluded
|
||||
*/
|
||||
public function test_update_user_role_invalid_privilege_deescalation() {
|
||||
if ( is_multisite() ) {
|
||||
return $this->markTestSkipped( 'Test only intended for single site.' );
|
||||
}
|
||||
$this->skipWithMultisite();
|
||||
|
||||
$user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
|
||||
|
||||
@@ -1487,9 +1479,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
* @group ms-required
|
||||
*/
|
||||
public function test_update_user_role_privilege_deescalation_multisite() {
|
||||
if ( ! is_multisite() ) {
|
||||
return $this->markTestSkipped( 'Test only intended for multisite.' );
|
||||
}
|
||||
$this->skipWithoutMultisite();
|
||||
|
||||
$user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
|
||||
|
||||
@@ -2238,9 +2228,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
* @group ms-required
|
||||
*/
|
||||
public function test_get_item_from_different_site_as_site_administrator() {
|
||||
if ( ! is_multisite() ) {
|
||||
$this->markTestSkipped( 'Test only runs in multisite' );
|
||||
}
|
||||
$this->skipWithoutMultisite();
|
||||
|
||||
switch_to_blog( self::$site );
|
||||
$user_id = $this->factory->user->create( array(
|
||||
@@ -2260,9 +2248,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
* @group ms-required
|
||||
*/
|
||||
public function test_get_item_from_different_site_as_network_administrator() {
|
||||
if ( ! is_multisite() ) {
|
||||
$this->markTestSkipped( 'Test only runs in multisite' );
|
||||
}
|
||||
$this->skipWithoutMultisite();
|
||||
|
||||
switch_to_blog( self::$site );
|
||||
$user_id = $this->factory->user->create( array(
|
||||
@@ -2282,9 +2268,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
* @group ms-required
|
||||
*/
|
||||
public function test_update_item_from_different_site_as_site_administrator() {
|
||||
if ( ! is_multisite() ) {
|
||||
$this->markTestSkipped( 'Test only runs in multisite' );
|
||||
}
|
||||
$this->skipWithoutMultisite();
|
||||
|
||||
switch_to_blog( self::$site );
|
||||
$user_id = $this->factory->user->create( array(
|
||||
@@ -2306,9 +2290,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
* @group ms-required
|
||||
*/
|
||||
public function test_update_item_from_different_site_as_network_administrator() {
|
||||
if ( ! is_multisite() ) {
|
||||
$this->markTestSkipped( 'Test only runs in multisite' );
|
||||
}
|
||||
$this->skipWithoutMultisite();
|
||||
|
||||
switch_to_blog( self::$site );
|
||||
$user_id = $this->factory->user->create( array(
|
||||
@@ -2330,9 +2312,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
* @group ms-required
|
||||
*/
|
||||
public function test_delete_item_from_different_site_as_site_administrator() {
|
||||
if ( ! is_multisite() ) {
|
||||
$this->markTestSkipped( 'Test only runs in multisite' );
|
||||
}
|
||||
$this->skipWithoutMultisite();
|
||||
|
||||
switch_to_blog( self::$site );
|
||||
$user_id = $this->factory->user->create( array(
|
||||
@@ -2354,9 +2334,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
|
||||
* @group ms-required
|
||||
*/
|
||||
public function test_delete_item_from_different_site_as_network_administrator() {
|
||||
if ( ! is_multisite() ) {
|
||||
$this->markTestSkipped( 'Test only runs in multisite' );
|
||||
}
|
||||
$this->skipWithoutMultisite();
|
||||
|
||||
switch_to_blog( self::$site );
|
||||
$user_id = $this->factory->user->create( array(
|
||||
|
||||
Reference in New Issue
Block a user