mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-04 14:47:02 +00:00
XML-RPC: Make sure wp.newPost does not produce a fatal error when a post_date field is included in the data.
props dllh. fixes #28601. git-svn-id: https://develop.svn.wordpress.org/trunk@28854 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -305,4 +305,28 @@ class Tests_XMLRPC_wp_newPost extends WP_XMLRPC_UnitTestCase {
|
||||
$this->assertEquals( 401, $result2->code );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 28601
|
||||
*/
|
||||
function test_invalid_post_date_does_not_fatal() {
|
||||
$this->make_user_by_role( 'author' );
|
||||
$date_string = '2014-01-01 10:10:10';
|
||||
$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 );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 28601
|
||||
*/
|
||||
function test_invalid_post_date_gmt_does_not_fatal() {
|
||||
$this->make_user_by_role( 'author' );
|
||||
$date_string = 'invalid date';
|
||||
$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 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user