Make WordPress Core


Ignore:
Timestamp:
06/26/2014 05:42:17 PM (12 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

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

    r25002 r28854  
    306306        }
    307307
     308        /**
     309         * @ticket 28601
     310         */
     311        function test_invalid_post_date_does_not_fatal() {
     312                $this->make_user_by_role( 'author' );
     313                $date_string = '2014-01-01 10:10:10';
     314                $post = array( 'post_title' => 'test', 'post_content' => 'test', 'post_date' => $date_string );
     315                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
     316                $fetched_post = get_post( $result );
     317                $this->assertStringMatchesFormat( '%d', $result );
     318        }
     319
     320        /**
     321         * @ticket 28601
     322         */
     323        function test_invalid_post_date_gmt_does_not_fatal() {
     324                $this->make_user_by_role( 'author' );
     325                $date_string = 'invalid date';
     326                $post = array( 'post_title' => 'test', 'post_content' => 'test', 'post_date_gmt' => $date_string );
     327                $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
     328                $fetched_post = get_post( $result );
     329                $this->assertStringMatchesFormat( '%d', $result );
     330        }
     331
    308332}
Note: See TracChangeset for help on using the changeset viewer.