WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/23/2017 09:57:31 PM (2 years ago)
Author:
johnbillion
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user/capabilities.php

    r40520 r40543  
    616616     */
    617617    function test_super_admin_caps() {
    618         if ( ! is_multisite() ) {
    619             $this->markTestSkipped( 'Test only runs in multisite' );
    620         }
     618        $this->skipWithoutMultisite();
     619
    621620        $caps = $this->getAllCapsAndRoles();
    622621        $user = self::$super_admin;
     
    13621361     */
    13631362    function test_borked_current_user_can_for_blog() {
    1364         if ( ! is_multisite() ) {
    1365             $this->markTestSkipped( 'Test only runs in multisite' );
    1366         }
     1363        $this->skipWithoutMultisite();
    13671364
    13681365        $orig_blog_id = get_current_blog_id();
     
    14251422     */
    14261423    function test_multisite_administrator_can_not_edit_users() {
    1427         if ( ! is_multisite() ) {
    1428             $this->markTestSkipped( 'Test only runs in multisite' );
    1429         }
     1424        $this->skipWithoutMultisite();
    14301425
    14311426        $user = self::$users['administrator'];
     
    14611456     */
    14621457    public function test_only_super_admins_can_delete_users_on_multisite() {
    1463         if ( ! is_multisite() ) {
    1464             $this->markTestSkipped( 'Test only runs on multisite' );
    1465         }
     1458        $this->skipWithoutMultisite();
    14661459
    14671460        $this->assertTrue( user_can( self::$super_admin->ID,             'delete_user', self::$users['subscriber']->ID ) );
     
    14781471     */
    14791472    public function test_only_admins_can_delete_users_on_single_site() {
    1480         if ( is_multisite() ) {
    1481             $this->markTestSkipped( 'Test does not run on multisite' );
    1482         }
     1473        $this->skipWithMultisite();
    14831474
    14841475        $this->assertTrue( user_can( self::$users['administrator']->ID, 'delete_user', self::$users['subscriber']->ID ) );
     
    15391530     */
    15401531    function test_multisite_administrator_with_manage_network_users_can_edit_users() {
    1541         if ( ! is_multisite() ) {
    1542             $this->markTestSkipped( 'Test only runs in multisite' );
    1543         }
     1532        $this->skipWithoutMultisite();
    15441533
    15451534        $user = self::$users['administrator'];
     
    15601549     */
    15611550    function test_multisite_administrator_with_manage_network_users_can_not_edit_super_admin() {
    1562         if ( ! is_multisite() ) {
    1563             $this->markTestSkipped( 'Test only runs in multisite' );
    1564         }
     1551        $this->skipWithoutMultisite();
    15651552
    15661553        $user = self::$users['administrator'];
     
    17841771     */
    17851772    public function test_only_super_admins_can_remove_themselves_on_multisite() {
    1786         if ( ! is_multisite() ) {
    1787             $this->markTestSkipped( 'Test only runs in multisite.' );
    1788         }
     1773        $this->skipWithoutMultisite();
    17891774
    17901775        $this->assertTrue( user_can( self::$super_admin->ID, 'remove_user', self::$super_admin->ID ) );
Note: See TracChangeset for help on using the changeset viewer.