mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
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
This commit is contained in:
@@ -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() ) {
|
||||
|
||||
Reference in New Issue
Block a user