From c89afd5a593fb91fe0e6ec13e58158903a7d5194 Mon Sep 17 00:00:00 2001 From: Peter Westwood Date: Thu, 10 Jul 2014 14:05:22 +0000 Subject: [PATCH] XMLRPC: Extend the test cases from [28854] so that we also test valid date based strings. See #28601. git-svn-id: https://develop.svn.wordpress.org/trunk@29062 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/xmlrpc/wp/newPost.php | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/phpunit/tests/xmlrpc/wp/newPost.php b/tests/phpunit/tests/xmlrpc/wp/newPost.php index e421fbb30a..e7bd8c015c 100644 --- a/tests/phpunit/tests/xmlrpc/wp/newPost.php +++ b/tests/phpunit/tests/xmlrpc/wp/newPost.php @@ -315,6 +315,7 @@ class Tests_XMLRPC_wp_newPost extends WP_XMLRPC_UnitTestCase { $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) ); $fetched_post = get_post( $result ); $this->assertStringMatchesFormat( '%d', $result ); + $this->assertEquals( '1970-01-01 00:00:00', $fetched_post->post_date ); } /** @@ -327,6 +328,33 @@ class Tests_XMLRPC_wp_newPost extends WP_XMLRPC_UnitTestCase { $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) ); $fetched_post = get_post( $result ); $this->assertStringMatchesFormat( '%d', $result ); + $this->assertEquals( '1970-01-01 00:00:00', $fetched_post->post_date_gmt ); + } + + /** + * @ticket 28601 + */ + function test_valid_string_post_date() { + $this->make_user_by_role( 'author' ); + $date_string = '1984-01-11 05:00:00'; + $post = array( 'post_title' => 'test', 'post_content' => 'test', 'post_date' => $date_string ); + $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) ); + $fetched_post = get_post( $result ); + $this->assertStringMatchesFormat( '%d', $result ); + $this->assertEquals( $date_string , $fetched_post->post_date ); + } + + /** + * @ticket 28601 + */ + function test_valid_string_post_date_gmt() { + $this->make_user_by_role( 'author' ); + $date_string = '1984-01-11 05:00:00'; + $post = array( 'post_title' => 'test', 'post_content' => 'test', 'post_date_gmt' => $date_string ); + $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) ); + $fetched_post = get_post( $result ); + $this->assertStringMatchesFormat( '%d', $result ); + $this->assertEquals( $date_string , $fetched_post->post_date_gmt ); } }