Changeset 38143
- Timestamp:
- 07/23/2016 08:52:52 AM (9 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post.php
r37857 r38143 640 640 641 641 /** 642 * @ticket 22883643 */644 function test_get_page_uri_with_stdclass_post_object() {645 $post_id = self::factory()->post->create( array( 'post_name' => 'get-page-uri-post-name' ) );646 647 // Mimick an old stdClass post object, missing the ancestors field.648 $post_array = (object) get_post( $post_id, ARRAY_A );649 unset( $post_array->ancestors );650 651 // Dummy assertion. If this test fails, it will actually error out on an E_WARNING.652 $this->assertEquals( 'get-page-uri-post-name', get_page_uri( $post_array ) );653 }654 655 /**656 * @ticket 24491657 */658 function test_get_page_uri_with_nonexistent_post() {659 global $wpdb;660 $post_id = $wpdb->get_var( "SELECT MAX(ID) FROM $wpdb->posts" ) + 1;661 $this->assertFalse( get_page_uri( $post_id ) );662 }663 664 /**665 * @ticket 15963666 */667 function test_get_post_uri_check_orphan() {668 $parent_id = self::factory()->post->create( array( 'post_name' => 'parent' ) );669 $child_id = self::factory()->post->create( array( 'post_name' => 'child', 'post_parent' => $parent_id ) );670 671 // check the parent for good measure672 $this->assertEquals( 'parent', get_page_uri( $parent_id ) );673 674 // try the child normally675 $this->assertEquals( 'parent/child', get_page_uri( $child_id ) );676 677 // now delete the parent from the database and check678 wp_delete_post( $parent_id, true );679 $this->assertEquals( 'child', get_page_uri( $child_id ) );680 }681 682 /**683 642 * @ticket 23708 684 643 */ -
trunk/tests/phpunit/tests/post/getPageUri.php
r37345 r38143 5 5 */ 6 6 class Tests_Post_getPageUri extends WP_UnitTestCase { 7 8 /** 9 * @ticket 22883 10 */ 11 function test_get_page_uri_with_stdclass_post_object() { 12 $post_id = self::factory()->post->create( array( 'post_name' => 'get-page-uri-post-name' ) ); 13 14 // Mimick an old stdClass post object, missing the ancestors field. 15 $post_array = (object) get_post( $post_id, ARRAY_A ); 16 unset( $post_array->ancestors ); 17 18 // Dummy assertion. If this test fails, it will actually error out on an E_WARNING. 19 $this->assertEquals( 'get-page-uri-post-name', get_page_uri( $post_array ) ); 20 } 21 22 /** 23 * @ticket 24491 24 */ 25 function test_get_page_uri_with_nonexistent_post() { 26 global $wpdb; 27 $post_id = $wpdb->get_var( "SELECT MAX(ID) FROM $wpdb->posts" ) + 1; 28 $this->assertFalse( get_page_uri( $post_id ) ); 29 } 30 31 /** 32 * @ticket 15963 33 */ 34 function test_get_post_uri_check_orphan() { 35 $parent_id = self::factory()->post->create( array( 'post_name' => 'parent' ) ); 36 $child_id = self::factory()->post->create( array( 'post_name' => 'child', 'post_parent' => $parent_id ) ); 37 38 // check the parent for good measure 39 $this->assertEquals( 'parent', get_page_uri( $parent_id ) ); 40 41 // try the child normally 42 $this->assertEquals( 'parent/child', get_page_uri( $child_id ) ); 43 44 // now delete the parent from the database and check 45 wp_delete_post( $parent_id, true ); 46 $this->assertEquals( 'child', get_page_uri( $child_id ) ); 47 } 7 48 8 49 function test_get_page_uri_without_argument() {
Note: See TracChangeset
for help on using the changeset viewer.