Changeset 34997 for trunk/tests/phpunit/tests/term/getTermBy.php
- Timestamp:
- 10/10/2015 01:58:37 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/term/getTermBy.php
r34679 r34997 60 60 $this->assertSame( $t, $found->term_id ); 61 61 } 62 63 /** 64 * @ticket 14162 65 */ 66 public function test_should_prime_term_cache() { 67 global $wpdb; 68 69 register_taxonomy( 'wptests_tax', 'post' ); 70 $t = $this->factory->term->create( array( 71 'taxonomy' => 'wptests_tax', 72 'slug' => 'foo', 73 ) ); 74 75 clean_term_cache( $t, 'wptests_tax' ); 76 77 $num_queries = $wpdb->num_queries; 78 $found = get_term_by( 'slug', 'foo', 'wptests_tax' ); 79 $num_queries++; 80 81 $this->assertTrue( $found instanceof WP_Term ); 82 $this->assertSame( $t, $found->term_id ); 83 $this->assertSame( $num_queries, $wpdb->num_queries ); 84 85 // Calls to `get_term()` should now hit cache. 86 $found2 = get_term( $t ); 87 $this->assertSame( $t, $found->term_id ); 88 $this->assertSame( $num_queries, $wpdb->num_queries ); 89 } 62 90 }
Note: See TracChangeset
for help on using the changeset viewer.