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/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 );
Note: See TracChangeset for help on using the changeset viewer.