Ticket #31130: 31130.3.diff
File 31130.3.diff, 26.2 KB (added by , 9 years ago) |
---|
-
src/wp-admin/admin.php
84 84 auth_redirect(); 85 85 86 86 // Schedule trash collection 87 if ( !wp_next_scheduled('wp_scheduled_delete') && ! defined('WP_INSTALLING') )87 if ( !wp_next_scheduled('wp_scheduled_delete') && ! wp_installing() ) 88 88 wp_schedule_event(time(), 'daily', 'wp_scheduled_delete'); 89 89 90 90 set_screen_options(); -
src/wp-admin/includes/class-wp-upgrader.php
2604 2604 if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) 2605 2605 return true; 2606 2606 2607 if ( defined( 'WP_INSTALLING') )2607 if ( wp_installing() ) 2608 2608 return true; 2609 2609 2610 2610 // More fine grained control can be done through the WP_AUTO_UPDATE_CORE constant and filters. -
src/wp-admin/includes/file.php
1081 1081 $stored_credentials['hostname'] .= ':' . $stored_credentials['port']; 1082 1082 1083 1083 unset($stored_credentials['password'], $stored_credentials['port'], $stored_credentials['private_key'], $stored_credentials['public_key']); 1084 if ( ! defined( 'WP_INSTALLING') ) {1084 if ( ! wp_installing() ) { 1085 1085 update_option( 'ftp_credentials', $stored_credentials ); 1086 1086 } 1087 1087 return $credentials; -
src/wp-admin/includes/misc.php
261 261 * @param string $value 262 262 */ 263 263 function update_home_siteurl( $old_value, $value ) { 264 if ( defined( "WP_INSTALLING") )264 if ( wp_installing() ) 265 265 return; 266 266 267 267 if ( is_multisite() && ms_is_switched() ) { -
src/wp-admin/includes/translation-install.php
94 94 * in an error, an empty array will be returned. 95 95 */ 96 96 function 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' ) ) ) { 98 98 return $translations; 99 99 } 100 100 -
src/wp-includes/functions.php
680 680 * add_query_arg( 'key', 'value', 'http://example.com' ); 681 681 * 682 682 * Using an associative array: 683 * 683 * 684 684 * add_query_arg( array( 685 685 * 'key1' => 'value1', 686 686 * 'key2' => 'value2', 687 687 * ), 'http://example.com' ); 688 * 688 * 689 689 * Omitting the URL from either use results in the current URL being used 690 690 * (the value of `$_SERVER['REQUEST_URI']`). 691 * 691 * 692 692 * Values are expected to be encoded appropriately with urlencode() or rawurlencode(). 693 693 * 694 694 * Setting any query variable's value to boolean false removes the key (see remove_query_arg()). … … 1260 1260 } 1261 1261 1262 1262 /** 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 */ 1275 function 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 /** 1263 1293 * Test whether blog is already installed. 1264 1294 * 1265 1295 * The cache will be checked first. If you have a cache plugin, which saves … … 1285 1315 return true; 1286 1316 1287 1317 $suppress = $wpdb->suppress_errors(); 1288 if ( ! defined( 'WP_INSTALLING') ) {1318 if ( ! wp_installing() ) { 1289 1319 $alloptions = wp_load_alloptions(); 1290 1320 } 1291 1321 // If siteurl is not set to autoload, check it specifically … … 3337 3367 } 3338 3368 3339 3369 // If installing or in the admin, provide the verbose message. 3340 if ( defined('WP_INSTALLING') || defined('WP_ADMIN') )3370 if ( wp_installing() || defined('WP_ADMIN') ) 3341 3371 wp_die($wpdb->error); 3342 3372 3343 3373 // Otherwise, be terse. -
src/wp-includes/l10n.php
53 53 // If multisite, check options. 54 54 if ( is_multisite() ) { 55 55 // 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' ) ) ) { 57 57 $ms_locale = get_network_option( 'WPLANG' ); 58 58 } 59 59 … … 635 635 return $return; 636 636 } 637 637 638 if ( is_admin() || defined( 'WP_INSTALLING') || ( defined( 'WP_REPAIRING' ) && WP_REPAIRING ) ) {638 if ( is_admin() || wp_installing() || ( defined( 'WP_REPAIRING' ) && WP_REPAIRING ) ) { 639 639 load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo" ); 640 640 } 641 641 -
src/wp-includes/load.php
165 165 * @global int $upgrading the unix timestamp marking when upgrading WordPress began. 166 166 */ 167 167 function wp_maintenance() { 168 if ( !file_exists( ABSPATH . '.maintenance' ) || defined( 'WP_INSTALLING') )168 if ( !file_exists( ABSPATH . '.maintenance' ) || wp_installing() ) 169 169 return; 170 170 171 171 global $upgrading; … … 475 475 */ 476 476 function wp_not_installed() { 477 477 if ( is_multisite() ) { 478 if ( ! is_blog_installed() && ! defined( 'WP_INSTALLING') ) {478 if ( ! is_blog_installed() && ! wp_installing() ) { 479 479 nocache_headers(); 480 480 481 481 wp_die( __( 'The site you have requested is not installed properly. Please contact the system administrator.' ) ); 482 482 } 483 } elseif ( ! is_blog_installed() && ! defined( 'WP_INSTALLING') ) {483 } elseif ( ! is_blog_installed() && ! wp_installing() ) { 484 484 nocache_headers(); 485 485 486 486 require( ABSPATH . WPINC . '/kses.php' ); … … 539 539 function wp_get_active_and_valid_plugins() { 540 540 $plugins = array(); 541 541 $active_plugins = (array) get_option( 'active_plugins', array() ); 542 if ( empty( $active_plugins ) || defined( 'WP_INSTALLING') )542 if ( empty( $active_plugins ) || wp_installing() ) 543 543 return $plugins; 544 544 545 545 $network_plugins = is_multisite() ? wp_get_active_network_plugins() : false; -
src/wp-includes/ms-functions.php
1116 1116 if ( domain_exists($domain, $path, $site_id) ) 1117 1117 return new WP_Error( 'blog_taken', __( 'Sorry, that site already exists!' ) ); 1118 1118 1119 if ( !defined('WP_INSTALLING') ) 1120 define( 'WP_INSTALLING', true ); 1119 if ( ! wp_installing() ) { 1120 wp_installing( true ); 1121 } 1121 1122 1122 1123 if ( ! $blog_id = insert_blog($domain, $path, $site_id) ) 1123 1124 return new WP_Error('insert_blog', __('Could not create site.')); … … 2172 2173 if ( !is_main_site() ) 2173 2174 return; 2174 2175 2175 if ( !wp_next_scheduled('update_network_counts') && ! defined('WP_INSTALLING') )2176 if ( !wp_next_scheduled('update_network_counts') && ! wp_installing() ) 2176 2177 wp_schedule_event(time(), 'twicedaily', 'update_network_counts'); 2177 2178 } 2178 2179 -
src/wp-includes/ms-settings.php
136 136 } 137 137 138 138 // @todo Investigate when exactly this can occur. 139 if ( empty( $current_blog ) && defined( 'WP_INSTALLING') ) {139 if ( empty( $current_blog ) && wp_installing() ) { 140 140 $current_blog = new stdClass; 141 141 $current_blog->blog_id = $blog_id = 1; 142 142 } -
src/wp-includes/option.php
53 53 if ( defined( 'WP_SETUP_CONFIG' ) ) 54 54 return false; 55 55 56 if ( ! defined( 'WP_INSTALLING') ) {56 if ( ! wp_installing() ) { 57 57 // prevent non-existent options from triggering multiple queries 58 58 $notoptions = wp_cache_get( 'notoptions', 'options' ); 59 59 if ( isset( $notoptions[ $option ] ) ) { … … 171 171 function wp_load_alloptions() { 172 172 global $wpdb; 173 173 174 if ( ! defined( 'WP_INSTALLING' ) || !is_multisite() )174 if ( ! wp_installing() || ! is_multisite() ) 175 175 $alloptions = wp_cache_get( 'alloptions', 'options' ); 176 176 else 177 177 $alloptions = false; … … 185 185 foreach ( (array) $alloptions_db as $o ) { 186 186 $alloptions[$o->option_name] = $o->option_value; 187 187 } 188 if ( ! defined( 'WP_INSTALLING' ) || !is_multisite() )188 if ( ! wp_installing() || ! is_multisite() ) 189 189 wp_cache_add( 'alloptions', $alloptions, 'options' ); 190 190 } 191 191 … … 204 204 function wp_load_core_site_options( $site_id = null ) { 205 205 global $wpdb; 206 206 207 if ( ! is_multisite() || wp_using_ext_object_cache() || defined( 'WP_INSTALLING') )207 if ( ! is_multisite() || wp_using_ext_object_cache() || wp_installing() ) 208 208 return; 209 209 210 210 if ( empty($site_id) ) … … 332 332 wp_cache_set( 'notoptions', $notoptions, 'options' ); 333 333 } 334 334 335 if ( ! defined( 'WP_INSTALLING') ) {335 if ( ! wp_installing() ) { 336 336 $alloptions = wp_load_alloptions(); 337 337 if ( isset( $alloptions[$option] ) ) { 338 338 $alloptions[ $option ] = $serialized_value; … … 433 433 if ( ! $result ) 434 434 return false; 435 435 436 if ( ! defined( 'WP_INSTALLING') ) {436 if ( ! wp_installing() ) { 437 437 if ( 'yes' == $autoload ) { 438 438 $alloptions = wp_load_alloptions(); 439 439 $alloptions[ $option ] = $serialized_value; … … 509 509 do_action( 'delete_option', $option ); 510 510 511 511 $result = $wpdb->delete( $wpdb->options, array( 'option_name' => $option ) ); 512 if ( ! defined( 'WP_INSTALLING') ) {512 if ( ! wp_installing() ) { 513 513 if ( 'yes' == $row->autoload ) { 514 514 $alloptions = wp_load_alloptions(); 515 515 if ( is_array( $alloptions ) && isset( $alloptions[$option] ) ) { … … 629 629 $value = wp_cache_get( $transient, 'transient' ); 630 630 } else { 631 631 $transient_option = '_transient_' . $transient; 632 if ( ! defined( 'WP_INSTALLING') ) {632 if ( ! wp_installing() ) { 633 633 // If option is not in alloptions, it is not autoloaded and thus has a timeout 634 634 $alloptions = wp_load_alloptions(); 635 635 if ( !isset( $alloptions[$transient_option] ) ) { -
src/wp-includes/script-loader.php
829 829 function wp_style_loader_src( $src, $handle ) { 830 830 global $_wp_admin_css_colors; 831 831 832 if ( defined('WP_INSTALLING') )832 if ( wp_installing() ) 833 833 return preg_replace( '#^wp-admin/#', './', $src ); 834 834 835 835 if ( 'colors' == $handle ) { -
src/wp-includes/theme.php
771 771 * 772 772 * @param bool true Validation flag to check the current theme. 773 773 */ 774 if ( defined('WP_INSTALLING') || ! apply_filters( 'validate_current_theme', true ) )774 if ( wp_installing() || ! apply_filters( 'validate_current_theme', true ) ) 775 775 return true; 776 776 777 777 if ( get_template() != WP_DEFAULT_THEME && !file_exists(get_template_directory() . '/index.php') ) { -
src/wp-includes/update.php
22 22 * @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. 23 23 */ 24 24 function wp_version_check( $extra_stats = array(), $force_check = false ) { 25 if ( defined( 'WP_INSTALLING') ) {25 if ( wp_installing() ) { 26 26 return; 27 27 } 28 28 … … 187 187 * @param array $extra_stats Extra statistics to report to the WordPress.org API. 188 188 */ 189 189 function wp_update_plugins( $extra_stats = array() ) { 190 if ( defined( 'WP_INSTALLING') ) {190 if ( wp_installing() ) { 191 191 return; 192 192 } 193 193 … … 344 344 * @param array $extra_stats Extra statistics to report to the WordPress.org API. 345 345 */ 346 346 function wp_update_themes( $extra_stats = array() ) { 347 if ( defined( 'WP_INSTALLING') ) {347 if ( wp_installing() ) { 348 348 return; 349 349 } 350 350 global $wp_version; … … 636 636 * @since 3.1.0 637 637 */ 638 638 function 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() ) 640 640 wp_schedule_event(time(), 'twicedaily', 'wp_version_check'); 641 641 642 if ( ! wp_next_scheduled('wp_update_plugins') && !defined('WP_INSTALLING') )642 if ( ! wp_next_scheduled('wp_update_plugins') && ! wp_installing() ) 643 643 wp_schedule_event(time(), 'twicedaily', 'wp_update_plugins'); 644 644 645 if ( ! wp_next_scheduled('wp_update_themes') && !defined('WP_INSTALLING') )645 if ( ! wp_next_scheduled('wp_update_themes') && ! wp_installing() ) 646 646 wp_schedule_event(time(), 'twicedaily', 'wp_update_themes'); 647 647 648 if ( ! wp_next_scheduled( 'wp_maybe_auto_update' ) && ! defined( 'WP_INSTALLING') ) {648 if ( ! wp_next_scheduled( 'wp_maybe_auto_update' ) && ! wp_installing() ) { 649 649 // Schedule auto updates for 7 a.m. and 7 p.m. in the timezone of the site. 650 650 $next = strtotime( 'today 7am' ); 651 651 $now = time(); -
src/wp-settings.php
321 321 $GLOBALS['wp_locale'] = new WP_Locale(); 322 322 323 323 // Load the functions for the active theme, for both parent and child theme if applicable. 324 if ( ! defined( 'WP_INSTALLING') || 'wp-activate.php' === $pagenow ) {324 if ( ! wp_installing() || 'wp-activate.php' === $pagenow ) { 325 325 if ( TEMPLATEPATH !== STYLESHEETPATH && file_exists( STYLESHEETPATH . '/functions.php' ) ) 326 326 include( STYLESHEETPATH . '/functions.php' ); 327 327 if ( file_exists( TEMPLATEPATH . '/functions.php' ) ) -
tests/phpunit/includes/factory.php
173 173 $suppress = $wpdb->suppress_errors(); 174 174 $blog = wpmu_create_blog( $args['domain'], $args['path'], $args['title'], $user_id, $meta, $args['site_id'] ); 175 175 $wpdb->suppress_errors( $suppress ); 176 177 // Tell WP we're done installing. 178 wp_installing( false ); 179 176 180 return $blog; 177 181 } 178 182 -
tests/phpunit/includes/testcase.php
14 14 protected static $hooks_saved = array(); 15 15 protected static $ignore_files; 16 16 17 protected $db_version;18 19 17 /** 20 18 * @var WP_UnitTest_Factory 21 19 */ … … 58 56 add_filter( 'wp_die_handler', array( $this, 'get_wp_die_handler' ) ); 59 57 60 58 add_filter( 'wp_mail', array( $this, 'set_wp_mail_globals' ) ); 61 62 /*63 * During multisite tests, WP_INSTALLING forces `get_option()` to miss the cache, which causes problems64 * with our query-counting cache tests. As a workaround in the case of tests that require checking65 * 'db_version' (such as any test that uses the Term Meta API), we filter 'pre_option_db_version' and66 * avoid hitting the database.67 *68 * See #31130.69 */70 $this->db_version = get_option( 'db_version' );71 if ( is_multisite() ) {72 add_filter( 'pre_option_db_version', array( $this, 'db_version' ) );73 }74 59 } 75 60 76 61 /** … … 635 620 } 636 621 637 622 /** 638 * Return the current database version without hitting the database.639 *640 * This is used to bypass cache problems with some multisite tests. See #31130.641 *642 * @todo Don't do this anymore once #31130 is fixed.643 *644 * @since 4.4.0645 */646 public function db_version() {647 return $this->db_version;648 }649 650 /**651 623 * Utility method that resets permalinks and flushes rewrites. 652 624 * 653 625 * @since 4.4.0 -
tests/phpunit/tests/comment/getPageOfComment.php
60 60 * @ticket 11334 61 61 */ 62 62 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 68 63 global $wpdb; 69 64 70 65 $p = $this->factory->post->create(); -
tests/phpunit/tests/general/archives.php
16 16 function test_get_archives_cache() { 17 17 global $wpdb; 18 18 19 if ( is_multisite() ) {20 $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' );21 }22 23 19 $this->factory->post->create_many( 15, array( 'post_type' => 'post' ) ); 24 20 wp_cache_delete( 'last_changed', 'posts' ); 25 21 $this->assertFalse( wp_cache_get( 'last_changed', 'posts' ) ); … … 112 108 $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 113 109 $this->assertEquals( $num_queries, $wpdb->num_queries ); 114 110 } 115 } 116 No newline at end of file 111 } -
tests/phpunit/tests/option/transient.php
46 46 * @ticket 22807 47 47 */ 48 48 function test_transient_data_with_timeout() { 49 if ( is_multisite() ) {50 $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING.' );51 }52 53 49 $key = rand_str(); 54 50 $value = rand_str(); 55 51 … … 71 67 * @ticket 22807 72 68 */ 73 69 function test_transient_add_timeout() { 74 if ( is_multisite() ) {75 $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING.' );76 }77 78 70 $key = rand_str(); 79 71 $value = rand_str(); 80 72 $value2 = rand_str(); … … 126 118 * @ticket 30380 127 119 */ 128 120 function test_nonexistent_key_old_timeout() { 129 if ( is_multisite() ) {130 $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING.' );131 }132 133 121 // Create a transient 134 122 $key = 'test_transient'; 135 123 set_transient( $key, 'test', 60 * 10 ); -
tests/phpunit/tests/option/updateOption.php
20 20 * @ticket 26394 21 21 */ 22 22 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 27 23 global $wpdb; 28 24 $this->flush_cache(); 29 25 update_option( 'test_update_option_default', 'value' ); … … 44 40 * @ticket 26394 45 41 */ 46 42 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 51 43 global $wpdb; 52 44 $this->flush_cache(); 53 45 update_option( 'test_update_option_default', 'value', 'yes' ); … … 68 60 * @ticket 26394 69 61 */ 70 62 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 75 63 global $wpdb; 76 64 $this->flush_cache(); 77 65 update_option( 'test_update_option_default', 'value', 'no' ); … … 93 81 * @ticket 26394 94 82 */ 95 83 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 100 84 global $wpdb; 101 85 $this->flush_cache(); 102 86 update_option( 'test_update_option_default', 'value', false ); … … 118 102 * @group 26394 119 103 */ 120 104 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 125 105 global $wpdb; 126 106 add_option( 'foo', 'bar', '', 'no' ); 127 107 $updated = update_option( 'foo', 'bar2', true ); … … 143 123 * @group 26394 144 124 */ 145 125 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 150 126 global $wpdb; 151 127 add_option( 'foo', 'bar', '', 'yes' ); 152 128 $updated = update_option( 'foo', 'bar', false ); … … 169 145 * @group 26394 170 146 */ 171 147 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 176 148 global $wpdb; 177 149 add_option( 'foo', 'bar', '', 'yes' ); 178 150 -
tests/phpunit/tests/post/getPostClass.php
108 108 public function test_taxonomy_classes_hit_cache() { 109 109 global $wpdb; 110 110 111 if ( is_multisite() ) {112 $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' );113 }114 115 111 register_taxonomy( 'wptests_tax', 'post' ); 116 112 wp_set_post_terms( $this->post_id, array( 'foo', 'bar' ), 'wptests_tax' ); 117 113 wp_set_post_terms( $this->post_id, array( 'footag', 'bartag' ), 'post_tag' ); -
tests/phpunit/tests/term/getTerms.php
382 382 public function test_child_of_should_skip_query_when_specified_parent_is_not_found_in_hierarchy_cache() { 383 383 global $wpdb; 384 384 385 if ( is_multisite() ) {386 $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' );387 }388 389 385 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true, ) ); 390 386 391 387 $terms = $this->factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); … … 1327 1323 public function test_parent_should_skip_query_when_specified_parent_is_not_found_in_hierarchy_cache() { 1328 1324 global $wpdb; 1329 1325 1330 if ( is_multisite() ) {1331 $this->markTestSkipped( 'Not testable in MS: wpmu_create_blog() defines WP_INSTALLING, which causes cache misses.' );1332 }1333 1334 1326 register_taxonomy( 'wptests_tax', 'post', array( 'hierarchical' => true, ) ); 1335 1327 1336 1328 $terms = $this->factory->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); -
tests/phpunit/tests/term/wpInsertTerm.php
468 468 * @ticket 5809 469 469 */ 470 470 public function test_wp_insert_term_duplicate_slug_different_taxonomy_before_410_schema_change() { 471 472 // See #31130.473 471 $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 ); 480 473 481 474 register_taxonomy( 'wptests_tax', 'post' ); 482 475 register_taxonomy( 'wptests_tax_2', 'post' ); … … 503 496 $this->assertSame( 'foo-2', $new_term->slug ); 504 497 $this->assertNotEquals( $new_term->term_id, $term->term_id ); 505 498 506 if ( is_multisite() ) {507 $this->db_version = $_db_version;508 }509 510 499 _unregister_taxonomy( 'wptests_tax', 'post' ); 511 500 } 512 501 -
tests/phpunit/tests/user/capabilities.php
873 873 } 874 874 875 875 function test_current_user_can_for_blog() { 876 global $wpdb; 877 876 878 $user = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) ); 877 879 $old_uid = get_current_user_id(); 878 880 wp_set_current_user( $user->ID ); … … 884 886 return; 885 887 } 886 888 889 $suppress = $wpdb->suppress_errors(); 887 890 $this->assertFalse( current_user_can_for_blog( 12345, 'edit_posts' ) ); 891 $wpdb->suppress_errors( $suppress ); 888 892 889 893 $blog_id = $this->factory->blog->create( array( 'user_id' => $user->ID ) ); 890 894 $this->assertTrue( current_user_can_for_blog( $blog_id, 'edit_posts' ) );