Changeset 34719
- Timestamp:
- 09/30/2015 01:08:49 PM (10 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/testcase.php
r34638 r34719 56 56 57 57 add_filter( 'wp_mail', array( $this, 'set_wp_mail_globals' ) ); 58 59 /* 60 * During multisite tests, WP_INSTALLING forces `get_option()` to miss the cache, which causes problems 61 * with our query-counting cache tests. As a workaround in the case of tests that require checking 62 * 'db_version' (such as any test that uses the Term Meta API), we filter 'pre_option_db_version' and 63 * avoid hitting the database. 64 * 65 * See #31130. 66 */ 67 if ( is_multisite() ) { 68 $this->db_version = get_option( 'db_version' ); 69 add_filter( 'pre_option_db_version', array( $this, 'db_version' ) ); 70 } 58 71 } 59 72 … … 618 631 } 619 632 } 633 634 /** 635 * Return the current database version without hitting the database. 636 * 637 * This is used to bypass cache problems with some multisite tests. See #31130. 638 * 639 * @todo Don't do this anymore once #31130 is fixed. 640 * 641 * @since 4.4.0 642 */ 643 public function db_version() { 644 return $this->db_version; 645 } 620 646 } -
trunk/tests/phpunit/tests/term/wpInsertTerm.php
r34646 r34719 470 470 public function test_wp_insert_term_duplicate_slug_different_taxonomy_before_410_schema_change() { 471 471 472 $ db_version = get_option( 'db_version' );473 update_option( 'db_version', 30055 );472 $_db_version = $this->db_version; 473 $this->db_version = 30055; 474 474 475 475 register_taxonomy( 'wptests_tax', 'post' ); … … 498 498 $this->assertNotEquals( $new_term->term_id, $term->term_id ); 499 499 500 $this->db_version = $_db_version; 500 501 _unregister_taxonomy( 'wptests_tax', 'post' ); 501 update_option( 'db_version', $db_version );502 502 } 503 503
Note: See TracChangeset
for help on using the changeset viewer.