WordPress.org

Make WordPress Core

Changeset 1206 in tests


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

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

Location:
trunk/tests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/general/archives.php

    r1194 r1206  
    1818 
    1919        $this->factory->post->create_many( 15, array( 'post_type' => 'post' ) ); 
     20        wp_cache_delete( 'last_changed', 'posts' ); 
    2021        $this->assertFalse( wp_cache_get( 'last_changed', 'posts' ) ); 
    2122 
     
    2526        $result = wp_get_archives( array( 'type' => 'monthly', 'echo' => false ) ); 
    2627        $this->assertInternalType( 'string', $result ); 
    27         $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) ); 
     28        $this->assertNotEmpty( $time1 = wp_cache_get( 'last_changed', 'posts' ) ); 
    2829        $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 
    2930 
     
    3334        $result = wp_get_archives( array( 'type' => 'monthly', 'echo' => false ) ); 
    3435        $this->assertInternalType( 'string', $result ); 
    35         $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) ); 
     36        $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 
    3637        $this->assertEquals( $num_queries, $wpdb->num_queries ); 
    3738 
     
    3940        $result = wp_get_archives( array( 'type' => 'monthly', 'echo' => false, 'order' => 'ASC' ) ); 
    4041        $this->assertInternalType( 'string', $result ); 
    41         $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) ); 
     42        $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 
    4243        $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 
    4344 
     
    4748        $result = wp_get_archives( array( 'type' => 'monthly', 'echo' => false, 'order' => 'ASC' ) ); 
    4849        $this->assertInternalType( 'string', $result ); 
    49         $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) ); 
     50        $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 
    5051        $this->assertEquals( $num_queries, $wpdb->num_queries ); 
    5152 
     
    5556        $result = wp_get_archives( array( 'type' => 'yearly', 'echo' => false ) ); 
    5657        $this->assertInternalType( 'string', $result ); 
    57         $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) ); 
     58        $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 
    5859        $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 
    5960 
     
    6364        $result = wp_get_archives( array( 'type' => 'yearly', 'echo' => false ) ); 
    6465        $this->assertInternalType( 'string', $result ); 
    65         $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) ); 
     66        $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 
    6667        $this->assertEquals( $num_queries, $wpdb->num_queries ); 
    6768 
     
    6970        $result = wp_get_archives( array( 'type' => 'daily', 'echo' => false ) ); 
    7071        $this->assertInternalType( 'string', $result ); 
    71         $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) ); 
     72        $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 
    7273        $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 
    7374 
     
    7778        $result = wp_get_archives( array( 'type' => 'daily', 'echo' => false ) ); 
    7879        $this->assertInternalType( 'string', $result ); 
    79         $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) ); 
     80        $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 
    8081        $this->assertEquals( $num_queries, $wpdb->num_queries ); 
    8182 
     
    8384        $result = wp_get_archives( array( 'type' => 'weekly', 'echo' => false ) ); 
    8485        $this->assertInternalType( 'string', $result ); 
    85         $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) ); 
     86        $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 
    8687        $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 
    8788 
     
    9192        $result = wp_get_archives( array( 'type' => 'weekly', 'echo' => false ) ); 
    9293        $this->assertInternalType( 'string', $result ); 
    93         $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) ); 
     94        $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 
    9495        $this->assertEquals( $num_queries, $wpdb->num_queries ); 
    9596 
     
    9798        $result = wp_get_archives( array( 'type' => 'postbypost', 'echo' => false ) ); 
    9899        $this->assertInternalType( 'string', $result ); 
    99         $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) ); 
     100        $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 
    100101        $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 
    101102 
     
    105106        $result = wp_get_archives( array( 'type' => 'postbypost', 'echo' => false ) ); 
    106107        $this->assertInternalType( 'string', $result ); 
    107         $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) ); 
     108        $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 
    108109        $this->assertEquals( $num_queries, $wpdb->num_queries ); 
    109110    } 
  • trunk/tests/meta.php

    r974 r1206  
    125125        $key = rand_str(); 
    126126        $value = 'Test\\singleslash'; 
    127         $expected = 'Testsingleslash'; 
     127        $expected = 'Test\\singleslash'; 
    128128        $value2 = 'Test\\\\doubleslash'; 
    129         $expected2 = 'Test\\doubleslash'; 
     129        $expected2 = 'Test\\\\doubleslash'; 
     130        $value3 = 'Test\oneslash'; 
     131        $expected3 = 'Test\oneslash'; 
    130132        $this->assertFalse( metadata_exists( 'user', $this->author->ID, $key ) ); 
    131133        $this->assertFalse( delete_metadata( 'user', $this->author->ID, $key ) ); 
     
    150152        $this->assertInternalType( 'int', update_metadata( 'user', $this->author->ID, $key, $value2 ) ); 
    151153        $this->assertEquals( $expected2, get_metadata( 'user', $this->author->ID, $key, true ) ); 
     154        $this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) ); 
     155        $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) ); 
     156        $this->assertFalse( metadata_exists( 'user', $this->author->ID, $key ) ); 
     157 
     158        $this->assertInternalType( 'int', add_metadata( 'user', $this->author->ID, $key, $value3 ) ); 
     159        $this->assertEquals( $expected3, get_metadata( 'user', $this->author->ID, $key, true ) ); 
     160        $this->assertTrue( delete_metadata( 'user', $this->author->ID, $key ) ); 
     161        $this->assertSame( '', get_metadata( 'user', $this->author->ID, $key, true ) ); 
     162        $this->assertInternalType( 'int', update_metadata( 'user', $this->author->ID, $key, $value3 ) ); 
     163        $this->assertEquals( $expected3, get_metadata( 'user', $this->author->ID, $key, true ) ); 
    152164    } 
    153165} 
  • trunk/tests/post/meta.php

    r909 r1206  
    220220        $this->assertTrue( update_meta( $mid1, 'unique_update', addslashes( $data ) ) ); 
    221221        $meta = get_metadata_by_mid( 'post', $mid1 ); 
    222         $this->assertEquals( $data, $meta->meta_value ); 
     222        $this->assertEquals( addslashes( $data ), $meta->meta_value ); 
    223223    } 
    224224 
Note: See TracChangeset for help on using the changeset viewer.