WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/26/2017 04:56:21 PM (5 years ago)
Author:
boonebgorges
Message:

Revert to pre-4.7 behavior for fetching object instances by id.

This changeset reverts [38381], which caused inconsistencies in the way the
REST API fetches posts and other objects.

Merge of [39992] to the 4.7 branch.

See #38792, #37738.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/tests/phpunit/tests/post/wpPost.php

    r38398 r39993  
    5151     * @ticket 37738
    5252     */
    53     public function test_get_instance_should_fail_for_bool() {
    54         $found = WP_Post::get_instance( true );
    55 
    56         $this->assertFalse( $found );
    57     }
    58 
    59     /**
    60      * @ticket 37738
    61      */
    6253    public function test_get_instance_should_succeed_for_float_that_is_equal_to_post_id() {
    6354        $found = WP_Post::get_instance( 1.0 );
     
    6556        $this->assertSame( 1, $found->ID );
    6657    }
    67 
    68     /**
    69      * @ticket 37738
    70      */
    71     public function test_get_instance_should_fail_for_float() {
    72         $found = WP_Post::get_instance( 1.6 );
    73 
    74         $this->assertFalse( $found );
    75     }
    76 
    77     /**
    78      * @ticket 37738
    79      */
    80     public function test_get_instance_should_fail_for_array() {
    81         $found = WP_Post::get_instance( array( 1 ) );
    82 
    83         $this->assertFalse( $found );
    84     }
    85 
    86     /**
    87      * @ticket 37738
    88      */
    89     public function test_get_instance_should_fail_for_class() {
    90         $class = new stdClass();
    91         $found = WP_Post::get_instance( $class );
    92 
    93         $this->assertFalse( $found );
    94     }
    9558}
Note: See TracChangeset for help on using the changeset viewer.