Make WordPress Core


Ignore:
Timestamp:
07/10/2014 02:16:20 PM (12 years ago)
Author:
westi
Message:

XMLRPC: Restore support in wp.newPost for dates to be supplied in the structured dateTime.iso8601 format as well as still supporting dates specified as strings.

Fixes #28601.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/xmlrpc/wp/newPost.php

    r29062 r29063  
    358358        }
    359359
     360        /**
     361         * @ticket 28601
     362         */
     363        function test_valid_IXR_post_date() {
     364                $this->make_user_by_role( 'author' );
     365                $date_string = '1984-01-11 05:00:00';
     366                $post = array( 'post_title' => 'test', 'post_content' => 'test', 'post_date' => new IXR_Date( mysql2date( 'Ymd\TH:i:s', $date_string, false ) ) );
     367                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
     368                $fetched_post = get_post( $result );
     369                $this->assertStringMatchesFormat( '%d', $result );
     370                $this->assertEquals( $date_string , $fetched_post->post_date );
     371        }
     372
     373        /**
     374         * @ticket 28601
     375         */
     376        function test_valid_IXR_post_date_gmt() {
     377                $this->make_user_by_role( 'author' );
     378                $date_string = '1984-01-11 05:00:00';
     379                $post = array( 'post_title' => 'test', 'post_content' => 'test', 'post_date_gmt' => new IXR_Date( mysql2date( 'Ymd\TH:i:s', $date_string, false ) ) );
     380                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
     381                $fetched_post = get_post( $result );
     382                $this->assertStringMatchesFormat( '%d', $result );
     383                $this->assertEquals( $date_string , $fetched_post->post_date_gmt );
     384        }
     385
    360386}
Note: See TracChangeset for help on using the changeset viewer.