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/comment/wpComment.php

    r38398 r39993  
    5353     * @ticket 37738
    5454     */
    55     public function test_get_instance_should_fail_for_bool() {
    56         $found = WP_Comment::get_instance( true );
    57 
    58         $this->assertFalse( $found );
    59     }
    60 
    61     /**
    62      * @ticket 37738
    63      */
    6455    public function test_get_instance_should_succeed_for_float_that_is_equal_to_post_id() {
    6556        $found = WP_Comment::get_instance( 1.0 );
     
    6758        $this->assertEquals( 1, $found->comment_ID );
    6859    }
    69 
    70     /**
    71      * @ticket 37738
    72      */
    73     public function test_get_instance_should_fail_for_float() {
    74         $found = WP_Comment::get_instance( 1.6 );
    75 
    76         $this->assertFalse( $found );
    77     }
    78 
    79     /**
    80      * @ticket 37738
    81      */
    82     public function test_get_instance_should_fail_for_array() {
    83         $found = WP_Comment::get_instance( array( 1 ) );
    84 
    85         $this->assertFalse( $found );
    86     }
    87 
    88     /**
    89      * @ticket 37738
    90      */
    91     public function test_get_instance_should_fail_for_class() {
    92         $class = new stdClass();
    93         $found = WP_Comment::get_instance( $class );
    94 
    95         $this->assertFalse( $found );
    96     }
    9760}
Note: See TracChangeset for help on using the changeset viewer.