Make WordPress Core


Ignore:
Timestamp:
04/23/2017 09:57:31 PM (6 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/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    }
Note: See TracChangeset for help on using the changeset viewer.