Tests: Replace most instances of wpmu_delete_blog() not specifically testing that function with wp_delete_site().

Follow-up to [47011].

See #47195.

git-svn-id: https://develop.svn.wordpress.org/trunk@47012 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-12-25 18:15:13 +00:00
parent ebe75fb903
commit f8051662b1
18 changed files with 34 additions and 36 deletions

View File

@ -68,7 +68,7 @@ class Tests_Link_GetDashboardUrl extends WP_UnitTestCase {
remove_user_from_blog( self::$user_id, $site_id );
add_user_to_blog( get_current_blog_id(), self::$user_id, 'administrator' );
wpmu_delete_blog( $site_id, true );
wp_delete_site( $site_id );
$this->assertEquals( $expected, $result );
}

View File

@ -103,7 +103,7 @@ if ( is_multisite() ) :
global $wpdb;
foreach ( self::$site_ids as $id ) {
wpmu_delete_blog( $id, true );
wp_delete_site( $id );
}
foreach ( self::$network_ids as $id ) {

View File

@ -35,7 +35,7 @@ if ( is_multisite() ) :
public static function wpTearDownAfterClass() {
foreach ( self::$site_ids as $id ) {
wpmu_delete_blog( $id, true );
wp_delete_site( $id );
}
wp_update_network_site_counts();

View File

@ -72,7 +72,7 @@ if ( is_multisite() ) :
global $wpdb;
foreach ( self::$site_ids as $id ) {
wpmu_delete_blog( $id, true );
wp_delete_site( $id );
}
foreach ( self::$network_ids as $id ) {

View File

@ -54,7 +54,7 @@ if ( is_multisite() ) :
public static function wpTearDownAfterClass() {
foreach ( self::$site_ids as $id ) {
wpmu_delete_blog( $id, true );
wp_delete_site( $id );
}
global $wpdb;

View File

@ -34,7 +34,7 @@ if ( is_multisite() ) :
public static function wpTearDownAfterClass() {
foreach ( self::$site_ids as $id ) {
wpmu_delete_blog( $id, true );
wp_delete_site( $id );
}
wp_update_network_site_counts();

View File

@ -63,7 +63,7 @@ if ( is_multisite() ) :
global $wpdb;
foreach ( self::$different_site_ids as $id ) {
wpmu_delete_blog( $id, true );
wp_delete_site( $id );
}
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->sitemeta} WHERE site_id = %d", self::$different_network_id ) );
@ -155,7 +155,7 @@ if ( is_multisite() ) :
$actual = (int) get_blog_count(); // Count only updated when cron runs, so should be unchanged.
foreach ( $site_ids as $site_id ) {
wpmu_delete_blog( $site_id, true );
wp_delete_site( $site_id );
}
wp_update_network_counts();
@ -175,7 +175,7 @@ if ( is_multisite() ) :
remove_filter( 'enable_live_network_counts', '__return_false' );
foreach ( $site_ids as $site_id ) {
wpmu_delete_blog( $site_id, true );
wp_delete_site( $site_id );
}
wp_update_network_counts();
@ -195,7 +195,7 @@ if ( is_multisite() ) :
remove_filter( 'enable_live_network_counts', '__return_true' );
foreach ( $site_ids as $site_id ) {
wpmu_delete_blog( $site_id, true );
wp_delete_site( $site_id );
}
wp_update_network_counts();
@ -590,13 +590,7 @@ if ( is_multisite() ) :
public function test_wpmu_create_blog_updates_correct_network_site_count() {
$original_count = get_blog_count( self::$different_network_id );
$site_id = self::factory()->blog->create(
array(
'domain' => 'example.org',
'path' => '/',
'site_id' => self::$different_network_id,
)
);
$site_id = wpmu_create_blog( 'example.org', '/', '', 1, array(), self::$different_network_id );
$result = get_blog_count( self::$different_network_id );

View File

@ -79,7 +79,7 @@ if ( is_multisite() ) :
add_action( 'wp_uninitialize_site', 'wp_uninitialize_site', 10, 1 );
foreach ( self::$site_ids as $id ) {
wpmu_delete_blog( $id, true );
wp_delete_site( $id );
}
foreach ( self::$network_ids as $id ) {

View File

@ -139,7 +139,7 @@ if ( is_multisite() ) :
$cached_details = wp_cache_get( $site->id, 'site-details' );
wpmu_delete_blog( $id, true );
wp_delete_site( $id );
wp_update_network_site_counts();
$this->assertNotFalse( $cached_details );

View File

@ -41,8 +41,8 @@ if ( is_multisite() ) :
delete_network_option( get_main_network_id(), 'site_meta_supported' );
}
wpmu_delete_blog( self::$site_id, true );
wpmu_delete_blog( self::$site_id2, true );
wp_delete_site( self::$site_id );
wp_delete_site( self::$site_id2 );
wp_update_network_site_counts();
}
@ -213,7 +213,7 @@ if ( is_multisite() ) :
$this->assertSame( 'bar', get_site_meta( $site_id, 'foo', true ) );
$this->assertSame( 'bar', get_site_meta( $site_id, 'foo1', true ) );
wpmu_delete_blog( $site_id, true );
wp_delete_site( $site_id );
$this->assertSame( '', get_site_meta( $site_id, 'foo', true ) );
$this->assertSame( '', get_site_meta( $site_id, 'foo1', true ) );

View File

@ -105,7 +105,7 @@ if ( is_multisite() ) :
global $wpdb;
foreach ( self::$site_ids as $id ) {
wpmu_delete_blog( $id, true );
wp_delete_site( $id );
}
foreach ( self::$network_ids as $id ) {

View File

@ -43,7 +43,7 @@ if ( is_multisite() ) :
public static function wpTearDownAfterClass() {
foreach ( self::$site_ids as $id ) {
wpmu_delete_blog( $id, true );
wp_delete_site( $id );
}
wp_update_network_site_counts();

View File

@ -21,7 +21,8 @@ if ( is_multisite() ) :
$first_comment = get_comments();
restore_current_blog();
wpmu_delete_blog( $blog_id, true );
wp_delete_site( $blog_id );
$this->assertNotEmpty( $first_page->post_content );
$this->assertNotEmpty( $first_comment[0]->comment_content );
@ -46,7 +47,8 @@ if ( is_multisite() ) :
$first_comment = get_comments();
restore_current_blog();
wpmu_delete_blog( $blog_id, true );
wp_delete_site( $blog_id );
$this->assertNotEmpty( $first_page->post_content );
$this->assertNotEmpty( $first_comment[0]->comment_content );
@ -71,7 +73,8 @@ if ( is_multisite() ) :
$first_comment = get_comments();
restore_current_blog();
wpmu_delete_blog( $blog_id, true );
wp_delete_site( $blog_id );
$this->assertEquals( 'Some page content', $first_page->post_content );
$this->assertEquals( 'Some comment content', $first_comment[0]->comment_content );

View File

@ -83,7 +83,7 @@ if ( is_multisite() ) :
public static function wpTearDownAfterClass() {
foreach ( self::$site_ids as $site_id ) {
wpmu_delete_blog( $site_id, true );
wp_delete_site( $site_id );
}
}

View File

@ -47,7 +47,7 @@ if ( is_multisite() ) :
wpmu_delete_user( self::$existing_user_id );
wpmu_delete_blog( self::$existing_blog_id, true );
wp_delete_site( self::$existing_blog_id );
}
/**

View File

@ -136,7 +136,7 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase {
_unregister_post_type( 'r_false_p_false' );
if ( is_multisite() ) {
wpmu_delete_blog( self::$site, true );
wp_delete_site( self::$site );
}
// Remove users for pagination tests.

View File

@ -51,8 +51,8 @@ if ( is_multisite() ) :
$result = get_active_blog_for_user( self::$user_id );
wpmu_delete_blog( $site_id_one, true );
wpmu_delete_blog( $site_id_two, true );
wp_delete_site( $site_id_one );
wp_delete_site( $site_id_two );
$this->assertEquals( $primary_site_id, $result->id );
}
@ -69,7 +69,7 @@ if ( is_multisite() ) :
$result = get_active_blog_for_user( self::$user_id );
wpmu_delete_blog( $primary_site_id, true );
wp_delete_site( $primary_site_id );
$this->assertEquals( $primary_site_id, $result->id );
}
@ -92,7 +92,7 @@ if ( is_multisite() ) :
$result = get_active_blog_for_user( self::$user_id );
wpmu_delete_blog( $site_id, true );
wp_delete_site( $site_id );
$this->assertEquals( $current_site_id, $result->id );
}

View File

@ -389,7 +389,7 @@ if ( is_multisite() ) :
$user = get_user_by( 'id', $user_id );
restore_current_blog();
wpmu_delete_blog( $site_id );
wp_delete_site( $site_id );
wpmu_delete_user( $user_id );
$this->assertContains( 'subscriber', $user->roles );
@ -402,7 +402,8 @@ if ( is_multisite() ) :
$site_id = self::factory()->blog->create();
$result = add_user_to_blog( 73622, $site_id, 'subscriber' );
wpmu_delete_blog( $site_id );
wp_delete_site( $site_id );
$this->assertWPError( $result );
}