Make WordPress Core


Ignore:
Timestamp:
06/30/2012 05:48:18 PM (14 years ago)
Author:
maxcutler
Message:

Port the XML-RPC test suite.

Fixes #45.

File:
1 edited

Legend:

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

    r739 r768  
    11<?php
    22
    3 class TestXMLRPCServer_wp_deletePost extends WPXMLRPCServerTestCase {
     3class TestXMLRPCServer_wp_deletePost extends WP_XMLRPC_UnitTestCase {
    44
    55        function test_invalid_username_password() {
    … …  
    1010
    1111        function test_invalid_post() {
     12                $this->make_user_by_role( 'editor' );
     13
    1214                $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'editor', 'editor', 0 ) );
    1315                $this->assertInstanceOf( 'IXR_Error', $result );
    … …  
    1618
    1719        function test_incapable_user() {
    18                 $this->_insert_quick_posts( 1 );
    19                 $post_id = array_pop( $this->post_ids );
     20                $this->make_user_by_role( 'subscriber' );
     21                $post_id = $this->factory->post->create();
    2022
    2123                $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'subscriber', 'subscriber', $post_id ) );
    2224                $this->assertInstanceOf( 'IXR_Error', $result );
    2325                $this->assertEquals( 401, $result->code );
    24 
    25                 wp_delete_post( $post_id, true );
    2626        }
    2727
    2828        function test_post_deleted() {
    29                 $this->_insert_quick_posts( 1 );
    30                 $post_id = array_pop( $this->post_ids );
     29                $this->make_user_by_role( 'editor' );
     30                $post_id = $this->factory->post->create();
    3131
    3232                $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'editor', 'editor', $post_id ) );
    … …  
    3636                $post = get_post( $post_id );
    3737                $this->assertEquals( 'trash', $post->post_status );
    38 
    39                 wp_delete_post( $post_id, true );
    4038        }
    4139}
Note: See TracChangeset for help on using the changeset viewer.