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/term/wpTerm.php

    r38398 r39993  
    6464     * @ticket 37738
    6565     */
    66     public function test_get_instance_should_fail_for_bool() {
    67         $found = WP_Term::get_instance( true );
    68 
    69         $this->assertFalse( $found );
    70     }
    71 
    72     /**
    73      * @ticket 37738
    74      */
    7566    public function test_get_instance_should_succeed_for_float_that_is_equal_to_post_id() {
    7667        $found = WP_Term::get_instance( 1.0 );
     
    7869        $this->assertSame( 1, $found->term_id );
    7970    }
    80 
    81     /**
    82      * @ticket 37738
    83      */
    84     public function test_get_instance_should_fail_for_float() {
    85         $found = WP_Term::get_instance( 1.6 );
    86 
    87         $this->assertFalse( $found );
    88     }
    89 
    90     /**
    91      * @ticket 37738
    92      */
    93     public function test_get_instance_should_fail_for_array() {
    94         $found = WP_Term::get_instance( array( 1 ) );
    95 
    96         $this->assertFalse( $found );
    97     }
    98 
    99     /**
    100      * @ticket 37738
    101      */
    102     public function test_get_instance_should_fail_for_class() {
    103         $class = new stdClass();
    104         $found = WP_Term::get_instance( $class );
    105 
    106         $this->assertFalse( $found );
    107     }
    10871}
Note: See TracChangeset for help on using the changeset viewer.