Unit Tests: tests that want to flush the cache should use their instance method instead of calling wp_cache_flush()
- more properties need to be wiped out in between tests.
Props ocean90. See #31491. git-svn-id: https://develop.svn.wordpress.org/trunk@34766 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
cae64c5e13
commit
c6571bcfad
@ -137,7 +137,7 @@ class Tests_Option_SiteOption extends WP_UnitTestCase {
|
||||
|
||||
delete_site_option( $key );
|
||||
$this->assertTrue( update_site_option( $key, $value ) );
|
||||
wp_cache_flush(); // ensure we're getting the value from the DB
|
||||
$this->flush_cache(); // ensure we're getting the value from the DB
|
||||
$this->assertEquals( $value, get_site_option( $key ) );
|
||||
}
|
||||
|
||||
|
@ -25,9 +25,9 @@ class Tests_Option_UpdateOption extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
wp_cache_flush();
|
||||
$this->flush_cache();
|
||||
update_option( 'test_update_option_default', 'value' );
|
||||
wp_cache_flush();
|
||||
$this->flush_cache();
|
||||
|
||||
// Populate the alloptions cache, which includes autoload=yes options.
|
||||
wp_load_alloptions();
|
||||
@ -49,9 +49,9 @@ class Tests_Option_UpdateOption extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
wp_cache_flush();
|
||||
$this->flush_cache();
|
||||
update_option( 'test_update_option_default', 'value', 'yes' );
|
||||
wp_cache_flush();
|
||||
$this->flush_cache();
|
||||
|
||||
// Populate the alloptions cache, which includes autoload=yes options.
|
||||
wp_load_alloptions();
|
||||
@ -73,9 +73,9 @@ class Tests_Option_UpdateOption extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
wp_cache_flush();
|
||||
$this->flush_cache();
|
||||
update_option( 'test_update_option_default', 'value', 'no' );
|
||||
wp_cache_flush();
|
||||
$this->flush_cache();
|
||||
|
||||
// Populate the alloptions cache, which does not include autoload=no options.
|
||||
wp_load_alloptions();
|
||||
@ -98,9 +98,9 @@ class Tests_Option_UpdateOption extends WP_UnitTestCase {
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
wp_cache_flush();
|
||||
$this->flush_cache();
|
||||
update_option( 'test_update_option_default', 'value', false );
|
||||
wp_cache_flush();
|
||||
$this->flush_cache();
|
||||
|
||||
// Populate the alloptions cache, which does not include autoload=no options.
|
||||
wp_load_alloptions();
|
||||
@ -127,7 +127,7 @@ class Tests_Option_UpdateOption extends WP_UnitTestCase {
|
||||
$updated = update_option( 'foo', 'bar2', true );
|
||||
$this->assertTrue( $updated );
|
||||
|
||||
wp_cache_flush();
|
||||
$this->flush_cache();
|
||||
|
||||
// Populate the alloptions cache, which includes autoload=yes options.
|
||||
wp_load_alloptions();
|
||||
@ -152,7 +152,7 @@ class Tests_Option_UpdateOption extends WP_UnitTestCase {
|
||||
$updated = update_option( 'foo', 'bar', false );
|
||||
$this->assertFalse( $updated );
|
||||
|
||||
wp_cache_flush();
|
||||
$this->flush_cache();
|
||||
|
||||
// Populate the alloptions cache, which includes autoload=yes options.
|
||||
wp_load_alloptions();
|
||||
@ -180,7 +180,7 @@ class Tests_Option_UpdateOption extends WP_UnitTestCase {
|
||||
$updated = update_option( 'foo', 'bar2' );
|
||||
$this->assertTrue( $updated );
|
||||
|
||||
wp_cache_flush();
|
||||
$this->flush_cache();
|
||||
|
||||
// Populate the alloptions cache, which includes autoload=yes options.
|
||||
wp_load_alloptions();
|
||||
|
Loading…
Reference in New Issue
Block a user