Make WordPress Core


Ignore:
Timestamp:
05/11/2023 10:05:51 AM (3 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/customize/manager.php

    r55039 r55745  
    272272         */
    273273        public function test_fresh_site_flag_clearing() {
    274                 global $wp_customize, $wpdb;
     274                global $wp_customize;
    275275
    276276                // Make sure fresh site flag is cleared when publishing a changeset.
    … …  
    284284
    285285                // Make sure no DB write is done when publishing and a site is already non-fresh.
    286                 $query_count = $wpdb->num_queries;
     286                $query_count = get_num_queries();
    287287                do_action( 'customize_save_after', $wp_customize );
    288                 $this->assertSame( $query_count, $wpdb->num_queries );
     288                $this->assertSame( $query_count, get_num_queries() );
    289289        }
    290290
Note: See TracChangeset for help on using the changeset viewer.