WordPress.org

Make WordPress Core

Changeset 1208 in tests


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

Update cache tests for new last_changed value. See #WP23448

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/post/getPages.php

    r1186 r1208  
    1717 
    1818        $this->factory->post->create_many( 15, array( 'post_type' => 'page' ) ); 
     19        wp_cache_delete( 'last_changed', 'posts' ); 
    1920        $this->assertFalse( wp_cache_get( 'last_changed', 'posts' ) ); 
    2021 
    2122        $pages = get_pages(); 
    2223        $this->assertEquals( 15, count( $pages ) ); 
    23         $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) ); 
     24        $this->assertNotEmpty( $time1 = wp_cache_get( 'last_changed', 'posts' ) ); 
    2425        $num_queries = $wpdb->num_queries; 
    2526        foreach ( $pages as $page ) 
     
    2930        $pages = get_pages(); 
    3031        $this->assertEquals( 15, count( $pages ) ); 
    31         $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) ); 
     32        $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 
    3233        $this->assertEquals( $num_queries, $wpdb->num_queries ); 
    3334        foreach ( $pages as $page ) 
     
    3839        $pages = get_pages( array( 'number' => 10 ) ); 
    3940        $this->assertEquals( 10, count( $pages ) ); 
    40         $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) ); 
     41        $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 
    4142        $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 
    4243        foreach ( $pages as $page ) 
     
    4849        $pages = get_pages( array( 'number' => 10 ) ); 
    4950        $this->assertEquals( 10, count( $pages ) ); 
    50         $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) ); 
     51        $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 
    5152        $this->assertEquals( $num_queries, $wpdb->num_queries ); 
    5253        foreach ( $pages as $page ) 
     
    5657        $pages = get_pages(); 
    5758        $this->assertEquals( 15, count( $pages ) ); 
    58         $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) ); 
     59        $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 
    5960        $this->assertEquals( $num_queries, $wpdb->num_queries ); 
    6061        foreach ( $pages as $page ) 
     
    6364        // Force last_changed to increment. 
    6465        clean_post_cache( $pages[0]->ID ); 
    65         $this->assertEquals( 2, wp_cache_get( 'last_changed', 'posts' ) ); 
     66        $this->assertNotEquals( $time1, $time2 = wp_cache_get( 'last_changed', 'posts' ) ); 
    6667 
    6768        $num_queries = $wpdb->num_queries; 
     
    7071        $pages = get_pages( array( 'number' => 10 ) ); 
    7172        $this->assertEquals( 10, count( $pages ) ); 
    72         $this->assertEquals( 2, wp_cache_get( 'last_changed', 'posts' ) ); 
     73        $this->assertEquals( $time2, wp_cache_get( 'last_changed', 'posts' ) ); 
    7374        $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 
    7475        foreach ( $pages as $page ) 
Note: See TracChangeset for help on using the changeset viewer.