Changeset 1209 in tests
- Timestamp:
- 02/11/2013 06:32:19 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/term/getTerms.php
r1197 r1209 20 20 foreach ( $posts as $post ) 21 21 wp_set_object_terms( $post, rand_str(), 'post_tag' ); 22 wp_cache_delete( 'last_changed', 'terms' ); 22 23 23 24 $this->assertFalse( wp_cache_get( 'last_changed', 'terms' ) ); 24 25 25 26 $num_queries = $wpdb->num_queries; 26 $last_changed = 1;27 27 28 28 // last_changed and num_queries should bump 29 29 $terms = get_terms( 'post_tag' ); 30 30 $this->assertEquals( 15, count( $terms ) ); 31 $this->assert Equals( 1,wp_cache_get( 'last_changed', 'terms' ) );31 $this->assertNotEmpty( $time1 = wp_cache_get( 'last_changed', 'terms' ) ); 32 32 $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 33 33 … … 37 37 $terms = get_terms( 'post_tag' ); 38 38 $this->assertEquals( 15, count( $terms ) ); 39 $this->assertEquals( $ last_changed, wp_cache_get( 'last_changed', 'terms' ) );39 $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'terms' ) ); 40 40 $this->assertEquals( $num_queries, $wpdb->num_queries ); 41 41 … … 46 46 $terms = get_terms( 'post_tag', array( 'number' => 10 ) ); 47 47 $this->assertEquals( 10, count( $terms ) ); 48 $this->assertEquals( $ last_changed, wp_cache_get( 'last_changed', 'terms' ) );48 $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'terms' ) ); 49 49 $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 50 50 … … 54 54 $terms = get_terms( 'post_tag', array( 'number' => 10 ) ); 55 55 $this->assertEquals( 10, count( $terms ) ); 56 $this->assertEquals( $ last_changed, wp_cache_get( 'last_changed', 'terms' ) );56 $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'terms' ) ); 57 57 $this->assertEquals( $num_queries, $wpdb->num_queries ); 58 58 … … 61 61 62 62 $num_queries = $wpdb->num_queries; 63 // Bump by two because both wp_delete_term() and wp_update_term_count_now() call clean_term_cache(). 64 $last_changed += 2; 63 $this->assertNotEquals( $time1, $time2 = wp_cache_get( 'last_changed', 'terms' ) ); 65 64 66 65 // last_changed and num_queries should bump after a term is deleted 67 66 $terms = get_terms( 'post_tag' ); 68 67 $this->assertEquals( 14, count( $terms ) ); 69 $this->assertEquals( $ last_changed, wp_cache_get( 'last_changed', 'terms' ) );68 $this->assertEquals( $time2, wp_cache_get( 'last_changed', 'terms' ) ); 70 69 $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 71 70 … … 75 74 $terms = get_terms( 'post_tag' ); 76 75 $this->assertEquals( 14, count( $terms ) ); 77 $this->assertEquals( $ last_changed, wp_cache_get( 'last_changed', 'terms' ) );76 $this->assertEquals( $time2, wp_cache_get( 'last_changed', 'terms' ) ); 78 77 $this->assertEquals( $num_queries, $wpdb->num_queries ); 79 78
Note: See TracChangeset
for help on using the changeset viewer.