Make WordPress Core

Changeset 1175 in tests


Ignore:
Timestamp:
12/27/2012 03:24:02 PM (14 years ago)
Author:
nacin
Message:

Test for get_page_uri() producing PHP warnings on non-WP_Post post objects. see #22883.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/post.php

    r1174 r1175  
    582582                kses_remove_filters();
    583583        }
     584
     585        /**
     586         * @ticket 22883
     587         */
     588        function test_get_page_uri_with_stdclass_post_object() {
     589                $post_id    = $this->factory->post->create( array( 'post_name' => 'get-page-uri-post-name' ) );
     590
     591                // Mimick an old stdClass post object, missing the ancestors field.
     592                $post_array = (object) get_post( $post_id, ARRAY_A );
     593                unset( $post_array->ancestors );
     594
     595                // Dummy assertion. If this test fails, it will actually error out on an E_WARNING.
     596                $this->assertEquals( 'get-page-uri-post-name', get_page_uri( $post_array ) );
     597        }
    584598}
Note: See TracChangeset for help on using the changeset viewer.