Make WordPress Core


Ignore:
Timestamp:
04/22/2016 03:21:14 PM (9 years ago)
Author:
jeremyfelt
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/multisite/network.php

    r37233 r37300  
    6666    function test_get_main_network_id_after_network_delete() {
    6767        global $wpdb, $current_site;
     68
    6869        $id = self::factory()->network->create();
     70        $temp_id = $id + 1;
    6971
    7072        $current_site->id = (int) $id;
    71         $wpdb->query( "UPDATE {$wpdb->site} SET id=100 WHERE id=1" );
    72         $this->assertEquals( $id, get_main_network_id() );
    73         $wpdb->query( "UPDATE {$wpdb->site} SET id=1 WHERE id=100" );
     73        $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->site} SET id=%d WHERE id=1", $temp_id ) );
     74        $main_network_id = get_main_network_id();
     75        $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->site} SET id=1 WHERE id=%d", $temp_id ) );
     76
     77        $this->assertEquals( $id, $main_network_id );
    7478    }
    7579
Note: See TracChangeset for help on using the changeset viewer.