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
This commit is contained in:
Peter Westwood 2014-07-10 14:05:22 +00:00
parent 24852d4305
commit c89afd5a59
1 changed files with 28 additions and 0 deletions

View File

@ -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 );
}
}