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
This commit is contained in:
Jeremy Felt 2016-04-22 15:21:14 +00:00
parent 7c79386135
commit 5af20a3de3
1 changed files with 7 additions and 3 deletions

View File

@ -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() {