From 4f23ce85451b3318367d58f0fdca0e320863f246 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 23 Jul 2016 08:52:52 +0000 Subject: [PATCH] Unit Tests: Move `get_page_uri()` tests to `post/getPageUri.php`, added in [37345]. See #26284. git-svn-id: https://develop.svn.wordpress.org/trunk@38143 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/post.php | 41 ------------------------- tests/phpunit/tests/post/getPageUri.php | 41 +++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/tests/phpunit/tests/post.php b/tests/phpunit/tests/post.php index de11a34542..9f043e6af7 100644 --- a/tests/phpunit/tests/post.php +++ b/tests/phpunit/tests/post.php @@ -638,47 +638,6 @@ class Tests_Post extends WP_UnitTestCase { kses_remove_filters(); } - /** - * @ticket 22883 - */ - function test_get_page_uri_with_stdclass_post_object() { - $post_id = self::factory()->post->create( array( 'post_name' => 'get-page-uri-post-name' ) ); - - // Mimick an old stdClass post object, missing the ancestors field. - $post_array = (object) get_post( $post_id, ARRAY_A ); - unset( $post_array->ancestors ); - - // Dummy assertion. If this test fails, it will actually error out on an E_WARNING. - $this->assertEquals( 'get-page-uri-post-name', get_page_uri( $post_array ) ); - } - - /** - * @ticket 24491 - */ - function test_get_page_uri_with_nonexistent_post() { - global $wpdb; - $post_id = $wpdb->get_var( "SELECT MAX(ID) FROM $wpdb->posts" ) + 1; - $this->assertFalse( get_page_uri( $post_id ) ); - } - - /** - * @ticket 15963 - */ - function test_get_post_uri_check_orphan() { - $parent_id = self::factory()->post->create( array( 'post_name' => 'parent' ) ); - $child_id = self::factory()->post->create( array( 'post_name' => 'child', 'post_parent' => $parent_id ) ); - - // check the parent for good measure - $this->assertEquals( 'parent', get_page_uri( $parent_id ) ); - - // try the child normally - $this->assertEquals( 'parent/child', get_page_uri( $child_id ) ); - - // now delete the parent from the database and check - wp_delete_post( $parent_id, true ); - $this->assertEquals( 'child', get_page_uri( $child_id ) ); - } - /** * @ticket 23708 */ diff --git a/tests/phpunit/tests/post/getPageUri.php b/tests/phpunit/tests/post/getPageUri.php index 604dd20f79..df1f0a4565 100644 --- a/tests/phpunit/tests/post/getPageUri.php +++ b/tests/phpunit/tests/post/getPageUri.php @@ -5,6 +5,47 @@ */ class Tests_Post_getPageUri extends WP_UnitTestCase { + /** + * @ticket 22883 + */ + function test_get_page_uri_with_stdclass_post_object() { + $post_id = self::factory()->post->create( array( 'post_name' => 'get-page-uri-post-name' ) ); + + // Mimick an old stdClass post object, missing the ancestors field. + $post_array = (object) get_post( $post_id, ARRAY_A ); + unset( $post_array->ancestors ); + + // Dummy assertion. If this test fails, it will actually error out on an E_WARNING. + $this->assertEquals( 'get-page-uri-post-name', get_page_uri( $post_array ) ); + } + + /** + * @ticket 24491 + */ + function test_get_page_uri_with_nonexistent_post() { + global $wpdb; + $post_id = $wpdb->get_var( "SELECT MAX(ID) FROM $wpdb->posts" ) + 1; + $this->assertFalse( get_page_uri( $post_id ) ); + } + + /** + * @ticket 15963 + */ + function test_get_post_uri_check_orphan() { + $parent_id = self::factory()->post->create( array( 'post_name' => 'parent' ) ); + $child_id = self::factory()->post->create( array( 'post_name' => 'child', 'post_parent' => $parent_id ) ); + + // check the parent for good measure + $this->assertEquals( 'parent', get_page_uri( $parent_id ) ); + + // try the child normally + $this->assertEquals( 'parent/child', get_page_uri( $child_id ) ); + + // now delete the parent from the database and check + wp_delete_post( $parent_id, true ); + $this->assertEquals( 'child', get_page_uri( $child_id ) ); + } + function test_get_page_uri_without_argument() { $post_id = self::factory()->post->create(array( 'post_title' => 'Blood Orange announces summer tour dates',