Make WordPress Core

Changeset 40543


Ignore:
Timestamp:
04/23/2017 09:57:31 PM (7 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

Location:
trunk/tests/phpunit
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/testcase.php

    r40542 r40543  
    195195        if ( false !== $travis_pull_request && 'master' !== $travis_branch ) {
    196196            $this->markTestSkipped( 'For automated test runs, this test is only run on trunk/master' );
     197        }
     198    }
     199
     200    /**
     201     * Allow tests to be skipped when Multisite is not in use.
     202     *
     203     * Use in conjunction with the ms-required group.
     204     */
     205    public function skipWithoutMultisite() {
     206        if ( ! is_multisite() ) {
     207            $this->markTestSkipped( 'Test only runs on Multisite' );
     208        }
     209    }
     210
     211    /**
     212     * Allow tests to be skipped when Multisite is in use.
     213     *
     214     * Use in conjunction with the ms-excluded group.
     215     */
     216    public function skipWithMultisite() {
     217        if ( is_multisite() ) {
     218            $this->markTestSkipped( 'Test does not run on Multisite' );
    197219        }
    198220    }
  • trunk/tests/phpunit/tests/adminbar.php

    r40520 r40543  
    7676     */
    7777    public function test_admin_bar_contains_correct_links_for_users_with_no_role() {
    78         if ( is_multisite() ) {
    79             $this->markTestSkipped( 'Test does not run in multisite' );
    80         }
     78        $this->skipWithMultisite();
    8179
    8280        $this->assertFalse( user_can( self::$no_role_id, 'read' ) );
     
    105103     */
    106104    public function test_admin_bar_contains_correct_links_for_users_with_role() {
    107         if ( is_multisite() ) {
    108             $this->markTestSkipped( 'Test does not run in multisite' );
    109         }
     105        $this->skipWithMultisite();
    110106
    111107        $this->assertTrue( user_can( self::$editor_id, 'read' ) );
     
    137133     */
    138134    public function test_admin_bar_contains_correct_links_for_users_with_no_role_on_blog() {
    139         if ( ! is_multisite() ) {
    140             $this->markTestSkipped( 'Test only runs in multisite' );
    141         }
     135        $this->skipWithoutMultisite();
    142136
    143137        $blog_id = self::factory()->blog->create( array(
     
    188182     */
    189183    public function test_admin_bar_contains_correct_links_for_users_with_no_role_on_network() {
    190         if ( ! is_multisite() ) {
    191             $this->markTestSkipped( 'Test only runs in multisite' );
    192         }
     184        $this->skipWithoutMultisite();
    193185
    194186        $this->assertTrue( user_can( self::$admin_id, 'read' ) );
     
    433425     */
    434426    public function test_admin_bar_contains_correct_about_link_for_users_with_role() {
    435         if ( is_multisite() ) {
    436             $this->markTestSkipped( 'Test does not run in multisite' );
    437         }
     427        $this->skipWithMultisite();
    438428
    439429        wp_set_current_user( self::$editor_id );
     
    454444     */
    455445    public function test_admin_bar_contains_correct_about_link_for_users_with_no_role() {
    456         if ( is_multisite() ) {
    457             $this->markTestSkipped( 'Test does not run in multisite' );
    458         }
     446        $this->skipWithMultisite();
    459447
    460448        wp_set_current_user( self::$no_role_id );
     
    477465     */
    478466    public function test_admin_bar_contains_correct_about_link_for_users_with_no_role_in_multisite() {
    479         if ( ! is_multisite() ) {
    480             $this->markTestSkipped( 'Test only runs in multisite' );
    481         }
     467        $this->skipWithoutMultisite();
    482468
    483469        // User is not a member of a site.
     
    597583     */
    598584    public function test_my_sites_network_menu_for_regular_user() {
    599         if ( ! is_multisite() ) {
    600             $this->markTestSkipped( 'Test only runs in multisite' );
    601         }
     585        $this->skipWithoutMultisite();
    602586
    603587        wp_set_current_user( self::$editor_id );
     
    616600     */
    617601    public function test_my_sites_network_menu_for_super_admin() {
    618         if ( ! is_multisite() ) {
    619             $this->markTestSkipped( 'Test only runs in multisite' );
    620         }
     602        $this->skipWithoutMultisite();
    621603
    622604        wp_set_current_user( self::$editor_id );
     
    637619     */
    638620    public function test_my_sites_network_menu_for_regular_user_with_network_caps() {
     621        $this->skipWithoutMultisite();
     622
    639623        global $current_user;
    640 
    641         if ( ! is_multisite() ) {
    642             $this->markTestSkipped( 'Test only runs in multisite' );
    643         }
    644624
    645625        $network_user_caps = array( 'manage_network', 'manage_network_themes', 'manage_network_plugins' );
  • trunk/tests/phpunit/tests/customize/setting.php

    r40520 r40543  
    565565     */
    566566    function test_previewing_with_switch_to_blog() {
    567         if ( ! is_multisite() ) {
    568             $this->markTestSkipped( 'Cannot test WP_Customize_Setting::is_current_blog_previewed() with switch_to_blog() if not on multisite.' );
    569         }
     567        $this->skipWithoutMultisite();
    570568
    571569        wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
  • trunk/tests/phpunit/tests/functions.php

    r40533 r40543  
    939939     */
    940940    function test_wp_check_filetype_and_ext_with_filtered_svg() {
     941        $this->skipWithMultisite();
     942
    941943        if ( ! extension_loaded( 'fileinfo' ) ) {
    942944            $this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
    943         }
    944 
    945         if ( is_multisite() ) {
    946             $this->markTestSkipped( 'Test does not run in multisite' );
    947945        }
    948946
     
    965963    /**
    966964     * @ticket 39550
     965     * @group ms-excluded
    967966     */
    968967    function test_wp_check_filetype_and_ext_with_filtered_woff() {
     968        $this->skipWithMultisite();
     969
    969970        if ( ! extension_loaded( 'fileinfo' ) ) {
    970971            $this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
    971         }
    972 
    973         if ( is_multisite() ) {
    974             $this->markTestSkipped( 'Test does not run in multisite' );
    975972        }
    976973
  • trunk/tests/phpunit/tests/general/template.php

    r40520 r40543  
    7676     */
    7777    function test_has_site_icon_returns_true_when_called_for_other_site_with_site_icon_set() {
    78         if ( ! is_multisite() ) {
    79             $this->markTestSkipped( 'This test requires multisite.' );
    80         }
     78        $this->skipWithoutMultisite();
    8179
    8280        $blog_id = $this->factory->blog->create();
     
    9492     */
    9593    function test_has_site_icon_returns_false_when_called_for_other_site_without_site_icon_set() {
    96         if ( ! is_multisite() ) {
    97             $this->markTestSkipped( 'This test requires multisite.' );
    98         }
     94        $this->skipWithoutMultisite();
    9995
    10096        $blog_id = $this->factory->blog->create();
     
    270266     */
    271267    function test_has_custom_logo_returns_true_when_called_for_other_site_with_custom_logo_set() {
    272         if ( ! is_multisite() ) {
    273             $this->markTestSkipped( 'This test requires multisite.' );
    274         }
     268        $this->skipWithoutMultisite();
    275269
    276270        $blog_id = $this->factory->blog->create();
     
    288282     */
    289283    function test_has_custom_logo_returns_false_when_called_for_other_site_without_custom_logo_set() {
    290         if ( ! is_multisite() ) {
    291             $this->markTestSkipped( 'This test requires multisite.' );
    292         }
     284        $this->skipWithoutMultisite();
    293285
    294286        $blog_id = $this->factory->blog->create();
     
    320312     */
    321313    function test_get_custom_logo_returns_logo_when_called_for_other_site_with_custom_logo_set() {
    322         if ( ! is_multisite() ) {
    323             $this->markTestSkipped( 'This test requires multisite.' );
    324         }
     314        $this->skipWithoutMultisite();
    325315
    326316        $blog_id = $this->factory->blog->create();
     
    543533     */
    544534    function test_get_site_icon_url_preserves_switched_state() {
    545         if ( ! is_multisite() ) {
    546             $this->markTestSkipped( 'This test requires multisite.' );
    547         }
     535        $this->skipWithoutMultisite();
    548536
    549537        $blog_id = $this->factory->blog->create();
     
    566554     */
    567555    function test_has_custom_logo_preserves_switched_state() {
    568         if ( ! is_multisite() ) {
    569             $this->markTestSkipped( 'This test requires multisite.' );
    570         }
     556        $this->skipWithoutMultisite();
    571557
    572558        $blog_id = $this->factory->blog->create();
     
    589575     */
    590576    function test_get_custom_logo_preserves_switched_state() {
    591         if ( ! is_multisite() ) {
    592             $this->markTestSkipped( 'This test requires multisite.' );
    593         }
     577        $this->skipWithoutMultisite();
    594578
    595579        $blog_id = $this->factory->blog->create();
  • trunk/tests/phpunit/tests/l10n/getLocale.php

    r40520 r40543  
    2222     */
    2323    public function test_local_option_should_take_precedence_on_multisite() {
    24         if ( ! is_multisite() ) {
    25             $this->markTestSkipped( __METHOD__ . ' requires Multisite' );
    26         }
     24        $this->skipWithoutMultisite();
    2725
    2826        global $locale;
  • trunk/tests/phpunit/tests/link/getDashboardUrl.php

    r40520 r40543  
    4242     */
    4343    public function test_get_dashboard_url_for_network_administrator_with_no_sites() {
    44         if ( ! is_multisite() ) {
    45             $this->markTestSkipped( 'Test only runs in multisite.' );
    46         }
     44        $this->skipWithoutMultisite();
    4745
    4846        grant_super_admin( self::$user_id );
     
    6361     */
    6462    public function test_get_dashboard_url_for_administrator_of_different_site() {
    65         if ( ! is_multisite() ) {
    66             $this->markTestSkipped( 'Test only runs in multisite.' );
    67         }
     63        $this->skipWithoutMultisite();
    6864
    6965        $site_id = self::factory()->blog->create( array( 'user_id' => self::$user_id ) );
  • trunk/tests/phpunit/tests/oembed/controller.php

    r40520 r40543  
    257257     */
    258258    function test_request_ms_child_in_root_blog() {
    259         if ( ! is_multisite() ) {
    260             $this->markTestSkipped( __METHOD__ . ' is a multisite-only test.' );
    261         }
     259        $this->skipWithoutMultisite();
    262260
    263261        $child = self::factory()->blog->create();
  • trunk/tests/phpunit/tests/option/networkOption.php

    r40520 r40543  
    1717     */
    1818    function test_add_network_option_not_available_on_other_network() {
    19         if ( ! is_multisite() ) {
    20             $this->markTestSkipped( 'Test requires multisite' );
    21         }
     19        $this->skipWithoutMultisite();
    2220
    2321        $id = self::factory()->network->create();
     
    3331     */
    3432    function test_add_network_option_available_on_same_network() {
    35         if ( ! is_multisite() ) {
    36             $this->markTestSkipped( 'Test requires multisite' );
    37         }
     33        $this->skipWithoutMultisite();
    3834
    3935        $id = self::factory()->network->create();
     
    4945     */
    5046    function test_delete_network_option_on_only_one_network() {
    51         if ( ! is_multisite() ) {
    52             $this->markTestSkipped( 'Test requires multisite' );
    53         }
     47        $this->skipWithoutMultisite();
    5448
    5549        $id = self::factory()->network->create();
     
    6862     */
    6963    public function test_add_network_option_is_not_stored_as_autoload_option() {
     64        $this->skipWithMultisite();
     65
    7066        $key = __FUNCTION__;
    71 
    72         if ( is_multisite() ) {
    73             $this->markTestSkipped( 'Does not apply when used in multisite.' );
    74         }
    7567
    7668        add_network_option( null, $key, 'Not an autoload option' );
     
    8678     */
    8779    public function test_update_network_option_is_not_stored_as_autoload_option() {
     80        $this->skipWithMultisite();
     81
    8882        $key = __FUNCTION__;
    89 
    90         if ( is_multisite() ) {
    91             $this->markTestSkipped( 'Does not apply when used in multisite.' );
    92         }
    9383
    9484        update_network_option( null, $key, 'Not an autoload option' );
  • trunk/tests/phpunit/tests/option/siteTransient.php

    r40520 r40543  
    4848     */
    4949    public function test_set_site_transient_is_not_stored_as_autoload_option() {
     50        $this->skipWithMultisite();
     51
    5052        $key = 'not_autoloaded';
    5153
    52         if ( is_multisite() ) {
    53             $this->markTestSkipped( 'Does not apply when used in multisite.' );
    54         }
    5554        set_site_transient( $key, 'Not an autoload option' );
    5655
  • trunk/tests/phpunit/tests/rest-api/rest-users-controller.php

    r40520 r40543  
    997997     */
    998998    public function test_create_new_network_user_on_site_does_not_add_user_to_sub_site() {
    999         if ( ! is_multisite() ) {
    1000             $this->markTestSkipped( 'Test requires multisite.' );
    1001         }
     999        $this->skipWithoutMultisite();
    10021000
    10031001        $this->allow_user_to_manage_multisite();
     
    10291027     */
    10301028    public function test_create_new_network_user_on_sub_site_adds_user_to_site() {
    1031         if ( ! is_multisite() ) {
    1032             $this->markTestSkipped( 'Test requires multisite.' );
    1033         }
     1029        $this->skipWithoutMultisite();
    10341030
    10351031        $this->allow_user_to_manage_multisite();
     
    10651061     */
    10661062    public function test_create_existing_network_user_on_sub_site_has_error() {
    1067         if ( ! is_multisite() ) {
    1068             $this->markTestSkipped( 'Test requires multisite.' );
    1069         }
     1063        $this->skipWithoutMultisite();
    10701064
    10711065        $this->allow_user_to_manage_multisite();
     
    14551449     */
    14561450    public function test_update_user_role_invalid_privilege_deescalation() {
    1457         if ( is_multisite() ) {
    1458             return $this->markTestSkipped( 'Test only intended for single site.' );
    1459         }
     1451        $this->skipWithMultisite();
    14601452
    14611453        $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
     
    14881480     */
    14891481    public function test_update_user_role_privilege_deescalation_multisite() {
    1490         if ( ! is_multisite() ) {
    1491             return $this->markTestSkipped( 'Test only intended for multisite.' );
    1492         }
     1482        $this->skipWithoutMultisite();
    14931483
    14941484        $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
     
    22392229     */
    22402230    public function test_get_item_from_different_site_as_site_administrator() {
    2241         if ( ! is_multisite() ) {
    2242             $this->markTestSkipped( 'Test only runs in multisite' );
    2243         }
     2231        $this->skipWithoutMultisite();
    22442232
    22452233        switch_to_blog( self::$site );
     
    22612249     */
    22622250    public function test_get_item_from_different_site_as_network_administrator() {
    2263         if ( ! is_multisite() ) {
    2264             $this->markTestSkipped( 'Test only runs in multisite' );
    2265         }
     2251        $this->skipWithoutMultisite();
    22662252
    22672253        switch_to_blog( self::$site );
     
    22832269     */
    22842270    public function test_update_item_from_different_site_as_site_administrator() {
    2285         if ( ! is_multisite() ) {
    2286             $this->markTestSkipped( 'Test only runs in multisite' );
    2287         }
     2271        $this->skipWithoutMultisite();
    22882272
    22892273        switch_to_blog( self::$site );
     
    23072291     */
    23082292    public function test_update_item_from_different_site_as_network_administrator() {
    2309         if ( ! is_multisite() ) {
    2310             $this->markTestSkipped( 'Test only runs in multisite' );
    2311         }
     2293        $this->skipWithoutMultisite();
    23122294
    23132295        switch_to_blog( self::$site );
     
    23312313     */
    23322314    public function test_delete_item_from_different_site_as_site_administrator() {
    2333         if ( ! is_multisite() ) {
    2334             $this->markTestSkipped( 'Test only runs in multisite' );
    2335         }
     2315        $this->skipWithoutMultisite();
    23362316
    23372317        switch_to_blog( self::$site );
     
    23552335     */
    23562336    public function test_delete_item_from_different_site_as_network_administrator() {
    2357         if ( ! is_multisite() ) {
    2358             $this->markTestSkipped( 'Test only runs in multisite' );
    2359         }
     2337        $this->skipWithoutMultisite();
    23602338
    23612339        switch_to_blog( self::$site );
  • trunk/tests/phpunit/tests/rewrite.php

    r40520 r40543  
    123123     */
    124124    function test_url_to_postid_of_http_site_when_current_site_uses_https() {
    125         if ( ! is_multisite() ) {
    126             $this->markTestSkipped( 'This test requires multisite' );
    127         }
     125        $this->skipWithoutMultisite();
    128126
    129127        $_SERVER['HTTPS'] = 'on';
     
    320318     */
    321319    function test_url_to_postid_ms_home_url_collision() {
    322 
    323         if ( ! is_multisite() ) {
    324             $this->markTestSkipped( 'test_url_to_postid_ms_home_url_collision requires multisite' );
    325         }
     320        $this->skipWithoutMultisite();
    326321
    327322        $blog_id = self::factory()->blog->create( array( 'path' => '/example' ) );
  • trunk/tests/phpunit/tests/theme/WPTheme.php

    r40520 r40543  
    149149     */
    150150    function test_wp_theme_network_enable_single_theme() {
    151         if ( ! is_multisite() ) {
    152             $this->markTestSkipped( 'This test requires multisite' );
    153         }
     151        $this->skipWithoutMultisite();
    154152
    155153        $theme = 'testtheme-1';
     
    170168     */
    171169    function test_wp_theme_network_enable_multiple_themes() {
    172         if ( ! is_multisite() ) {
    173             $this->markTestSkipped( 'This test requires multisite' );
    174         }
     170        $this->skipWithoutMultisite();
    175171
    176172        $themes = array( 'testtheme-2', 'testtheme-3' );
     
    191187     */
    192188    function test_network_disable_single_theme() {
    193         if ( ! is_multisite() ) {
    194             $this->markTestSkipped( 'This test requires multisite' );
    195         }
     189        $this->skipWithoutMultisite();
    196190
    197191        $current_allowed_themes = get_site_option( 'allowedthemes' );
     
    216210     */
    217211    function test_network_disable_multiple_themes() {
    218         if ( ! is_multisite() ) {
    219             $this->markTestSkipped( 'This test requires multisite' );
    220         }
     212        $this->skipWithoutMultisite();
    221213
    222214        $current_allowed_themes = get_site_option( 'allowedthemes' );
  • trunk/tests/phpunit/tests/user.php

    r40520 r40543  
    653653     */
    654654    function test_illegal_user_logins_multisite() {
    655         if ( ! is_multisite() ) {
    656             $this->markTestSkipped( __METHOD__ . ' requires multisite.' );
    657         }
     655        $this->skipWithoutMultisite();
    658656
    659657        $user_data = array(
  • 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 ) );
  • trunk/tests/phpunit/tests/user/countUsers.php

    r40520 r40543  
    1313     */
    1414    public function test_count_users_is_accurate( $strategy ) {
    15 
    16         if ( is_multisite() ) {
    17             $this->markTestSkipped( 'Test does not run on multisite' );
    18         }
     15        $this->skipWithMultisite();
    1916
    2017        // Setup users
     
    6461     */
    6562    public function test_count_users_multisite_is_accurate( $strategy ) {
    66 
    67         if ( ! is_multisite() ) {
    68             $this->markTestSkipped( 'Test requires multisite' );
    69         }
     63        $this->skipWithoutMultisite();
    7064
    7165        // Setup users
  • trunk/tests/phpunit/tests/user/query.php

    r40530 r40543  
    556556     */
    557557    public function test_roles_and_caps_should_be_populated_for_explicit_value_of_blog_id_on_nonms() {
    558         if ( is_multisite() ) {
    559             $this->markTestSkipped( __METHOD__ . ' is a non-multisite-only test.' );
    560         }
     558        $this->skipWithMultisite();
    561559
    562560        $query = new WP_User_Query( array(
     
    577575     */
    578576    public function test_roles_and_caps_should_be_populated_for_explicit_value_of_current_blog_id_on_ms() {
    579         if ( ! is_multisite() ) {
    580             $this->markTestSkipped( __METHOD__ . ' is a multisite-only test.' );
    581         }
     577        $this->skipWithoutMultisite();
    582578
    583579        $query = new WP_User_Query( array(
     
    598594     */
    599595    public function test_roles_and_caps_should_be_populated_for_explicit_value_of_different_blog_id_on_ms_when_fields_all_with_meta() {
    600         if ( ! is_multisite() ) {
    601             $this->markTestSkipped( __METHOD__ . ' is a multisite-only test.' );
    602         }
     596        $this->skipWithoutMultisite();
    603597
    604598        $b = self::factory()->blog->create();
     
    625619     */
    626620    public function test_roles_and_caps_should_be_populated_for_explicit_value_of_different_blog_id_on_ms_when_fields_all() {
    627         if ( ! is_multisite() ) {
    628             $this->markTestSkipped( __METHOD__ . ' is a multisite-only test.' );
    629         }
     621        $this->skipWithoutMultisite();
    630622
    631623        $b = self::factory()->blog->create();
     
    651643     */
    652644    public function test_who_authors() {
    653         if ( ! is_multisite() ) {
    654             $this->markTestSkipped( __METHOD__ . ' requires multisite.' );
    655         }
     645        $this->skipWithoutMultisite();
    656646
    657647        $b = self::factory()->blog->create();
     
    678668     */
    679669    public function test_who_authors_should_work_alongside_meta_query() {
    680         if ( ! is_multisite() ) {
    681             $this->markTestSkipped( __METHOD__ . ' requires multisite.' );
    682         }
     670        $this->skipWithoutMultisite();
    683671
    684672        $b = self::factory()->blog->create();
     
    714702     */
    715703    public function test_who_authors_should_work_alongside_meta_params() {
    716         if ( ! is_multisite() ) {
    717             $this->markTestSkipped( __METHOD__ . ' requires multisite.' );
    718         }
     704        $this->skipWithoutMultisite();
    719705
    720706        $b = self::factory()->blog->create();
     
    808794     */
    809795    public function test_has_published_posts_should_respect_blog_id() {
    810         if ( ! is_multisite() ) {
    811             $this->markTestSkipped( __METHOD__ . ' requires multisite.' );
    812         }
     796        $this->skipWithoutMultisite();
    813797
    814798        $blogs = self::factory()->blog->create_many( 2 );
     
    13761360     */
    13771361    public function test_blog_id_should_restrict_by_blog_without_requiring_a_named_role() {
    1378         if ( ! is_multisite() ) {
    1379             $this->markTestSkipped( __METHOD__ . ' requires multisite.' );
    1380         }
     1362        $this->skipWithoutMultisite();
    13811363
    13821364        $sites = self::factory()->blog->create_many( 2 );
     
    13991381     */
    14001382    public function test_calling_prepare_query_a_second_time_should_not_add_another_cap_query_on_multisite() {
    1401         if ( ! is_multisite() ) {
    1402             $this->markTestSkipped( __METHOD__ . ' requires Multisite.' );
    1403         }
     1383        $this->skipWithoutMultisite();
    14041384
    14051385        $site_id = get_current_blog_id();
  • trunk/tests/phpunit/tests/user/wpAuthenticateSpamCheck.php

    r40520 r40543  
    1010     */
    1111    function test_wp_authenticate_spam_check_returns_user_when_single_site() {
    12         if ( is_multisite() ) {
    13             $this->markTestSkipped( 'This test applies to single site only.' );
    14         }
     12        $this->skipWithMultisite();
    1513
    1614        $user_id = self::factory()->user->create( array( 'role' => 'contributor' ) );
     
    2624     */
    2725    function test_wp_authenticate_spam_check_returns_user_when_not_flagged() {
    28         if ( ! is_multisite() ) {
    29             $this->markTestSkipped( 'This test applies to multisite only.' );
    30         }
     26        $this->skipWithoutMultisite();
    3127
    3228        $user_id = self::factory()->user->create( array( 'role' => 'contributor' ) );
     
    4238     */
    4339    function test_wp_authenticate_spam_check_returns_wp_error_when_flagged() {
    44         if ( ! is_multisite() ) {
    45             $this->markTestSkipped( 'This test applies to multisite only.' );
    46         }
     40        $this->skipWithoutMultisite();
    4741
    4842        $user_id = self::factory()->user->create( array( 'role' => 'contributor' ) );
  • trunk/tests/phpunit/tests/user/wpDeleteUser.php

    r40520 r40543  
    128128     */
    129129    public function test_numeric_string_user_id() {
    130         if ( is_multisite() ) {
    131             $this->markTestSkipped( 'wp_delete_user() does not delete user records in Multisite.' );
    132         }
     130        $this->skipWithMultisite();
    133131
    134132        $u = self::factory()->user->create();
     
    151149     */
    152150    public function test_should_return_false_for_object_user_id() {
    153         if ( is_multisite() ) {
    154             $this->markTestSkipped( 'wp_delete_user() does not delete user records in Multisite.' );
    155         }
     151        $this->skipWithMultisite();
    156152
    157153        $u_obj = self::factory()->user->create_and_get();
  • trunk/tests/phpunit/tests/user/wpGetUsersWithNoRole.php

    r40522 r40543  
    1111     */
    1212    public function test_get_users_with_no_role_is_accurate() {
    13 
    14         if ( is_multisite() ) {
    15             $this->markTestSkipped( 'Test does not run on multisite' );
    16         }
     13        $this->skipWithMultisite();
    1714
    1815        // Setup users
     
    4643     */
    4744    public function test_get_users_with_no_role_multisite_is_accurate() {
    48 
    49         if ( ! is_multisite() ) {
    50             $this->markTestSkipped( 'Test requires multisite' );
    51         }
     45        $this->skipWithoutMultisite();
    5246
    5347        // Setup users
Note: See TracChangeset for help on using the changeset viewer.