Changeset 47122 for trunk/tests/phpunit/tests/post/objects.php
- Timestamp:
- 01/29/2020 12:43:23 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/post/objects.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/objects.php
r46586 r47122 15 15 $this->assertEquals( array(), $post->ancestors ); 16 16 17 // Unset and then verify that the magic method fills the property again 17 // Unset and then verify that the magic method fills the property again. 18 18 unset( $post->ancestors ); 19 19 $this->assertEquals( array(), $post->ancestors ); 20 20 21 // Magic get should make meta accessible as properties 21 // Magic get should make meta accessible as properties. 22 22 add_post_meta( $id, 'test', 'test' ); 23 23 $this->assertEquals( 'test', get_post_meta( $id, 'test', true ) ); 24 24 $this->assertEquals( 'test', $post->test ); 25 25 26 // Make sure meta does not eclipse true properties 26 // Make sure meta does not eclipse true properties. 27 27 add_post_meta( $id, 'post_type', 'dummy' ); 28 28 $this->assertEquals( 'dummy', get_post_meta( $id, 'post_type', true ) ); 29 29 $this->assertEquals( 'post', $post->post_type ); 30 30 31 // Excercise the output argument 31 // Excercise the output argument. 32 32 $post = get_post( $id, ARRAY_A ); 33 33 $this->assertInternalType( 'array', $post ); … … 45 45 $this->assertEquals( $id, $post['ID'] ); 46 46 47 // Should default to OBJECT when given invalid output argument 47 // Should default to OBJECT when given invalid output argument. 48 48 $post = get_post( $id, 'invalid-output-value' ); 49 49 $this->assertInstanceOf( 'WP_Post', $post ); 50 50 $this->assertEquals( $id, $post->ID ); 51 51 52 // Make sure stdClass in $GLOBALS['post'] is handled 52 // Make sure stdClass in $GLOBALS['post'] is handled. 53 53 $post_std = $post->to_array(); 54 54 $this->assertInternalType( 'array', $post_std ); … … 214 214 wp_cache_delete( $id, 'posts' ); 215 215 216 // get_post( stdClass ) should not prime the cache 216 // get_post( stdClass ) should not prime the cache. 217 217 $post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $id ) ); 218 218 $post = get_post( $post ); 219 219 $this->assertEmpty( wp_cache_get( $id, 'posts' ) ); 220 220 221 // get_post( WP_Post ) should not prime the cache 221 // get_post( WP_Post ) should not prime the cache. 222 222 get_post( $post ); 223 223 $this->assertEmpty( wp_cache_get( $id, 'posts' ) ); 224 224 225 // get_post( ID ) should prime the cache 225 // get_post( ID ) should prime the cache. 226 226 get_post( $post->ID ); 227 227 $this->assertNotEmpty( wp_cache_get( $id, 'posts' ) );
Note: See TracChangeset
for help on using the changeset viewer.