Make WordPress Core

Changeset 29062


Ignore:
Timestamp:
07/10/2014 02:05:22 PM (10 years ago)
Author:
westi
Message:

XMLRPC: Extend the test cases from [28854] so that we also test valid date based strings. See #28601.

File:
1 edited

Legend:

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

    r29061 r29062  
    316316        $fetched_post = get_post( $result );
    317317        $this->assertStringMatchesFormat( '%d', $result );
     318        $this->assertEquals( '1970-01-01 00:00:00', $fetched_post->post_date );
    318319    }
    319320
     
    328329        $fetched_post = get_post( $result );
    329330        $this->assertStringMatchesFormat( '%d', $result );
     331        $this->assertEquals( '1970-01-01 00:00:00', $fetched_post->post_date_gmt );
     332    }
     333
     334    /**
     335     * @ticket 28601
     336     */
     337    function test_valid_string_post_date() {
     338        $this->make_user_by_role( 'author' );
     339        $date_string = '1984-01-11 05:00:00';
     340        $post = array( 'post_title' => 'test', 'post_content' => 'test', 'post_date' => $date_string );
     341        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
     342        $fetched_post = get_post( $result );
     343        $this->assertStringMatchesFormat( '%d', $result );
     344        $this->assertEquals( $date_string , $fetched_post->post_date );
     345    }
     346
     347    /**
     348     * @ticket 28601
     349     */
     350    function test_valid_string_post_date_gmt() {
     351        $this->make_user_by_role( 'author' );
     352        $date_string = '1984-01-11 05:00:00';
     353        $post = array( 'post_title' => 'test', 'post_content' => 'test', 'post_date_gmt' => $date_string );
     354        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
     355        $fetched_post = get_post( $result );
     356        $this->assertStringMatchesFormat( '%d', $result );
     357        $this->assertEquals( $date_string , $fetched_post->post_date_gmt );
    330358    }
    331359
Note: See TracChangeset for help on using the changeset viewer.