Skip to content

Commit 4038eb0

Browse files
committed
Tests: Delete the network created by the network option cache tests.
Remove the network and its metadata after the class finishes so later multisite tests see only their own networks. Developed in: #16145 Props ekamran. See #66755. git-svn-id: https://develop.svn.wordpress.org/trunk@65735 602fd350-edb4-49c9-b593-d223f7449a82
1 parent cb7c390 commit 4038eb0

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎tests/phpunit/tests/option/wpPrimeNetworkOptionCaches.php‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
2424
}
2525
}
2626

27+
public static function wpTearDownAfterClass() {
28+
global $wpdb;
29+
30+
if ( is_multisite() ) {
31+
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->sitemeta} WHERE site_id = %d", self::$different_network_id ) );
32+
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->site} WHERE id = %d", self::$different_network_id ) );
33+
}
34+
}
35+
2736
/**
2837
* Tests that wp_prime_network_option_caches() primes multiple options.
2938
*

0 commit comments

Comments
 (0)