WordPress.org

Make WordPress Core

Changeset 987 in tests


Ignore:
Timestamp:
08/21/12 15:42:54 (20 months ago)
Author:
ryan
Message:

Make sure stdClass in $GLOBALSpost? is handled in get_post(). see #WP21309

File:
1 edited

Legend:

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

    r977 r987  
    4949        $this->assertInstanceOf( 'WP_Post', $post ); 
    5050        $this->assertEquals( $id, $post->ID ); 
     51 
     52        // Make sure stdClass in $GLOBALS['post'] is handled 
     53        $post_std = $post->to_array(); 
     54        $this->assertInternalType( 'array', $post_std ); 
     55        $post_std = (object) $post_std; 
     56        $GLOBALS['post'] = $post_std; 
     57        $pid = null; 
     58        $post = get_post( $pid ); 
     59        $this->assertInstanceOf( 'WP_Post', $post ); 
     60        $this->assertEquals( $id, $post->ID ); 
     61        unset( $GLOBALS['post'] ); 
    5162    } 
    5263 
Note: See TracChangeset for help on using the changeset viewer.