WordPress.org

Make WordPress Core

Changeset 595 in tests


Ignore:
Timestamp:
03/29/12 13:11:25 (3 years ago)
Author:
westi
Message:

XMLRPC: Add mw_newPost test for creating pages.

File:
1 edited

Legend:

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

    r592 r595  
    109109    } 
    110110 
     111    function test_incapable_set_post_type_as_page() { 
     112        $post = array( 'title' => 'Test', 'post_type' => 'page' ); 
     113        $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) ); 
     114        $this->assertInstanceOf( 'IXR_Error', $result ); 
     115        $this->assertEquals( 401, $result->code ); 
     116    } 
     117 
     118    function test_capable_set_post_type_as_page() { 
     119        $post = array( 'title' => 'Test', 'post_type' => 'page' ); 
     120        $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) ); 
     121        $this->assertNotInstanceOf( 'IXR_Error', $result ); 
     122        $this->assertStringMatchesFormat( '%d', $result ); 
     123 
     124        $out = wp_get_single_post( $result ); 
     125        $this->assertEquals( 'Test', $out->post_title ); 
     126        $this->assertEquals( 'page', $out->post_type ); 
     127    } 
     128 
    111129} 
Note: See TracChangeset for help on using the changeset viewer.