Make WordPress Core

Ticket #31130: 31130.2.diff

File 31130.2.diff, 27.6 KB (added by boonebgorges, 9 years ago)
  • src/wp-admin/admin.php

    diff --git src/wp-admin/admin.php src/wp-admin/admin.php
    index d3e58d2..8903efa 100644
    require_once(ABSPATH . 'wp-admin/includes/admin.php'); 
    8484auth_redirect();
    8585
    8686// Schedule trash collection
    87 if ( !wp_next_scheduled('wp_scheduled_delete') && !defined('WP_INSTALLING') )
     87if ( !wp_next_scheduled('wp_scheduled_delete') && ! wp_installing() )
    8888        wp_schedule_event(time(), 'daily', 'wp_scheduled_delete');
    8989
    9090set_screen_options();
  • src/wp-admin/includes/class-wp-upgrader.php

    diff --git src/wp-admin/includes/class-wp-upgrader.php src/wp-admin/includes/class-wp-upgrader.php
    index 65cbab4..52210eb 100644
    class WP_Automatic_Updater { 
    25932593                if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS )
    25942594                        return true;
    25952595
    2596                 if ( defined( 'WP_INSTALLING' ) )
     2596                if ( wp_installing() )
    25972597                        return true;
    25982598
    25992599                // More fine grained control can be done through the WP_AUTO_UPDATE_CORE constant and filters.
    class WP_Automatic_Updater { 
    33683368
    33693369                // Plugins, Themes, Translations
    33703370                foreach ( array( 'plugin', 'theme', 'translation' ) as $type ) {
    3371                
     3371
    33723372                        /**
    33733373                         * Filter to control whether a notification email is sent to the site admin email address for
    33743374                         * plugin, theme, and translation updates.
  • src/wp-admin/includes/file.php

    diff --git src/wp-admin/includes/file.php src/wp-admin/includes/file.php
    index a11bc95..6fa4780 100644
    function request_filesystem_credentials($form_post, $type = '', $error = false, 
    10811081                        $stored_credentials['hostname'] .= ':' . $stored_credentials['port'];
    10821082
    10831083                unset($stored_credentials['password'], $stored_credentials['port'], $stored_credentials['private_key'], $stored_credentials['public_key']);
    1084                 if ( ! defined( 'WP_INSTALLING' ) ) {
     1084                if ( ! wp_installing() ) {
    10851085                        update_option( 'ftp_credentials', $stored_credentials );
    10861086                }
    10871087                return $credentials;
  • src/wp-admin/includes/misc.php

    diff --git src/wp-admin/includes/misc.php src/wp-admin/includes/misc.php
    index 0e104e0..3d71855 100644
    function update_recently_edited( $file ) { 
    243243 * @param string $value
    244244 */
    245245function update_home_siteurl( $old_value, $value ) {
    246         if ( defined( "WP_INSTALLING" ) )
     246        if ( wp_installing() )
    247247                return;
    248248
    249249        if ( is_multisite() && ms_is_switched() ) {
  • src/wp-admin/includes/translation-install.php

    diff --git src/wp-admin/includes/translation-install.php src/wp-admin/includes/translation-install.php
    index 8e1b827..2056838 100644
    function translations_api( $type, $args = null ) { 
    9494 *               in an error, an empty array will be returned.
    9595 */
    9696function wp_get_available_translations() {
    97         if ( ! defined( 'WP_INSTALLING' ) && false !== ( $translations = get_site_transient( 'available_translations' ) ) ) {
     97        if ( ! wp_installing() && false !== ( $translations = get_site_transient( 'available_translations' ) ) ) {
    9898                return $translations;
    9999        }
    100100
  • src/wp-includes/functions.php

    diff --git src/wp-includes/functions.php src/wp-includes/functions.php
    index b658337..c0b6c86 100644
    function _http_build_query( $data, $prefix = null, $sep = null, $key = '', $urle 
    680680 *     add_query_arg( 'key', 'value', 'http://example.com' );
    681681 *
    682682 * Using an associative array:
    683  * 
     683 *
    684684 *     add_query_arg( array(
    685685 *         'key1' => 'value1',
    686686 *         'key2' => 'value2',
    687687 *     ), 'http://example.com' );
    688  * 
     688 *
    689689 * Omitting the URL from either use results in the current URL being used
    690690 * (the value of `$_SERVER['REQUEST_URI']`).
    691  * 
     691 *
    692692 * Values are expected to be encoded appropriately with urlencode() or rawurlencode().
    693693 *
    694694 * Setting any query variable's value to boolean false removes the key (see remove_query_arg()).
    function do_robots() { 
    12601260}
    12611261
    12621262/**
     1263 * Check or set whether WordPress is in "installation" mode.
     1264 *
     1265 * If the `WP_INSTALLING` constant is defined during the bootstrap, `wp_installing()` will default to `true`.
     1266 *
     1267 * @since 4.4.0
     1268 *
     1269 * @staticvar bool $installing
     1270 *
     1271 * @param bool $is_installing Optional. True to set WP into Installing mode, false to turn Installing mode off.
     1272 *                            Omit this parameter to fetch the current value.
     1273 * @return bool True if WP is installing, otherwise false.
     1274 */
     1275function wp_installing( $is_installing = null ) {
     1276        static $installing = null;
     1277
     1278        // Support for the `WP_INSTALLING` constant, defined before WP is loaded.
     1279        if ( is_null( $installing ) ) {
     1280                $installing = defined( 'WP_INSTALLING' ) && WP_INSTALLING;
     1281        }
     1282
     1283        if ( ! is_null( $is_installing ) ) {
     1284                $old_installing = $installing;
     1285                $installing = $is_installing;
     1286                return (bool) $old_installing;
     1287        }
     1288
     1289        return (bool) $installing;
     1290}
     1291
     1292/**
    12631293 * Test whether blog is already installed.
    12641294 *
    12651295 * The cache will be checked first. If you have a cache plugin, which saves
    function is_blog_installed() { 
    12851315                return true;
    12861316
    12871317        $suppress = $wpdb->suppress_errors();
    1288         if ( ! defined( 'WP_INSTALLING' ) ) {
     1318        if ( ! wp_installing() ) {
    12891319                $alloptions = wp_load_alloptions();
    12901320        }
    12911321        // If siteurl is not set to autoload, check it specifically
    function dead_db() { 
    33353365        }
    33363366
    33373367        // If installing or in the admin, provide the verbose message.
    3338         if ( defined('WP_INSTALLING') || defined('WP_ADMIN') )
     3368        if ( wp_installing() || defined('WP_ADMIN') )
    33393369                wp_die($wpdb->error);
    33403370
    33413371        // Otherwise, be terse.
  • src/wp-includes/l10n.php

    diff --git src/wp-includes/l10n.php src/wp-includes/l10n.php
    index d9b0594..b080c9e 100644
    function get_locale() { 
    5353        // If multisite, check options.
    5454        if ( is_multisite() ) {
    5555                // Don't check blog option when installing.
    56                 if ( defined( 'WP_INSTALLING' ) || ( false === $ms_locale = get_option( 'WPLANG' ) ) ) {
     56                if ( wp_installing() || ( false === $ms_locale = get_option( 'WPLANG' ) ) ) {
    5757                        $ms_locale = get_site_option( 'WPLANG' );
    5858                }
    5959
    function load_default_textdomain( $locale = null ) { 
    565565                return $return;
    566566        }
    567567
    568         if ( is_admin() || defined( 'WP_INSTALLING' ) || ( defined( 'WP_REPAIRING' ) && WP_REPAIRING ) ) {
     568        if ( is_admin() || wp_installing() || ( defined( 'WP_REPAIRING' ) && WP_REPAIRING ) ) {
    569569                load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo" );
    570570        }
    571571
  • src/wp-includes/load.php

    diff --git src/wp-includes/load.php src/wp-includes/load.php
    index 560511a..8ca2f2c 100644
    function wp_favicon_request() { 
    165165 * @global int $upgrading the unix timestamp marking when upgrading WordPress began.
    166166 */
    167167function wp_maintenance() {
    168         if ( !file_exists( ABSPATH . '.maintenance' ) || defined( 'WP_INSTALLING' ) )
     168        if ( !file_exists( ABSPATH . '.maintenance' ) || wp_installing() )
    169169                return;
    170170
    171171        global $upgrading;
    function wp_start_object_cache() { 
    475475 */
    476476function wp_not_installed() {
    477477        if ( is_multisite() ) {
    478                 if ( ! is_blog_installed() && ! defined( 'WP_INSTALLING' ) ) {
     478                if ( ! is_blog_installed() && ! wp_installing() ) {
    479479                        nocache_headers();
    480480
    481481                        wp_die( __( 'The site you have requested is not installed properly. Please contact the system administrator.' ) );
    482482                }
    483         } elseif ( ! is_blog_installed() && ! defined( 'WP_INSTALLING' ) ) {
     483        } elseif ( ! is_blog_installed() && ! wp_installing() ) {
    484484                nocache_headers();
    485485
    486486                require( ABSPATH . WPINC . '/kses.php' );
    function wp_get_mu_plugins() { 
    539539function wp_get_active_and_valid_plugins() {
    540540        $plugins = array();
    541541        $active_plugins = (array) get_option( 'active_plugins', array() );
    542         if ( empty( $active_plugins ) || defined( 'WP_INSTALLING' ) )
     542        if ( empty( $active_plugins ) || wp_installing() )
    543543                return $plugins;
    544544
    545545        $network_plugins = is_multisite() ? wp_get_active_network_plugins() : false;
  • src/wp-includes/ms-functions.php

    diff --git src/wp-includes/ms-functions.php src/wp-includes/ms-functions.php
    index d6a9861..2a08a19 100644
    function wpmu_create_blog( $domain, $path, $title, $user_id, $meta = array(), $s 
    11741174        if ( domain_exists($domain, $path, $site_id) )
    11751175                return new WP_Error( 'blog_taken', __( 'Sorry, that site already exists!' ) );
    11761176
    1177         if ( !defined('WP_INSTALLING') )
    1178                 define( 'WP_INSTALLING', true );
     1177        if ( ! wp_installing() ) {
     1178                wp_installing( true );
     1179        }
    11791180
    11801181        if ( ! $blog_id = insert_blog($domain, $path, $site_id) )
    11811182                return new WP_Error('insert_blog', __('Could not create site.'));
    function wp_schedule_update_network_counts() { 
    22282229        if ( !is_main_site() )
    22292230                return;
    22302231
    2231         if ( !wp_next_scheduled('update_network_counts') && !defined('WP_INSTALLING') )
     2232        if ( !wp_next_scheduled('update_network_counts') && ! wp_installing() )
    22322233                wp_schedule_event(time(), 'twicedaily', 'update_network_counts');
    22332234}
    22342235
  • src/wp-includes/ms-settings.php

    diff --git src/wp-includes/ms-settings.php src/wp-includes/ms-settings.php
    index 00da6da..8bb5c2f 100644
    if ( !isset( $current_site ) || !isset( $current_blog ) ) { 
    136136        }
    137137
    138138        // @todo Investigate when exactly this can occur.
    139         if ( empty( $current_blog ) && defined( 'WP_INSTALLING' ) ) {
     139        if ( empty( $current_blog ) && wp_installing() ) {
    140140                $current_blog = new stdClass;
    141141                $current_blog->blog_id = $blog_id = 1;
    142142        }
  • src/wp-includes/option.php

    diff --git src/wp-includes/option.php src/wp-includes/option.php
    index ab8f81b..6de667e 100644
    function get_option( $option, $default = false ) { 
    5353        if ( defined( 'WP_SETUP_CONFIG' ) )
    5454                return false;
    5555
    56         if ( ! defined( 'WP_INSTALLING' ) ) {
     56        if ( ! wp_installing() ) {
    5757                // prevent non-existent options from triggering multiple queries
    5858                $notoptions = wp_cache_get( 'notoptions', 'options' );
    5959                if ( isset( $notoptions[ $option ] ) ) {
    function form_option( $option ) { 
    171171function wp_load_alloptions() {
    172172        global $wpdb;
    173173
    174         if ( !defined( 'WP_INSTALLING' ) || !is_multisite() )
     174        if ( ! wp_installing() || ! is_multisite() )
    175175                $alloptions = wp_cache_get( 'alloptions', 'options' );
    176176        else
    177177                $alloptions = false;
    function wp_load_alloptions() { 
    185185                foreach ( (array) $alloptions_db as $o ) {
    186186                        $alloptions[$o->option_name] = $o->option_value;
    187187                }
    188                 if ( !defined( 'WP_INSTALLING' ) || !is_multisite() )
     188                if ( ! wp_installing() || ! is_multisite() )
    189189                        wp_cache_add( 'alloptions', $alloptions, 'options' );
    190190        }
    191191
    function wp_load_alloptions() { 
    204204function wp_load_core_site_options( $site_id = null ) {
    205205        global $wpdb;
    206206
    207         if ( !is_multisite() || wp_using_ext_object_cache() || defined( 'WP_INSTALLING' ) )
     207        if ( ! is_multisite() || wp_using_ext_object_cache() || wp_installing() )
    208208                return;
    209209
    210210        if ( empty($site_id) )
    function update_option( $option, $value, $autoload = null ) { 
    332332                wp_cache_set( 'notoptions', $notoptions, 'options' );
    333333        }
    334334
    335         if ( ! defined( 'WP_INSTALLING' ) ) {
     335        if ( ! wp_installing() ) {
    336336                $alloptions = wp_load_alloptions();
    337337                if ( isset( $alloptions[$option] ) ) {
    338338                        $alloptions[ $option ] = $serialized_value;
    function add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' ) 
    433433        if ( ! $result )
    434434                return false;
    435435
    436         if ( ! defined( 'WP_INSTALLING' ) ) {
     436        if ( ! wp_installing() ) {
    437437                if ( 'yes' == $autoload ) {
    438438                        $alloptions = wp_load_alloptions();
    439439                        $alloptions[ $option ] = $serialized_value;
    function delete_option( $option ) { 
    509509        do_action( 'delete_option', $option );
    510510
    511511        $result = $wpdb->delete( $wpdb->options, array( 'option_name' => $option ) );
    512         if ( ! defined( 'WP_INSTALLING' ) ) {
     512        if ( ! wp_installing() ) {
    513513                if ( 'yes' == $row->autoload ) {
    514514                        $alloptions = wp_load_alloptions();
    515515                        if ( is_array( $alloptions ) && isset( $alloptions[$option] ) ) {
    function get_transient( $transient ) { 
    629629                $value = wp_cache_get( $transient, 'transient' );
    630630        } else {
    631631                $transient_option = '_transient_' . $transient;
    632                 if ( ! defined( 'WP_INSTALLING' ) ) {
     632                if ( ! wp_installing() ) {
    633633                        // If option is not in alloptions, it is not autoloaded and thus has a timeout
    634634                        $alloptions = wp_load_alloptions();
    635635                        if ( !isset( $alloptions[$transient_option] ) ) {
  • src/wp-includes/script-loader.php

    diff --git src/wp-includes/script-loader.php src/wp-includes/script-loader.php
    index f5648a7..6f59c57 100644
    function wp_just_in_time_script_localization() { 
    829829function wp_style_loader_src( $src, $handle ) {
    830830        global $_wp_admin_css_colors;
    831831
    832         if ( defined('WP_INSTALLING') )
     832        if ( wp_installing() )
    833833                return preg_replace( '#^wp-admin/#', './', $src );
    834834
    835835        if ( 'colors' == $handle ) {
  • src/wp-includes/theme.php

    diff --git src/wp-includes/theme.php src/wp-includes/theme.php
    index 906da51..e1a0334 100644
    function validate_current_theme() { 
    771771         *
    772772         * @param bool true Validation flag to check the current theme.
    773773         */
    774         if ( defined('WP_INSTALLING') || ! apply_filters( 'validate_current_theme', true ) )
     774        if ( wp_installing() || ! apply_filters( 'validate_current_theme', true ) )
    775775                return true;
    776776
    777777        if ( get_template() != WP_DEFAULT_THEME && !file_exists(get_template_directory() . '/index.php') ) {
  • src/wp-includes/update.php

    diff --git src/wp-includes/update.php src/wp-includes/update.php
    index c39322e..9814ea4 100644
     
    2222 * @param bool  $force_check Whether to bypass the transient cache and force a fresh update check. Defaults to false, true if $extra_stats is set.
    2323 */
    2424function wp_version_check( $extra_stats = array(), $force_check = false ) {
    25         if ( defined( 'WP_INSTALLING' ) ) {
     25        if ( wp_installing() ) {
    2626                return;
    2727        }
    2828
    function wp_version_check( $extra_stats = array(), $force_check = false ) { 
    187187 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
    188188 */
    189189function wp_update_plugins( $extra_stats = array() ) {
    190         if ( defined( 'WP_INSTALLING' ) ) {
     190        if ( wp_installing() ) {
    191191                return;
    192192        }
    193193
    function wp_update_plugins( $extra_stats = array() ) { 
    344344 * @param array $extra_stats Extra statistics to report to the WordPress.org API.
    345345 */
    346346function wp_update_themes( $extra_stats = array() ) {
    347         if ( defined( 'WP_INSTALLING' ) ) {
     347        if ( wp_installing() ) {
    348348                return;
    349349        }
    350350        global $wp_version;
    function _maybe_update_themes() { 
    636636 * @since 3.1.0
    637637 */
    638638function wp_schedule_update_checks() {
    639         if ( !wp_next_scheduled('wp_version_check') && !defined('WP_INSTALLING') )
     639        if ( ! wp_next_scheduled('wp_version_check') && ! wp_installing() )
    640640                wp_schedule_event(time(), 'twicedaily', 'wp_version_check');
    641641
    642         if ( !wp_next_scheduled('wp_update_plugins') && !defined('WP_INSTALLING') )
     642        if ( ! wp_next_scheduled('wp_update_plugins') && ! wp_installing() )
    643643                wp_schedule_event(time(), 'twicedaily', 'wp_update_plugins');
    644644
    645         if ( !wp_next_scheduled('wp_update_themes') && !defined('WP_INSTALLING') )
     645        if ( ! wp_next_scheduled('wp_update_themes') && ! wp_installing() )
    646646                wp_schedule_event(time(), 'twicedaily', 'wp_update_themes');
    647647
    648         if ( ! wp_next_scheduled( 'wp_maybe_auto_update' ) && ! defined( 'WP_INSTALLING' ) ) {
     648        if ( ! wp_next_scheduled( 'wp_maybe_auto_update' ) && ! wp_installing() ) {
    649649                // Schedule auto updates for 7 a.m. and 7 p.m. in the timezone of the site.
    650650                $next = strtotime( 'today 7am' );
    651651                $now = time();
  • src/wp-settings.php

    diff --git src/wp-settings.php src/wp-settings.php
    index 993a120..9a3afd8 100644
    require_once( ABSPATH . WPINC . '/locale.php' ); 
    321321$GLOBALS['wp_locale'] = new WP_Locale();
    322322
    323323// Load the functions for the active theme, for both parent and child theme if applicable.
    324 if ( ! defined( 'WP_INSTALLING' ) || 'wp-activate.php' === $pagenow ) {
     324if ( ! wp_installing() || 'wp-activate.php' === $pagenow ) {
    325325        if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) )
    326326                include( STYLESHEETPATH . '/functions.php' );
    327327        if ( file_exists( TEMPLATEPATH . '/functions.php' ) )
  • tests/phpunit/includes/factory.php

    diff --git tests/phpunit/includes/factory.php tests/phpunit/includes/factory.php
    index 20bad89..bc8ea09 100644
    class WP_UnitTest_Factory_For_Blog extends WP_UnitTest_Factory_For_Thing { 
    173173                $suppress = $wpdb->suppress_errors();
    174174                $blog = wpmu_create_blog( $args['domain'], $args['path'], $args['title'], $user_id, $meta, $args['site_id'] );
    175175                $wpdb->suppress_errors( $suppress );
     176
     177                // Tell WP we're done installing.
     178                wp_installing( false );
     179
    176180                return $blog;
    177181        }
    178182
  • tests/phpunit/includes/testcase.php

    diff --git tests/phpunit/includes/testcase.php tests/phpunit/includes/testcase.php
    index e660e95..f5a7db8 100644
    class WP_UnitTestCase extends PHPUnit_Framework_TestCase { 
    1414        protected static $hooks_saved = array();
    1515        protected static $ignore_files;
    1616
    17         protected $db_version;
    18 
    1917        /**
    2018         * @var WP_UnitTest_Factory
    2119         */
    class WP_UnitTestCase extends PHPUnit_Framework_TestCase { 
    5755                add_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) );
    5856
    5957                add_filter( 'wp_mail', array( $this, 'set_wp_mail_globals' ) );
    60 
    61                 /*
    62                  * During multisite tests, WP_INSTALLING forces `get_option()` to miss the cache, which causes problems
    63                  * with our query-counting cache tests. As a workaround in the case of tests that require checking
    64                  * 'db_version' (such as any test that uses the Term Meta API), we filter 'pre_option_db_version' and
    65                  * avoid hitting the database.
    66                  *
    67                  * See #31130.
    68                  */
    69                 $this->db_version = get_option( 'db_version' );
    70                 if ( is_multisite() ) {
    71                         add_filter( 'pre_option_db_version', array( $this, 'db_version' ) );
    72                 }
    7358        }
    7459
    7560        /**
    class WP_UnitTestCase extends PHPUnit_Framework_TestCase { 
    632617                        return wp_delete_user( $user_id );
    633618                }
    634619        }
    635 
    636         /**
    637          * Return the current database version without hitting the database.
    638          *
    639          * This is used to bypass cache problems with some multisite tests. See #31130.
    640          *
    641          * @todo Don't do this anymore once #31130 is fixed.
    642          *
    643          * @since 4.4.0
    644          */
    645         public function db_version() {
    646                 return $this->db_version;
    647         }
    648620}
  • tests/phpunit/tests/comment/getPageOfComment.php

    diff --git tests/phpunit/tests/comment/getPageOfComment.php tests/phpunit/tests/comment/getPageOfComment.php
    index 78e53d5..1e57023 100644
    class Tests_Comment_GetPageOfComment extends WP_UnitTestCase { 
    6060         * @ticket 11334
    6161         */
    6262        public function test_subsequent_calls_should_hit_cache() {
    63                 // `get_page_of_comment()` calls `get_option()`, which is not properly cached when WP_INSTALLING.
    64                 if ( is_multisite() ) {
    65                         $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' );
    66                 }
    67 
    6863                global $wpdb;
    6964
    7065                $p = $this->factory->post->create();
  • tests/phpunit/tests/general/archives.php

    diff --git tests/phpunit/tests/general/archives.php tests/phpunit/tests/general/archives.php
    index 23d1131..b70b5e3 100644
    class Tests_General_Archives extends WP_UnitTestCase { 
    1616        function test_get_archives_cache() {
    1717                global $wpdb;
    1818
    19                 if ( is_multisite() ) {
    20                         $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' );
    21                 }
    22 
    2319                $this->factory->post->create_many( 15, array( 'post_type' => 'post' ) );
    2420                wp_cache_delete( 'last_changed', 'posts' );
    2521                $this->assertFalse( wp_cache_get( 'last_changed', 'posts' ) );
    class Tests_General_Archives extends WP_UnitTestCase { 
    112108                $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) );
    113109                $this->assertEquals( $num_queries, $wpdb->num_queries );
    114110        }
    115 }
    116  No newline at end of file
     111}
  • tests/phpunit/tests/option/transient.php

    diff --git tests/phpunit/tests/option/transient.php tests/phpunit/tests/option/transient.php
    index 3dbd79d..ada1f84 100644
    class Tests_Option_Transient extends WP_UnitTestCase { 
    3838         * @ticket 22807
    3939         */
    4040        function test_transient_data_with_timeout() {
    41                 if ( is_multisite() ) {
    42                         $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING.' );
    43                 }
    44 
    4541                if ( wp_using_ext_object_cache() ) {
    4642                        $this->markTestSkipped( 'Not testable with an external object cache.' );
    4743                }
    class Tests_Option_Transient extends WP_UnitTestCase { 
    6763         * @ticket 22807
    6864         */
    6965        function test_transient_add_timeout() {
    70                 if ( is_multisite() ) {
    71                         $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING.' );
    72                 }
    73 
    7466                if ( wp_using_ext_object_cache() ) {
    7567                        $this->markTestSkipped( 'Not testable with an external object cache.' );
    7668                }
    class Tests_Option_Transient extends WP_UnitTestCase { 
    130122         * @ticket 30380
    131123         */
    132124        function test_nonexistent_key_old_timeout() {
    133                 if ( is_multisite() ) {
    134                         $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING.' );
    135                 }
    136 
    137125                if ( wp_using_ext_object_cache() ) {
    138126                        $this->markTestSkipped( 'Not testable with an external object cache.' );
    139127                }
  • tests/phpunit/tests/option/updateOption.php

    diff --git tests/phpunit/tests/option/updateOption.php tests/phpunit/tests/option/updateOption.php
    index 4171a73..cddc46c 100644
    class Tests_Option_UpdateOption extends WP_UnitTestCase { 
    2020         * @ticket 26394
    2121         */
    2222        public function test_should_set_autoload_yes_for_nonexistent_option_when_autoload_param_is_missing() {
    23                 if ( is_multisite() ) {
    24                         $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' );
    25                 }
    26 
    2723                global $wpdb;
    2824                wp_cache_flush();
    2925                update_option( 'test_update_option_default', 'value' );
    class Tests_Option_UpdateOption extends WP_UnitTestCase { 
    4440         * @ticket 26394
    4541         */
    4642        public function test_should_set_autoload_yes_for_nonexistent_option_when_autoload_param_is_yes() {
    47                 if ( is_multisite() ) {
    48                         $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' );
    49                 }
    50 
    5143                global $wpdb;
    5244                wp_cache_flush();
    5345                update_option( 'test_update_option_default', 'value', 'yes' );
    class Tests_Option_UpdateOption extends WP_UnitTestCase { 
    6860         * @ticket 26394
    6961         */
    7062        public function test_should_set_autoload_no_for_nonexistent_option_when_autoload_param_is_no() {
    71                 if ( is_multisite() ) {
    72                         $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' );
    73                 }
    74 
    7563                global $wpdb;
    7664                wp_cache_flush();
    7765                update_option( 'test_update_option_default', 'value', 'no' );
    class Tests_Option_UpdateOption extends WP_UnitTestCase { 
    9381         * @ticket 26394
    9482         */
    9583        public function test_should_set_autoload_no_for_nonexistent_option_when_autoload_param_is_false() {
    96                 if ( is_multisite() ) {
    97                         $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' );
    98                 }
    99 
    10084                global $wpdb;
    10185                wp_cache_flush();
    10286                update_option( 'test_update_option_default', 'value', false );
    class Tests_Option_UpdateOption extends WP_UnitTestCase { 
    118102         * @group 26394
    119103         */
    120104        public function test_autoload_should_be_updated_for_existing_option_when_value_is_changed() {
    121                 if ( is_multisite() ) {
    122                         $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' );
    123                 }
    124 
    125105                global $wpdb;
    126106                add_option( 'foo', 'bar', '', 'no' );
    127107                $updated = update_option( 'foo', 'bar2', true );
    class Tests_Option_UpdateOption extends WP_UnitTestCase { 
    143123         * @group 26394
    144124         */
    145125        public function test_autoload_should_not_be_updated_for_existing_option_when_value_is_unchanged() {
    146                 if ( is_multisite() ) {
    147                         $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' );
    148                 }
    149 
    150126                global $wpdb;
    151127                add_option( 'foo', 'bar', '', 'yes' );
    152128                $updated = update_option( 'foo', 'bar', false );
    class Tests_Option_UpdateOption extends WP_UnitTestCase { 
    169145         * @group 26394
    170146         */
    171147        public function test_autoload_should_not_be_updated_for_existing_option_when_value_is_changed_but_no_value_of_autoload_is_provided() {
    172                 if ( is_multisite() ) {
    173                         $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' );
    174                 }
    175 
    176148                global $wpdb;
    177149                add_option( 'foo', 'bar', '', 'yes' );
    178150
  • tests/phpunit/tests/post/getPostClass.php

    diff --git tests/phpunit/tests/post/getPostClass.php tests/phpunit/tests/post/getPostClass.php
    index 5e64e33..8d29c40 100644
    class Tests_Post_GetPostClass extends WP_UnitTestCase { 
    108108        public function test_taxonomy_classes_hit_cache() {
    109109                global $wpdb;
    110110
    111                 if ( is_multisite() ) {
    112                         $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' );
    113                 }
    114 
    115111                register_taxonomy( 'wptests_tax', 'post' );
    116112                wp_set_post_terms( $this->post_id, array( 'foo', 'bar' ), 'wptests_tax' );
    117113                wp_set_post_terms( $this->post_id, array( 'footag', 'bartag' ), 'post_tag' );
  • tests/phpunit/tests/term/getTerms.php

    diff --git tests/phpunit/tests/term/getTerms.php tests/phpunit/tests/term/getTerms.php
    index f1db1aa..5256b82 100644
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    382382        public function test_child_of_should_skip_query_when_specified_parent_is_not_found_in_hierarchy_cache() {
    383383                global $wpdb;
    384384
    385                 if ( is_multisite() ) {
    386                         $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' );
    387                 }
    388 
    389385                register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true, ) );
    390386
    391387                $terms = $this->factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
    class Tests_Term_getTerms extends WP_UnitTestCase { 
    13271323        public function test_parent_should_skip_query_when_specified_parent_is_not_found_in_hierarchy_cache() {
    13281324                global $wpdb;
    13291325
    1330                 if ( is_multisite() ) {
    1331                         $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' );
    1332                 }
    1333 
    13341326                register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true, ) );
    13351327
    13361328                $terms = $this->factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) );
  • tests/phpunit/tests/term/wpInsertTerm.php

    diff --git tests/phpunit/tests/term/wpInsertTerm.php tests/phpunit/tests/term/wpInsertTerm.php
    index 09b0ea2..a7984c3 100644
    class Tests_Term_WpInsertTerm extends WP_UnitTestCase { 
    468468         * @ticket 5809
    469469         */
    470470        public function test_wp_insert_term_duplicate_slug_different_taxonomy_before_410_schema_change() {
    471 
    472                 // See #31130.
    473471                $old_db_version = 30055;
    474                 if ( is_multisite() ) {
    475                         $_db_version = $this->db_version;
    476                         $this->db_version = $old_db_version;
    477                 } else {
    478                         update_option( 'db_version', $old_db_version );
    479                 }
     472                update_option( 'db_version', $old_db_version );
    480473
    481474                register_taxonomy( 'wptests_tax', 'post' );
    482475                register_taxonomy( 'wptests_tax_2', 'post' );
    class Tests_Term_WpInsertTerm extends WP_UnitTestCase { 
    503496                $this->assertSame( 'foo-2', $new_term->slug );
    504497                $this->assertNotEquals( $new_term->term_id, $term->term_id );
    505498
    506                 if ( is_multisite() ) {
    507                         $this->db_version = $_db_version;
    508                 }
    509 
    510499                _unregister_taxonomy( 'wptests_tax', 'post' );
    511500        }
    512501