From 355d93d9778e98742af1f8b32586976536044bd3 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 29 Aug 2019 16:43:28 +0000 Subject: [PATCH] Date/Time: Update XML-RPC tests for invalid date input to account for a more consistent `mysql2date()` error handling in [45908]. The tests were meant to check for the lack of a fatal error in case of invalid date input, not specifically mark a particular outcome as the correct one. Props Rarst. Fixes #28992. git-svn-id: https://develop.svn.wordpress.org/trunk@45911 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/xmlrpc/wp/newPost.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/tests/xmlrpc/wp/newPost.php b/tests/phpunit/tests/xmlrpc/wp/newPost.php index 27a164564a..7e37333254 100644 --- a/tests/phpunit/tests/xmlrpc/wp/newPost.php +++ b/tests/phpunit/tests/xmlrpc/wp/newPost.php @@ -355,7 +355,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 ); + $this->assertEquals( current_time( 'Y-m-d' ), substr( $fetched_post->post_date, 0, 10 ) ); } /** @@ -363,7 +363,7 @@ class Tests_XMLRPC_wp_newPost extends WP_XMLRPC_UnitTestCase { */ function test_invalid_post_date_gmt_does_not_fatal() { $this->make_user_by_role( 'author' ); - $date_string = 'invalid date'; + $date_string = 'invalid_date'; $post = array( 'post_title' => 'test', 'post_content' => 'test', @@ -372,7 +372,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_gmt ); + $this->assertEquals( '0000-00-00', substr( $fetched_post->post_date_gmt, 0, 10 ) ); } /**