Make WordPress Core


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