Make WordPress Core


Ignore:
Timestamp:
05/11/2023 10:05:51 AM (4 years ago)
Author:
spacedmonkey
Message:

Tests: Use the function get_num_queries across all unit tests.

Replace use of $wpdb->num_queries with a function call to get_num_queries. This improves readability and consistency between tests.

Props SergeyBiryukov, peterwilsoncc, spacedmonkey.
See #57841.

File:
1 edited

Legend:

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

    r54637 r55745  
    591591                 */
    592592                public function test_get_network_not_found_cache() {
    593                         global $wpdb;
    594 
    595593                        $new_network_id = $this->_get_next_network_id();
    596594                        $this->assertNull( get_network( $new_network_id ) );
    597595
    598                         $num_queries = $wpdb->num_queries;
     596                        $num_queries = get_num_queries();
    599597                        $this->assertNull( get_network( $new_network_id ) );
    600                         $this->assertSame( $num_queries, $wpdb->num_queries );
     598                        $this->assertSame( $num_queries, get_num_queries() );
    601599                }
    602600
Note: See TracChangeset for help on using the changeset viewer.