WordPress.org

Make WordPress Core

Changeset 1209 in tests


Ignore:
Timestamp:
02/11/13 18:32:19 (14 months ago)
Author:
ryan
Message:

Update cache tests to reflect new last_changed value. See #WP23448

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/term/getTerms.php

    r1197 r1209  
    2020        foreach ( $posts as $post ) 
    2121            wp_set_object_terms( $post, rand_str(), 'post_tag' ); 
     22        wp_cache_delete( 'last_changed', 'terms' ); 
    2223 
    2324        $this->assertFalse( wp_cache_get( 'last_changed', 'terms' ) ); 
    2425 
    2526        $num_queries = $wpdb->num_queries; 
    26         $last_changed = 1; 
    2727 
    2828        // last_changed and num_queries should bump 
    2929        $terms = get_terms( 'post_tag' ); 
    3030        $this->assertEquals( 15, count( $terms ) ); 
    31         $this->assertEquals( 1, wp_cache_get( 'last_changed', 'terms' ) ); 
     31        $this->assertNotEmpty( $time1 = wp_cache_get( 'last_changed', 'terms' ) ); 
    3232        $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 
    3333 
     
    3737        $terms = get_terms( 'post_tag' ); 
    3838        $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' ) ); 
    4040        $this->assertEquals( $num_queries, $wpdb->num_queries ); 
    4141 
     
    4646        $terms = get_terms( 'post_tag', array( 'number' => 10 ) ); 
    4747        $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' ) ); 
    4949        $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 
    5050 
     
    5454        $terms = get_terms( 'post_tag', array( 'number' => 10 ) ); 
    5555        $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' ) ); 
    5757        $this->assertEquals( $num_queries, $wpdb->num_queries ); 
    5858 
     
    6161 
    6262        $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' ) ); 
    6564 
    6665        // last_changed and num_queries should bump after a term is deleted 
    6766        $terms = get_terms( 'post_tag' ); 
    6867        $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' ) ); 
    7069        $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 
    7170 
     
    7574        $terms = get_terms( 'post_tag' ); 
    7675        $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' ) ); 
    7877        $this->assertEquals( $num_queries, $wpdb->num_queries ); 
    7978 
Note: See TracChangeset for help on using the changeset viewer.