Changeset 55745 for trunk/tests/phpunit/tests/term/wpGetObjectTerms.php
- Timestamp:
- 05/11/2023 10:05:51 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/term/wpGetObjectTerms.php
r55671 r55745 617 617 */ 618 618 public function test_termmeta_cache_should_be_lazy_loaded_by_default() { 619 global $wpdb;620 621 619 register_taxonomy( 'wptests_tax', 'post' ); 622 620 $terms = self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); … … 630 628 $found = wp_get_object_terms( $p, 'wptests_tax' ); 631 629 632 $num_queries = $wpdb->num_queries;630 $num_queries = get_num_queries(); 633 631 634 632 foreach ( $terms as $t ) { … … 636 634 } 637 635 638 $this->assertSame( $num_queries + 1, $wpdb->num_queries);636 $this->assertSame( $num_queries + 1, get_num_queries() ); 639 637 } 640 638 … … 643 641 */ 644 642 public function test_termmeta_cache_should_not_be_primed_when_update_term_meta_cache_is_false() { 645 global $wpdb;646 647 643 register_taxonomy( 'wptests_tax', 'post' ); 648 644 $terms = self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); … … 662 658 ); 663 659 664 $num_queries = $wpdb->num_queries;660 $num_queries = get_num_queries(); 665 661 666 662 foreach ( $terms as $t ) { … … 668 664 } 669 665 670 $this->assertSame( $num_queries + 3, $wpdb->num_queries);666 $this->assertSame( $num_queries + 3, get_num_queries() ); 671 667 } 672 668 … … 675 671 */ 676 672 public function test_termmeta_cache_should_be_primed_when_fields_is_all_with_object_id() { 677 global $wpdb;678 679 673 register_taxonomy( 'wptests_tax', 'post' ); 680 674 $terms = self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); … … 695 689 ); 696 690 697 $num_queries = $wpdb->num_queries;691 $num_queries = get_num_queries(); 698 692 699 693 foreach ( $terms as $t ) { … … 701 695 } 702 696 703 $this->assertSame( $num_queries + 1, $wpdb->num_queries);697 $this->assertSame( $num_queries + 1, get_num_queries() ); 704 698 } 705 699 … … 708 702 */ 709 703 public function test_termmeta_cache_should_be_primed_when_fields_is_ids() { 710 global $wpdb;711 712 704 register_taxonomy( 'wptests_tax', 'post' ); 713 705 $terms = self::factory()->term->create_many( 3, array( 'taxonomy' => 'wptests_tax' ) ); … … 728 720 ); 729 721 730 $num_queries = $wpdb->num_queries;722 $num_queries = get_num_queries(); 731 723 732 724 foreach ( $terms as $t ) { … … 734 726 } 735 727 736 $this->assertSame( $num_queries + 1, $wpdb->num_queries);728 $this->assertSame( $num_queries + 1, get_num_queries() ); 737 729 } 738 730 … … 817 809 */ 818 810 public function test_should_prime_cache_for_found_terms() { 819 global $wpdb;820 821 811 register_taxonomy( 'wptests_tax', 'post' ); 822 812 $p = self::factory()->post->create(); … … 832 822 ); 833 823 834 $num_queries = $wpdb->num_queries;824 $num_queries = get_num_queries(); 835 825 $term = get_term( $t ); 836 $this->assertSame( $num_queries, $wpdb->num_queries);826 $this->assertSame( $num_queries, get_num_queries() ); 837 827 } 838 828 … … 866 856 */ 867 857 public function test_term_cache_should_be_primed_for_all_taxonomies() { 868 global $wpdb;869 870 858 register_taxonomy( 'wptests_tax1', 'post' ); 871 859 register_taxonomy( 'wptests_tax2', 'post' ); … … 889 877 $this->assertSameSets( array( $t1, $t2 ), wp_list_pluck( $found, 'term_id' ) ); 890 878 891 $num_queries = $wpdb->num_queries;879 $num_queries = get_num_queries(); 892 880 $term1 = get_term( $t1 ); 893 881 $term2 = get_term( $t2 ); 894 $this->assertSame( $num_queries, $wpdb->num_queries);882 $this->assertSame( $num_queries, get_num_queries() ); 895 883 } 896 884
Note: See TracChangeset
for help on using the changeset viewer.