Make WordPress Core


Ignore:
Timestamp:
09/30/2015 01:08:49 PM (9 years ago)
Author:
boonebgorges
Message:

Prevent Multisite term tests from hitting database for 'db_version'.

[34718] introduced a 'db_version' check to term meta functions, to ensure that
they don't run when the term meta schema is not yet in place. This call to
get_option() causes a database hit during Multisite tests, due to the
presence of the WP_INSTALLING constant. See #31130. The extra database
queries are causing cache tests to fail.

In similar cases, we have markTestSkipped() when is_multisite(). Because
the term meta API is so extensive - term meta caches can be primed anywhere a
WP_Query loop is fired up - we implement a more generous workaround in this
case. To prevent get_option( 'db_version' ) from hitting the database during
multisite unit tests, we use a 'pre_option_' filter.

Heaven help us.

See #34091.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/term/wpInsertTerm.php

    r34646 r34719  
    470470    public function test_wp_insert_term_duplicate_slug_different_taxonomy_before_410_schema_change() {
    471471
    472         $db_version = get_option( 'db_version' );
    473         update_option( 'db_version', 30055 );
     472        $_db_version = $this->db_version;
     473        $this->db_version = 30055;
    474474
    475475        register_taxonomy( 'wptests_tax', 'post' );
     
    498498        $this->assertNotEquals( $new_term->term_id, $term->term_id );
    499499
     500        $this->db_version = $_db_version;
    500501        _unregister_taxonomy( 'wptests_tax', 'post' );
    501         update_option( 'db_version', $db_version );
    502502    }
    503503
Note: See TracChangeset for help on using the changeset viewer.