WordPress.org

Make WordPress Core

Changeset 596 in tests


Ignore:
Timestamp:
03/30/2012 08:12:23 AM (6 years ago)
Author:
markoheijnen
Message:

XMLRPC: Add basic test case for wp_getPost to check for correct date

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test-xmlrpc-api/test_wp_getPost.php

    r556 r596  
    9797        $this->assertArrayHasKey( 'custom_fields', $result );
    9898    }
     99
     100    function test_date() {
     101        $fields = array( 'post' );
     102        $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id, $fields ) );
     103        $this->assertNotInstanceOf( 'IXR_Error', $result );
     104
     105        $this->assertInstanceOf( 'IXR_Date', $result['post_date'] );
     106        $this->assertInstanceOf( 'IXR_Date', $result['post_date_gmt'] );
     107        $this->assertInstanceOf( 'IXR_Date', $result['post_modified'] );
     108        $this->assertInstanceOf( 'IXR_Date', $result['post_modified_gmt'] );
     109
     110        $this->assertEquals( mktime( 0,0,0,0,0,0 ), $result['post_date_gmt']->getTimestamp() );
     111        $this->assertEquals( mktime( 0,0,0,0,0,0 ), $result['post_modified_gmt']->getTimestamp() );
     112    }
    99113}
Note: See TracChangeset for help on using the changeset viewer.