Changeset 1206 in tests
- Timestamp:
- 02/11/2013 06:21:59 PM (13 years ago)
- Location:
- trunk/tests
- Files:
-
- 3 edited
-
general/archives.php (modified) (13 diffs)
-
meta.php (modified) (2 diffs)
-
post/meta.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/general/archives.php
r1194 r1206 18 18 19 19 $this->factory->post->create_many( 15, array( 'post_type' => 'post' ) ); 20 wp_cache_delete( 'last_changed', 'posts' ); 20 21 $this->assertFalse( wp_cache_get( 'last_changed', 'posts' ) ); 21 22 … … 25 26 $result = wp_get_archives( array( 'type' => 'monthly', 'echo' => false ) ); 26 27 $this->assertInternalType( 'string', $result ); 27 $this->assert Equals( 1,wp_cache_get( 'last_changed', 'posts' ) );28 $this->assertNotEmpty( $time1 = wp_cache_get( 'last_changed', 'posts' ) ); 28 29 $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 29 30 … … 33 34 $result = wp_get_archives( array( 'type' => 'monthly', 'echo' => false ) ); 34 35 $this->assertInternalType( 'string', $result ); 35 $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) );36 $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 36 37 $this->assertEquals( $num_queries, $wpdb->num_queries ); 37 38 … … 39 40 $result = wp_get_archives( array( 'type' => 'monthly', 'echo' => false, 'order' => 'ASC' ) ); 40 41 $this->assertInternalType( 'string', $result ); 41 $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) );42 $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 42 43 $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 43 44 … … 47 48 $result = wp_get_archives( array( 'type' => 'monthly', 'echo' => false, 'order' => 'ASC' ) ); 48 49 $this->assertInternalType( 'string', $result ); 49 $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) );50 $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 50 51 $this->assertEquals( $num_queries, $wpdb->num_queries ); 51 52 … … 55 56 $result = wp_get_archives( array( 'type' => 'yearly', 'echo' => false ) ); 56 57 $this->assertInternalType( 'string', $result ); 57 $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) );58 $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 58 59 $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 59 60 … … 63 64 $result = wp_get_archives( array( 'type' => 'yearly', 'echo' => false ) ); 64 65 $this->assertInternalType( 'string', $result ); 65 $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) );66 $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 66 67 $this->assertEquals( $num_queries, $wpdb->num_queries ); 67 68 … … 69 70 $result = wp_get_archives( array( 'type' => 'daily', 'echo' => false ) ); 70 71 $this->assertInternalType( 'string', $result ); 71 $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) );72 $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 72 73 $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 73 74 … … 77 78 $result = wp_get_archives( array( 'type' => 'daily', 'echo' => false ) ); 78 79 $this->assertInternalType( 'string', $result ); 79 $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) );80 $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 80 81 $this->assertEquals( $num_queries, $wpdb->num_queries ); 81 82 … … 83 84 $result = wp_get_archives( array( 'type' => 'weekly', 'echo' => false ) ); 84 85 $this->assertInternalType( 'string', $result ); 85 $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) );86 $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 86 87 $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 87 88 … … 91 92 $result = wp_get_archives( array( 'type' => 'weekly', 'echo' => false ) ); 92 93 $this->assertInternalType( 'string', $result ); 93 $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) );94 $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 94 95 $this->assertEquals( $num_queries, $wpdb->num_queries ); 95 96 … … 97 98 $result = wp_get_archives( array( 'type' => 'postbypost', 'echo' => false ) ); 98 99 $this->assertInternalType( 'string', $result ); 99 $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) );100 $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 100 101 $this->assertEquals( $num_queries + 1, $wpdb->num_queries ); 101 102 … … 105 106 $result = wp_get_archives( array( 'type' => 'postbypost', 'echo' => false ) ); 106 107 $this->assertInternalType( 'string', $result ); 107 $this->assertEquals( 1, wp_cache_get( 'last_changed', 'posts' ) );108 $this->assertEquals( $time1, wp_cache_get( 'last_changed', 'posts' ) ); 108 109 $this->assertEquals( $num_queries, $wpdb->num_queries ); 109 110 } -
trunk/tests/meta.php
r974 r1206 125 125 $key = rand_str(); 126 126 $value = 'Test\\singleslash'; 127 $expected = 'Test singleslash';127 $expected = 'Test\\singleslash'; 128 128 $value2 = 'Test\\\\doubleslash'; 129 $expected2 = 'Test\\doubleslash'; 129 $expected2 = 'Test\\\\doubleslash'; 130 $value3 = 'Test\oneslash'; 131 $expected3 = 'Test\oneslash'; 130 132 $this->assertFalse( metadata_exists( 'user', $this->author->ID, $key ) ); 131 133 $this->assertFalse( delete_metadata( 'user', $this->author->ID, $key ) ); … … 150 152 $this->assertInternalType( 'int', update_metadata( 'user', $this->author->ID, $key, $value2 ) ); 151 153 $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 ) ); 152 164 } 153 165 } -
trunk/tests/post/meta.php
r909 r1206 220 220 $this->assertTrue( update_meta( $mid1, 'unique_update', addslashes( $data ) ) ); 221 221 $meta = get_metadata_by_mid( 'post', $mid1 ); 222 $this->assertEquals( $data, $meta->meta_value );222 $this->assertEquals( addslashes( $data ), $meta->meta_value ); 223 223 } 224 224
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)