Skip to content
Permalink
Browse files

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
  • Loading branch information...
SergeyBiryukov committed Aug 29, 2019
1 parent 4572bb0 commit 355d93d9778e98742af1f8b32586976536044bd3
Showing with 3 additions and 3 deletions.
  1. +3 −3 tests/phpunit/tests/xmlrpc/wp/newPost.php
@@ -355,15 +355,15 @@ function test_invalid_post_date_does_not_fatal() {
$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 ) );
}
/**
* @ticket 28601
*/
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 @@ function test_invalid_post_date_gmt_does_not_fatal() {
$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 ) );
}
/**

0 comments on commit 355d93d

Please sign in to comment.
You can’t perform that action at this time.