From 5af20a3de35e937e003e14e33ce7b335ff206954 Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Fri, 22 Apr 2016 15:21:14 +0000 Subject: [PATCH] Tests: Account for flexible IDs in main network deletion test After [37299], the network IDs encountered by this test may be larger than "100". This adjusts the test to respond accordingly until we have a better way to delete networks. See #36566. git-svn-id: https://develop.svn.wordpress.org/trunk@37300 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/multisite/network.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/tests/multisite/network.php b/tests/phpunit/tests/multisite/network.php index 4126e8a4c9..1946da56cc 100644 --- a/tests/phpunit/tests/multisite/network.php +++ b/tests/phpunit/tests/multisite/network.php @@ -65,12 +65,16 @@ class Tests_Multisite_Network extends WP_UnitTestCase { */ function test_get_main_network_id_after_network_delete() { global $wpdb, $current_site; + $id = self::factory()->network->create(); + $temp_id = $id + 1; $current_site->id = (int) $id; - $wpdb->query( "UPDATE {$wpdb->site} SET id=100 WHERE id=1" ); - $this->assertEquals( $id, get_main_network_id() ); - $wpdb->query( "UPDATE {$wpdb->site} SET id=1 WHERE id=100" ); + $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->site} SET id=%d WHERE id=1", $temp_id ) ); + $main_network_id = get_main_network_id(); + $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->site} SET id=1 WHERE id=%d", $temp_id ) ); + + $this->assertEquals( $id, $main_network_id ); } function test_get_main_network_id_filtered() {