Make WordPress Core

Changeset 40417


Ignore:
Timestamp:
04/12/2017 02:58:33 PM (8 years ago)
Author:
johnbillion
Message:

Build/Test tools: Introduce and implement assertNotIXRError() and assertIXRError() assertion methods.

This aids in debugging XMLRPC tests which fail, by exposing the IXR_Error error message in the assertion failure message.

Fixes #40423

Location:
trunk/tests/phpunit
Files:
37 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/testcase.php

    r40416 r40417  
    437437        }
    438438        $this->assertNotInstanceOf( 'WP_Error', $actual, $message );
     439    }
     440
     441    function assertIXRError( $actual, $message = '' ) {
     442        $this->assertInstanceOf( 'IXR_Error', $actual, $message );
     443    }
     444
     445    function assertNotIXRError( $actual, $message = '' ) {
     446        if ( $actual instanceof IXR_Error && '' === $message ) {
     447            $message = $actual->message;
     448        }
     449        $this->assertNotInstanceOf( 'IXR_Error', $actual, $message );
    439450    }
    440451
  • trunk/tests/phpunit/tests/xmlrpc/basic.php

    r37980 r40417  
    1212        $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'username', 'password' ) );
    1313
    14         $this->assertInstanceOf( 'IXR_Error', $result );
     14        $this->assertIXRError( $result );
    1515        // If disabled, 405 would result.
    1616        $this->assertEquals( 403, $result->code );
  • trunk/tests/phpunit/tests/xmlrpc/mt/getRecentPostTitles.php

    r35242 r40417  
    88    function test_invalid_username_password() {
    99        $result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'username', 'password' ) );
    10         $this->assertInstanceOf( 'IXR_Error', $result );
     10        $this->assertIXRError( $result );
    1111        $this->assertEquals( 403, $result->code );
    1212    }
     
    1616
    1717        $result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
    18         $this->assertInstanceOf( 'IXR_Error', $result );
     18        $this->assertIXRError( $result );
    1919        $this->assertEquals( 500, $result->code );
    2020    }
     
    2626
    2727        $result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
    28         $this->assertNotInstanceOf( 'IXR_Error', $result );
     28        $this->assertNotIXRError( $result );
    2929        $this->assertEquals( 0, count( $result ) );
    3030    }
     
    3636
    3737        $results = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) );
    38         $this->assertNotInstanceOf( 'IXR_Error', $results );
     38        $this->assertNotIXRError( $results );
    3939
    4040        foreach( $results as $result ) {
  • trunk/tests/phpunit/tests/xmlrpc/mw/editPost.php

    r37044 r40417  
    99        $post = array();
    1010        $result = $this->myxmlrpcserver->mw_editPost( array( 1, 'username', 'password', $post ) );
    11         $this->assertInstanceOf( 'IXR_Error', $result );
     11        $this->assertIXRError( $result );
    1212        $this->assertEquals( 403, $result->code );
    1313    }
     
    2121        $post2 = array( 'title' => $new_title );
    2222        $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
    23         $this->assertNotInstanceOf( 'IXR_Error', $result );
     23        $this->assertNotIXRError( $result );
    2424        $this->assertTrue($result);
    2525
     
    3838        $post2 = array( 'title' => $new_title );
    3939        $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'editor', 'editor', $post2 ) );
    40         $this->assertNotInstanceOf( 'IXR_Error', $result );
     40        $this->assertNotIXRError( $result );
    4141        $this->assertTrue($result);
    4242
     
    5656        $post2 = array( 'title' => $new_title );
    5757        $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
    58         $this->assertInstanceOf( 'IXR_Error', $result );
     58        $this->assertIXRError( $result );
    5959        $this->assertEquals( 401, $result->code );
    6060
     
    7373        $post2 = array( 'wp_author_id' => $author_id );
    7474        $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'editor', 'editor', $post2 ) );
    75         $this->assertNotInstanceOf( 'IXR_Error', $result );
     75        $this->assertNotIXRError( $result );
    7676        $this->assertTrue($result);
    7777
     
    8989        $post2 = array( 'wp_author_id' => $author_id );
    9090        $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
    91         $this->assertInstanceOf( 'IXR_Error', $result );
     91        $this->assertIXRError( $result );
    9292        $this->assertEquals( 401, $result->code );
    9393
     
    108108        $post2 = array( 'wp_author_id' => $editor_id );
    109109        $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'editor', 'editor', $post2 ) );
    110         $this->assertNotInstanceOf( 'IXR_Error', $result );
     110        $this->assertNotIXRError( $result );
    111111        $this->assertTrue($result);
    112112
     
    132132        $post2 = array( 'wp_post_thumbnail' => $attachment_id );
    133133        $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'author', 'author', $post2 ) );
    134         $this->assertNotInstanceOf( 'IXR_Error', $result );
     134        $this->assertNotIXRError( $result );
    135135        $this->assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
    136136
     
    138138        $post3 = array( 'post_content' => 'Updated post' );
    139139        $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'author', 'author', $post3 ) );
    140         $this->assertNotInstanceOf( 'IXR_Error', $result );
     140        $this->assertNotIXRError( $result );
    141141        $this->assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
    142142
     
    147147        $post4 = array( 'wp_post_thumbnail' => $attachment2_id );
    148148        $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'author', 'author', $post4 ) );
    149         $this->assertNotInstanceOf( 'IXR_Error', $result );
     149        $this->assertNotIXRError( $result );
    150150        $this->assertEquals( $attachment2_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
    151151
     
    153153        $post5 = array( 'wp_post_thumbnail' => '' );
    154154        $result = $this->myxmlrpcserver->mw_editPost( array($post_id, 'author', 'author', $post5 ) );
    155         $this->assertNotInstanceOf( 'IXR_Error', $result );
     155        $this->assertNotIXRError( $result );
    156156        $this->assertEquals( '', get_post_meta( $post_id, '_thumbnail_id', true ) );
    157157
     
    167167        $post2 = array( 'title' => 'New Title', 'post_author' => $contributor_id );
    168168        $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
    169         $this->assertNotInstanceOf( 'IXR_Error', $result );
     169        $this->assertNotIXRError( $result );
    170170        $this->assertTrue($result);
    171171
     
    175175        $post3 = array( 'description' => 'New Content', 'post_author' => $contributor_id );
    176176        $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post3 ) );
    177         $this->assertNotInstanceOf( 'IXR_Error', $result );
     177        $this->assertNotIXRError( $result );
    178178        $this->assertTrue($result);
    179179
     
    184184        $post4 = array( 'mt_excerpt' => 'New Excerpt', 'post_author' => $contributor_id );
    185185        $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post4 ) );
    186         $this->assertNotInstanceOf( 'IXR_Error', $result );
     186        $this->assertNotIXRError( $result );
    187187        $this->assertTrue($result);
    188188
     
    203203
    204204        $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'editor', 'editor', array( 'sticky' => '1' ) ) );
    205         $this->assertNotInstanceOf( 'IXR_Error', $result );
     205        $this->assertNotIXRError( $result );
    206206        $this->assertTrue( $result );
    207207    }
     
    216216        $post2 = array( 'post_type' => 'page' );
    217217        $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) );
    218         $this->assertInstanceOf( 'IXR_Error', $result );
     218        $this->assertIXRError( $result );
    219219        $this->assertEquals( $result->code, 401 );
    220220    }
  • trunk/tests/phpunit/tests/xmlrpc/mw/getPost.php

    r39189 r40417  
    2020    function test_invalid_username_password() {
    2121        $result = $this->myxmlrpcserver->mw_getPost( array( self::$post_id, 'username', 'password' ) );
    22         $this->assertInstanceOf( 'IXR_Error', $result );
     22        $this->assertIXRError( $result );
    2323        $this->assertEquals( 403, $result->code );
    2424    }
     
    2828
    2929        $result = $this->myxmlrpcserver->mw_getPost( array( self::$post_id, 'subscriber', 'subscriber' ) );
    30         $this->assertInstanceOf( 'IXR_Error', $result );
     30        $this->assertIXRError( $result );
    3131        $this->assertEquals( 401, $result->code );
    3232    }
     
    3737    function test_invalid_postid() {
    3838        $result = $this->myxmlrpcserver->mw_getPost( array( 9999, 'author', 'author' ) );
    39         $this->assertInstanceOf( 'IXR_Error', $result );
     39        $this->assertIXRError( $result );
    4040        $this->assertEquals( 404, $result->code );
    4141    }
     
    4646        $fields = array( 'post' );
    4747        $result = $this->myxmlrpcserver->mw_getPost( array( self::$post_id, 'author', 'author' ) );
    48         $this->assertNotInstanceOf( 'IXR_Error', $result );
     48        $this->assertNotIXRError( $result );
    4949
    5050        // Check data types
     
    9797        $fields = array( 'post' );
    9898        $result = $this->myxmlrpcserver->mw_getPost( array( self::$post_id, 'author', 'author' ) );
    99         $this->assertNotInstanceOf( 'IXR_Error', $result );
     99        $this->assertNotIXRError( $result );
    100100
    101101        $this->assertInternalType( 'string', $result['wp_post_thumbnail'] );
     
    109109        $fields = array( 'post' );
    110110        $result = $this->myxmlrpcserver->mw_getPost( array( self::$post_id, 'author', 'author' ) );
    111         $this->assertNotInstanceOf( 'IXR_Error', $result );
     111        $this->assertNotIXRError( $result );
    112112
    113113        $this->assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
  • trunk/tests/phpunit/tests/xmlrpc/mw/getRecentPosts.php

    r39189 r40417  
    2121    function test_invalid_username_password() {
    2222        $result = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'username', 'password' ) );
    23         $this->assertInstanceOf( 'IXR_Error', $result );
     23        $this->assertIXRError( $result );
    2424        $this->assertEquals( 403, $result->code );
    2525    }
     
    3232
    3333        $result = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'subscriber', 'subscriber' ) );
    34         $this->assertInstanceOf( 'IXR_Error', $result );
     34        $this->assertIXRError( $result );
    3535        $this->assertEquals( 401, $result->code );
    3636    }
     
    4040
    4141        $result = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'author', 'author' ) );
    42         $this->assertNotInstanceOf( 'IXR_Error', $result );
     42        $this->assertNotIXRError( $result );
    4343        $this->assertEquals( 0, count( $result ) );
    4444    }
     
    4949        $fields = array( 'post' );
    5050        $results = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'author', 'author' ) );
    51         $this->assertNotInstanceOf( 'IXR_Error', $results );
     51        $this->assertNotIXRError( $results );
    5252
    5353        foreach( $results as $result ) {
     
    100100
    101101        $results = $this->myxmlrpcserver->mw_getRecentPosts( array( self::$post_id, 'author', 'author' ) );
    102         $this->assertNotInstanceOf( 'IXR_Error', $results );
     102        $this->assertNotIXRError( $results );
    103103
    104104        foreach( $results as $result ) {
     
    120120
    121121        $results = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'editor', 'editor' ) );
    122         $this->assertNotInstanceOf( 'IXR_Error', $results );
     122        $this->assertNotIXRError( $results );
    123123
    124124        foreach( $results as $result ) {
  • trunk/tests/phpunit/tests/xmlrpc/mw/newPost.php

    r36163 r40417  
    99        $post = array();
    1010        $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'username', 'password', $post ) );
    11         $this->assertInstanceOf( 'IXR_Error', $result );
     11        $this->assertIXRError( $result );
    1212        $this->assertEquals( 403, $result->code );
    1313    }
     
    1818        $post = array();
    1919        $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'subscriber', 'subscriber', $post ) );
    20         $this->assertInstanceOf( 'IXR_Error', $result );
     20        $this->assertIXRError( $result );
    2121        $this->assertEquals( 401, $result->code );
    2222    }
     
    2727        $post = array();
    2828        $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
    29         $this->assertInstanceOf( 'IXR_Error', $result );
     29        $this->assertIXRError( $result );
    3030        $this->assertEquals( 500, $result->code );
    3131        $this->assertEquals( 'Content, title, and excerpt are empty.', $result->message );
     
    3737        $post = array( 'title' => 'Test' );
    3838        $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
    39         $this->assertNotInstanceOf( 'IXR_Error', $result );
     39        $this->assertNotIXRError( $result );
    4040        $this->assertStringMatchesFormat( '%d', $result );
    4141    }
     
    4646        $post = array( 'title' => 'Test', 'ID' => 103948 );
    4747        $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
    48         $this->assertNotInstanceOf( 'IXR_Error', $result );
     48        $this->assertNotIXRError( $result );
    4949        $this->assertNotEquals( '103948', $result );
    5050    }
     
    5555        $post = array( 'title' => 'Test', 'post_status' => 'publish' );
    5656        $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
    57         $this->assertNotInstanceOf( 'IXR_Error', $result );
     57        $this->assertNotIXRError( $result );
    5858    }
    5959
     
    6363        $post = array( 'title' => 'Test', 'post_status' => 'publish' );
    6464        $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'contributor', 'contributor', $post ) );
    65         $this->assertInstanceOf( 'IXR_Error', $result );
     65        $this->assertIXRError( $result );
    6666        $this->assertEquals( 401, $result->code );
    6767    }
     
    7373        $post = array( 'title' => 'Test', 'wp_author_id' => $other_author_id );
    7474        $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
    75         $this->assertNotInstanceOf( 'IXR_Error', $result );
     75        $this->assertNotIXRError( $result );
    7676    }
    7777
     
    8282        $post = array( 'title' => 'Test', 'wp_author_id' => $other_author_id );
    8383        $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'contributor', 'contributor', $post ) );
    84         $this->assertInstanceOf( 'IXR_Error', $result );
     84        $this->assertIXRError( $result );
    8585        $this->assertEquals( 401, $result->code );
    8686    }
     
    9494        $post = array( 'title' => 'Test', 'wp_author_id' => 99999999 );
    9595        $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
    96         $this->assertInstanceOf( 'IXR_Error', $result );
     96        $this->assertIXRError( $result );
    9797        $this->assertEquals( 404, $result->code );
    9898    }
     
    103103        $post = array( 'title' => 'Test' );
    104104        $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
    105         $this->assertNotInstanceOf( 'IXR_Error', $result );
     105        $this->assertNotIXRError( $result );
    106106        $this->assertStringMatchesFormat( '%d', $result );
    107107
     
    122122        $post = array( 'title' => 'Post Thumbnail Test', 'wp_post_thumbnail' => $attachment_id );
    123123        $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
    124         $this->assertNotInstanceOf( 'IXR_Error', $result );
     124        $this->assertNotIXRError( $result );
    125125        $this->assertEquals( $attachment_id, get_post_meta( $result, '_thumbnail_id', true ) );
    126126
     
    133133        $post = array( 'title' => 'Test', 'post_type' => 'page' );
    134134        $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) );
    135         $this->assertInstanceOf( 'IXR_Error', $result );
     135        $this->assertIXRError( $result );
    136136        $this->assertEquals( 401, $result->code );
    137137    }
     
    142142        $post = array( 'title' => 'Test', 'post_type' => 'page' );
    143143        $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
    144         $this->assertNotInstanceOf( 'IXR_Error', $result );
     144        $this->assertNotIXRError( $result );
    145145        $this->assertStringMatchesFormat( '%d', $result );
    146146
     
    163163        );
    164164        $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) );
    165         $this->assertNotInstanceOf( 'IXR_Error', $result );
     165        $this->assertNotIXRError( $result );
    166166        $this->assertStringMatchesFormat( '%d', $result );
    167167
  • trunk/tests/phpunit/tests/xmlrpc/wp/deletePost.php

    r35242 r40417  
    88    function test_invalid_username_password() {
    99        $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'username', 'password', 0 ) );
    10         $this->assertInstanceOf( 'IXR_Error', $result );
     10        $this->assertIXRError( $result );
    1111        $this->assertEquals( 403, $result->code );
    1212    }
     
    1616
    1717        $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'editor', 'editor', 340982340 ) );
    18         $this->assertInstanceOf( 'IXR_Error', $result );
     18        $this->assertIXRError( $result );
    1919        $this->assertEquals( 404, $result->code );
    2020    }
     
    2525
    2626        $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'subscriber', 'subscriber', $post_id ) );
    27         $this->assertInstanceOf( 'IXR_Error', $result );
     27        $this->assertIXRError( $result );
    2828        $this->assertEquals( 401, $result->code );
    2929    }
     
    3434
    3535        $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'editor', 'editor', $post_id ) );
    36         $this->assertNotInstanceOf( 'IXR_Error', $result );
     36        $this->assertNotIXRError( $result );
    3737        $this->assertTrue( $result );
    3838
  • trunk/tests/phpunit/tests/xmlrpc/wp/deleteTerm.php

    r39189 r40417  
    1515    function test_invalid_username_password() {
    1616        $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'username', 'password', 'category', 0 ) );
    17         $this->assertInstanceOf( 'IXR_Error', $result );
     17        $this->assertIXRError( $result );
    1818        $this->assertEquals( 403, $result->code );
    1919    }
     
    2323
    2424        $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', '', 0 ) );
    25         $this->assertInstanceOf( 'IXR_Error', $result );
     25        $this->assertIXRError( $result );
    2626        $this->assertEquals( 403, $result->code );
    2727        $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message );
     
    3232
    3333        $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', 'not_existing', 0 ) );
    34         $this->assertInstanceOf( 'IXR_Error', $result );
     34        $this->assertIXRError( $result );
    3535        $this->assertEquals( 403, $result->code );
    3636        $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message );
     
    4141
    4242        $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', 'category', self::$term_id ) );
    43         $this->assertInstanceOf( 'IXR_Error', $result );
     43        $this->assertIXRError( $result );
    4444        $this->assertEquals( 401, $result->code );
    4545        $this->assertEquals( __( 'Sorry, you are not allowed to delete this term.' ), $result->message );
     
    5050
    5151        $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', '' ) );
    52         $this->assertInstanceOf( 'IXR_Error', $result );
     52        $this->assertIXRError( $result );
    5353        $this->assertEquals( 500, $result->code );
    5454        $this->assertEquals( __('Empty Term'), $result->message );
     
    5959
    6060        $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', 9999 ) );
    61         $this->assertInstanceOf( 'IXR_Error', $result );
     61        $this->assertIXRError( $result );
    6262        $this->assertEquals( 404, $result->code );
    6363        $this->assertEquals( __( 'Invalid term ID.' ), $result->message );
     
    6868
    6969        $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', self::$term_id ) );
    70         $this->assertNotInstanceOf( 'IXR_Error', $result );
     70        $this->assertNotIXRError( $result );
    7171        $this->assertInternalType( 'boolean', $result );
    7272    }
  • trunk/tests/phpunit/tests/xmlrpc/wp/editComment.php

    r38938 r40417  
    2323            'status' => 'hold'
    2424        ) ) );
    25         $this->assertNotInstanceOf( 'IXR_Error', $result );
     25        $this->assertNotIXRError( $result );
    2626        $this->assertTrue( $result );
    2727    }
     
    4343
    4444        $result = $this->myxmlrpcserver->wp_editComment( array( 1, 'author', 'author', $comment_id, array( 'status' => 'hold' ) ) );
    45         $this->assertInstanceOf( 'IXR_Error', $result );
     45        $this->assertIXRError( $result );
    4646        $this->assertEquals( 403, $result->code );
    4747        $this->assertEquals( __( 'Sorry, you are not allowed to moderate or edit this comment.' ), $result->message );
  • trunk/tests/phpunit/tests/xmlrpc/wp/editPost.php

    r37044 r40417  
    88    function test_invalid_username_password() {
    99        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'username', 'password', 0, array() ) );
    10         $this->assertInstanceOf( 'IXR_Error', $result );
     10        $this->assertIXRError( $result );
    1111        $this->assertEquals( 403, $result->code );
    1212    }
     
    2121        $post2 = array( 'post_title' => $new_title );
    2222        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
    23         $this->assertNotInstanceOf( 'IXR_Error', $result );
     23        $this->assertNotIXRError( $result );
    2424        $this->assertTrue($result);
    2525
     
    3838        $post2 = array( 'post_title' => $new_title );
    3939        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
    40         $this->assertNotInstanceOf( 'IXR_Error', $result );
     40        $this->assertNotIXRError( $result );
    4141        $this->assertTrue($result);
    4242
     
    5656        $post2 = array( 'post_title' => $new_title );
    5757        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
    58         $this->assertInstanceOf( 'IXR_Error', $result );
     58        $this->assertIXRError( $result );
    5959        $this->assertEquals( 401, $result->code );
    6060
     
    7373        $post2 = array( 'post_author' => $author_id );
    7474        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
    75         $this->assertNotInstanceOf( 'IXR_Error', $result );
     75        $this->assertNotIXRError( $result );
    7676        $this->assertTrue($result);
    7777
     
    8989        $post2 = array( 'post_author' => $author_id );
    9090        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
    91         $this->assertInstanceOf( 'IXR_Error', $result );
     91        $this->assertIXRError( $result );
    9292        $this->assertEquals( 401, $result->code );
    9393
     
    108108        $post2 = array( 'post_author' => $editor_id );
    109109        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
    110         $this->assertNotInstanceOf( 'IXR_Error', $result );
     110        $this->assertNotIXRError( $result );
    111111        $this->assertTrue($result);
    112112
     
    132132        $post2 = array( 'post_thumbnail' => $attachment_id );
    133133        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post2 ) );
    134         $this->assertNotInstanceOf( 'IXR_Error', $result );
     134        $this->assertNotIXRError( $result );
    135135        $this->assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
    136136
    137137        // fetch the post to verify that it appears
    138138        $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $post_id ) );
    139         $this->assertNotInstanceOf( 'IXR_Error', $result );
     139        $this->assertNotIXRError( $result );
    140140        $this->assertArrayHasKey( 'post_thumbnail', $result );
    141141        $this->assertInternalType( 'array', $result['post_thumbnail'] );
     
    145145        $post3 = array( 'post_content' => 'Updated post' );
    146146        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post3 ) );
    147         $this->assertNotInstanceOf( 'IXR_Error', $result );
     147        $this->assertNotIXRError( $result );
    148148        $this->assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
    149149
     
    154154        $post4 = array( 'post_thumbnail' => $attachment2_id );
    155155        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post4 ) );
    156         $this->assertNotInstanceOf( 'IXR_Error', $result );
     156        $this->assertNotIXRError( $result );
    157157        $this->assertEquals( $attachment2_id, get_post_meta( $post_id, '_thumbnail_id', true ) );
    158158
     
    160160        $post5 = array( 'post_thumbnail' => '' );
    161161        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post5 ) );
    162         $this->assertNotInstanceOf( 'IXR_Error', $result );
     162        $this->assertNotIXRError( $result );
    163163        $this->assertEquals( '', get_post_meta( $post_id, '_thumbnail_id', true ) );
    164164
     
    166166        $post6 = array( 'post_thumbnail' => 398420983409 );
    167167        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post6 ) );
    168         $this->assertInstanceOf( 'IXR_Error', $result );
     168        $this->assertIXRError( $result );
    169169        $this->assertEquals( 404, $result->code );
    170170
     
    192192
    193193        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) );
    194         $this->assertNotInstanceOf( 'IXR_Error', $result );
     194        $this->assertNotIXRError( $result );
    195195        $this->assertTrue($result);
    196196
     
    214214        $post2 = array( 'sticky' => false );
    215215        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
    216         $this->assertNotInstanceOf( 'IXR_Error', $result );
     216        $this->assertNotIXRError( $result );
    217217        $this->assertFalse( is_sticky( $post_id ) );
    218218    }
     
    226226        $post2 = array( 'post_password' => 'foobar',  'sticky' => false );
    227227        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) );
    228         $this->assertNotInstanceOf( 'IXR_Error', $result );
     228        $this->assertNotIXRError( $result );
    229229        $this->assertFalse( is_sticky( $post_id ) );
    230230    }
     
    246246        $struct = array( 'post_content' => 'First edit', 'if_not_modified_since' => new IXR_Date( $yesterday ) );
    247247        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $struct ) );
    248         $this->assertNotInstanceOf( 'IXR_Error', $result );
     248        $this->assertNotIXRError( $result );
    249249
    250250        // Make sure the edit went through.
     
    254254        $struct = array( 'post_content' => 'Second edit', 'if_not_modified_since' => new IXR_Date( $yesterday ) );
    255255        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $struct ) );
    256         $this->assertInstanceOf( 'IXR_Error', $result );
     256        $this->assertIXRError( $result );
    257257        $this->assertEquals( 409, $result->code );
    258258
     
    274274        $struct = array( 'post_content' => 'First edit' );
    275275        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $struct ) );
    276         $this->assertNotInstanceOf( 'IXR_Error', $result );
     276        $this->assertNotIXRError( $result );
    277277
    278278        // Make sure that the post status is still inherit
     
    291291        $struct = array( 'post_status' => 'doesnt_exists' );
    292292        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $struct ) );
    293         $this->assertNotInstanceOf( 'IXR_Error', $result );
     293        $this->assertNotIXRError( $result );
    294294
    295295        // Make sure that the post status is still inherit
     
    310310
    311311        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, array( 'ID' => $post_id, 'post_title' => 'Updated' ) ) );
    312         $this->assertNotInstanceOf( 'IXR_Error', $result );
     312        $this->assertNotIXRError( $result );
    313313        $this->assertEquals( 'Updated', get_post( $post_id )->post_title );
    314314
     
    337337        );
    338338        $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $new_post_content ) );
    339         $this->assertNotInstanceOf( 'IXR_Error', $result );
     339        $this->assertNotIXRError( $result );
    340340        $this->assertEquals( 'Updated', get_post( $post_id )->post_title );
    341341
  • trunk/tests/phpunit/tests/xmlrpc/wp/editProfile.php

    r39174 r40417  
    99    function test_invalid_username_password() {
    1010        $result = $this->myxmlrpcserver->wp_editProfile( array( 1, 'username', 'password', array() ) );
    11         $this->assertInstanceOf( 'IXR_Error', $result );
     11        $this->assertIXRError( $result );
    1212        $this->assertEquals( 403, $result->code );
    1313    }
     
    2626        );
    2727        $result = $this->myxmlrpcserver->wp_editProfile( array( 1, 'subscriber', 'subscriber', $new_data ) );
    28         $this->assertNotInstanceOf( 'IXR_Error', $result );
     28        $this->assertNotIXRError( $result );
    2929        $this->assertTrue( $result );
    3030
     
    4646
    4747        $result = $this->myxmlrpcserver->wp_editProfile( array( 1, 'author', 'author', $new_data ) );
    48         $this->assertNotInstanceOf( 'IXR_Error', $result );
     48        $this->assertNotIXRError( $result );
    4949        $this->assertTrue( $result );
    5050
     
    6161
    6262        $result = $this->myxmlrpcserver->wp_editProfile( array( 1, 'editor', 'editor', $new_data ) );
    63         $this->assertNotInstanceOf( 'IXR_Error', $result );
     63        $this->assertNotIXRError( $result );
    6464        $this->assertTrue( $result );
    6565
  • trunk/tests/phpunit/tests/xmlrpc/wp/editTerm.php

    r39189 r40417  
    2323    function test_invalid_username_password() {
    2424        $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'username', 'password', 'category', 1 ) );
    25         $this->assertInstanceOf( 'IXR_Error', $result );
     25        $this->assertIXRError( $result );
    2626        $this->assertEquals( 403, $result->code );
    2727    }
     
    3131
    3232        $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', '', array( 'taxonomy' => '' ) ) );
    33         $this->assertInstanceOf( 'IXR_Error', $result );
     33        $this->assertIXRError( $result );
    3434        $this->assertEquals( 403, $result->code );
    3535        $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message );
     
    4040
    4141        $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', self::$parent_term, array( 'taxonomy' => 'not_existing' ) ) );
    42         $this->assertInstanceOf( 'IXR_Error', $result );
     42        $this->assertIXRError( $result );
    4343        $this->assertEquals( 403, $result->code );
    4444        $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message );
     
    4949
    5050        $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', self::$parent_term, array( 'taxonomy' => 'category' ) ) );
    51         $this->assertInstanceOf( 'IXR_Error', $result );
     51        $this->assertIXRError( $result );
    5252        $this->assertEquals( 401, $result->code );
    5353        $this->assertEquals( __( 'Sorry, you are not allowed to edit this term.' ), $result->message );
     
    5858
    5959        $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', 9999, array( 'taxonomy' => 'category' ) ) );
    60         $this->assertInstanceOf( 'IXR_Error', $result );
     60        $this->assertIXRError( $result );
    6161        $this->assertEquals( 404, $result->code );
    6262        $this->assertEquals(  __( 'Invalid term ID.' ), $result->message );
     
    6767
    6868        $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', '', array( 'taxonomy' => 'category' ) ) );
    69         $this->assertInstanceOf( 'IXR_Error', $result );
     69        $this->assertIXRError( $result );
    7070        $this->assertEquals( 500, $result->code );
    7171        $this->assertEquals( __('Empty Term'), $result->message );
     
    7676
    7777        $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', self::$parent_term, array( 'taxonomy' => 'category', 'name' => '' ) ) );
    78         $this->assertInstanceOf( 'IXR_Error', $result );
     78        $this->assertIXRError( $result );
    7979        $this->assertEquals( 403, $result->code );
    8080        $this->assertEquals( __( 'The term name cannot be empty.' ), $result->message );
     
    8585
    8686        $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', self::$post_tag, array( 'taxonomy' => 'post_tag', 'parent' => self::$parent_term ) ) );
    87         $this->assertInstanceOf( 'IXR_Error', $result );
     87        $this->assertIXRError( $result );
    8888        $this->assertEquals( 403, $result->code );
    8989        $this->assertEquals( __( "This taxonomy is not hierarchical so you can't set a parent." ), $result->message );
     
    9494
    9595        $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', self::$child_term, array( 'taxonomy' => 'category', 'parent' => '', 'name' => 'test' ) ) );
    96         $this->assertNotInstanceOf( 'IXR_Error', $result );
     96        $this->assertNotIXRError( $result );
    9797        $this->assertTrue( $result );
    9898    }
     
    103103        $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', self::$child_term, array( 'taxonomy' => 'category', 'parent' => NULL, 'name' => 'test' ) ) );
    104104
    105         $this->assertNotInstanceOf( 'IXR_Error', $result );
     105        $this->assertNotIXRError( $result );
    106106        $this->assertInternalType( 'boolean', $result );
    107107
     
    114114
    115115        $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', self::$child_term, array( 'taxonomy' => 'category', 'parent' => 'dasda', 'name' => 'test' ) ) );
    116         $this->assertInstanceOf( 'IXR_Error', $result );
     116        $this->assertIXRError( $result );
    117117        $this->assertEquals( 500, $result->code );
    118118    }
     
    122122
    123123        $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', self::$child_term, array( 'taxonomy' => 'category', 'parent' => 9999, 'name' => 'test' ) ) );
    124         $this->assertInstanceOf( 'IXR_Error', $result );
     124        $this->assertIXRError( $result );
    125125        $this->assertEquals( 403, $result->code );
    126126        $this->assertEquals( __( 'Parent term does not exist.' ), $result->message );
     
    132132        $parent_term = get_term_by( 'id', self::$parent_term, 'category' );
    133133        $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', self::$child_term, array( 'taxonomy' => 'category', 'slug' => $parent_term->slug ) ) );
    134         $this->assertInstanceOf( 'IXR_Error', $result );
     134        $this->assertIXRError( $result );
    135135        $this->assertEquals( 500, $result->code );
    136136        $this->assertEquals( htmlspecialchars( sprintf( __('The slug “%s” is already in use by another term'), $parent_term->slug ) ), $result->message );
     
    143143        $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', self::$child_term, $fields ) );
    144144
    145         $this->assertNotInstanceOf( 'IXR_Error', $result );
     145        $this->assertNotIXRError( $result );
    146146        $this->assertInternalType( 'boolean', $result );
    147147    }
  • trunk/tests/phpunit/tests/xmlrpc/wp/getComment.php

    r39189 r40417  
    3636    function test_invalid_username_password() {
    3737        $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'username', 'password', self::$parent_comment_id ) );
    38         $this->assertInstanceOf( 'IXR_Error', $result );
     38        $this->assertIXRError( $result );
    3939        $this->assertEquals( 403, $result->code );
    4040    }
     
    4444
    4545        $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'contributor', 'contributor', self::$parent_comment_id ) );
    46         $this->assertInstanceOf( 'IXR_Error', $result );
     46        $this->assertIXRError( $result );
    4747        $this->assertEquals( 403, $result->code );
    4848    }
     
    5252
    5353        $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'editor', 'editor', self::$parent_comment_id ) );
    54         $this->assertNotInstanceOf( 'IXR_Error', $result );
     54        $this->assertNotIXRError( $result );
    5555
    5656        // Check data types
     
    8888
    8989        $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'editor', 'editor', self::$child_comment_id ) );
    90         $this->assertNotInstanceOf( 'IXR_Error', $result );
     90        $this->assertNotIXRError( $result );
    9191
    9292        $this->assertEquals( self::$child_comment_id, $result['comment_id'] );
     
    9898
    9999        $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'editor', 'editor', 123456789 ) );
    100         $this->assertInstanceOf( 'IXR_Error', $result );
     100        $this->assertIXRError( $result );
    101101        $this->assertEquals( 404, $result->code );
    102102    }
  • trunk/tests/phpunit/tests/xmlrpc/wp/getComments.php

    r35242 r40417  
    99    function test_invalid_username_password() {
    1010        $result = $this->myxmlrpcserver->wp_getComments( array( 1, 'username', 'password', array() ) );
    11         $this->assertInstanceOf( 'IXR_Error', $result );
     11        $this->assertIXRError( $result );
    1212        $this->assertEquals( 403, $result->code );
    1313    }
     
    1717
    1818        $result = $this->myxmlrpcserver->wp_getComments( array( 1, 'contributor', 'contributor', array() ) );
    19         $this->assertInstanceOf( 'IXR_Error', $result );
     19        $this->assertIXRError( $result );
    2020        $this->assertEquals( 401, $result->code );
    2121    }
     
    2828
    2929        $results = $this->myxmlrpcserver->wp_getComments( array( 1, 'editor', 'editor', array() ) );
    30         $this->assertNotInstanceOf( 'IXR_Error', $results );
     30        $this->assertNotIXRError( $results );
    3131
    3232        foreach( $results as $result ) {
     
    4545            'post_id' => $this->post_id
    4646        ) ) );
    47         $this->assertNotInstanceOf( 'IXR_Error', $results );
     47        $this->assertNotIXRError( $results );
    4848
    4949        foreach( $results as $result ) {
     
    6161            'post_id' => $this->post_id,
    6262        ) ) );
    63         $this->assertNotInstanceOf( 'IXR_Error', $results );
     63        $this->assertNotIXRError( $results );
    6464
    6565        // if no 'number' filter is specified, default should be 10
     
    7070            'number' => 5
    7171        ) ) );
    72         $this->assertNotInstanceOf( 'IXR_Error', $results2 );
     72        $this->assertNotIXRError( $results2 );
    7373        $this->assertCount( 5, $results2 );
    7474    }
     
    105105
    106106        $result = $this->myxmlrpcserver->wp_getComments( array( 1, 'contributor', 'contributor' ) );
    107         $this->assertInstanceOf( 'IXR_Error', $result );
     107        $this->assertIXRError( $result );
    108108        $this->assertEquals( 401, $result->code );
    109109    }
     
    141141            'post_id' => $author_post_id
    142142        ) ) );
    143         $this->assertInstanceOf( 'IXR_Error', $result1 );
     143        $this->assertIXRError( $result1 );
    144144
    145145        $result2 = $this->myxmlrpcserver->wp_getComments( array( 1, 'author', 'author', array(
     
    154154            'post_id' => $editor_post_id
    155155        ) ) );
    156         $this->assertInstanceOf( 'IXR_Error', $result3 );
     156        $this->assertIXRError( $result3 );
    157157
    158158        $result4 = $this->myxmlrpcserver->wp_getComments( array( 1, 'author', 'author', array(
  • trunk/tests/phpunit/tests/xmlrpc/wp/getMediaItem.php

    r39189 r40417  
    3939    function test_invalid_username_password() {
    4040        $result = $this->myxmlrpcserver->wp_getMediaItem( array( 1, 'username', 'password', 0 ) );
    41         $this->assertInstanceOf( 'IXR_Error', $result );
     41        $this->assertIXRError( $result );
    4242        $this->assertEquals( 403, $result->code );
    4343    }
     
    4848        $fields = array( 'post' );
    4949        $result = $this->myxmlrpcserver->wp_getMediaItem( array( 1, 'author', 'author', $this->attachment_id, $fields ) );
    50         $this->assertNotInstanceOf( 'IXR_Error', $result );
     50        $this->assertNotIXRError( $result );
    5151
    5252        // Check data types
  • trunk/tests/phpunit/tests/xmlrpc/wp/getOptions.php

    r25002 r40417  
    88    function test_invalid_username_password() {
    99        $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'username', 'password' ) );
    10         $this->assertInstanceOf( 'IXR_Error', $result );
     10        $this->assertIXRError( $result );
    1111        $this->assertEquals( 403, $result->code );
    1212    }
  • trunk/tests/phpunit/tests/xmlrpc/wp/getPage.php

    r39189 r40417  
    2121    function test_invalid_username_password() {
    2222        $result = $this->myxmlrpcserver->wp_getPage( array( 1, self::$post_id, 'username', 'password' ) );
    23         $this->assertInstanceOf( 'IXR_Error', $result );
     23        $this->assertIXRError( $result );
    2424        $this->assertEquals( 403, $result->code );
    2525    }
     
    3232
    3333        $result = $this->myxmlrpcserver->wp_getPage( array( 1, 9999, 'editor', 'editor' ) );
    34         $this->assertInstanceOf( 'IXR_Error', $result );
     34        $this->assertIXRError( $result );
    3535        $this->assertEquals( 404, $result->code );
    3636    }
     
    4040
    4141        $result = $this->myxmlrpcserver->wp_getPage( array( 1, self::$post_id, 'editor', 'editor' ) );
    42         $this->assertNotInstanceOf( 'IXR_Error', $result );
     42        $this->assertNotIXRError( $result );
    4343
    4444        // Check data types
     
    8181
    8282        $result = $this->myxmlrpcserver->wp_getPage( array( 1, self::$post_id, 'editor', 'editor' ) );
    83         $this->assertNotInstanceOf( 'IXR_Error', $result );
     83        $this->assertNotIXRError( $result );
    8484
    8585        $this->assertInstanceOf( 'IXR_Date', $result['dateCreated'] );
  • trunk/tests/phpunit/tests/xmlrpc/wp/getPageList.php

    r39189 r40417  
    2121    function test_invalid_username_password() {
    2222        $result = $this->myxmlrpcserver->wp_getPageList( array( 1, 'username', 'password' ) );
    23         $this->assertInstanceOf( 'IXR_Error', $result );
     23        $this->assertIXRError( $result );
    2424        $this->assertEquals( 403, $result->code );
    2525    }
     
    2929
    3030        $result = $this->myxmlrpcserver->wp_getPageList( array( 1, 'contributor', 'contributor' ) );
    31         $this->assertInstanceOf( 'IXR_Error', $result );
     31        $this->assertIXRError( $result );
    3232        $this->assertEquals( 401, $result->code );
    3333    }
     
    3737
    3838        $results = $this->myxmlrpcserver->wp_getPageList( array( 1, 'editor', 'editor' ) );
    39         $this->assertNotInstanceOf( 'IXR_Error', $results );
     39        $this->assertNotIXRError( $results );
    4040
    4141        foreach( $results as $result ) {
  • trunk/tests/phpunit/tests/xmlrpc/wp/getPages.php

    r39189 r40417  
    2727    function test_invalid_username_password() {
    2828        $result = $this->myxmlrpcserver->wp_getPages( array( 1, 'username', 'password' ) );
    29         $this->assertInstanceOf( 'IXR_Error', $result );
     29        $this->assertIXRError( $result );
    3030        $this->assertEquals( 403, $result->code );
    3131    }
     
    3535
    3636        $result = $this->myxmlrpcserver->wp_getPages( array( 1, 'contributor', 'contributor' ) );
    37         $this->assertInstanceOf( 'IXR_Error', $result );
     37        $this->assertIXRError( $result );
    3838        $this->assertEquals( 401, $result->code );
    3939    }
     
    4141    function test_capable_user() {
    4242        $results = $this->myxmlrpcserver->wp_getPages( array( 1, 'administrator', 'administrator' ) );
    43         $this->assertNotInstanceOf( 'IXR_Error', $results );
     43        $this->assertNotIXRError( $results );
    4444
    4545        foreach( $results as $result ) {
     
    6666
    6767        $results = $this->myxmlrpcserver->wp_getPages( array( 1, 'editor', 'editor' ) );
    68         $this->assertNotInstanceOf( 'IXR_Error', $results );
     68        $this->assertNotIXRError( $results );
    6969
    7070        $found_incapable = false;
    7171        foreach( $results as $result ) {
    7272            // WP#20629
    73             $this->assertNotInstanceOf( 'IXR_Error', $result );
     73            $this->assertNotIXRError( $result );
    7474
    7575            if ( $result['page_id'] == self::$post_id ) {
  • trunk/tests/phpunit/tests/xmlrpc/wp/getPost.php

    r35242 r40417  
    2828    function test_invalid_username_password() {
    2929        $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'username', 'password', 1 ) );
    30         $this->assertInstanceOf( 'IXR_Error', $result );
     30        $this->assertIXRError( $result );
    3131        $this->assertEquals( 403, $result->code );
    3232    }
     
    3737        $fields = array( 'post', 'custom_fields' );
    3838        $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id, $fields ) );
    39         $this->assertNotInstanceOf( 'IXR_Error', $result );
     39        $this->assertNotIXRError( $result );
    4040
    4141        // Check data types
     
    8080        $fields = array();
    8181        $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id, $fields ) );
    82         $this->assertNotInstanceOf( 'IXR_Error', $result );
     82        $this->assertNotIXRError( $result );
    8383
    8484        // when no fields are requested, only the IDs should be returned
     
    8989    function test_default_fields() {
    9090        $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id ) );
    91         $this->assertNotInstanceOf( 'IXR_Error', $result );
     91        $this->assertNotIXRError( $result );
    9292
    9393        $this->assertArrayHasKey( 'post_id', $result );
     
    100100        $fields = array( 'post' );
    101101        $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id, $fields ) );
    102         $this->assertNotInstanceOf( 'IXR_Error', $result );
     102        $this->assertNotIXRError( $result );
    103103
    104104        $this->assertInstanceOf( 'IXR_Date', $result['post_date'] );
     
    131131
    132132        $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'editor', 'editor', $child_page_id ) );
    133         $this->assertNotInstanceOf( 'IXR_Error', $result );
     133        $this->assertNotIXRError( $result );
    134134
    135135        $this->assertInternalType( 'string', $result['post_id'] );
  • trunk/tests/phpunit/tests/xmlrpc/wp/getPostType.php

    r25002 r40417  
    3232    function test_invalid_username_password() {
    3333        $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'username', 'password', 'post' ) );
    34         $this->assertInstanceOf( 'IXR_Error', $result );
     34        $this->assertIXRError( $result );
    3535        $this->assertEquals( 403, $result->code );
    3636    }
     
    4040
    4141        $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'editor', 'editor', 'foobar' ) );
    42         $this->assertInstanceOf( 'IXR_Error', $result );
     42        $this->assertIXRError( $result );
    4343        $this->assertEquals( 403, $result->code );
    4444    }
     
    4848
    4949        $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'editor', 'editor', 'post' ) );
    50         $this->assertNotInstanceOf( 'IXR_Error', $result );
     50        $this->assertNotIXRError( $result );
    5151    }
    5252
     
    5555
    5656        $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'subscriber', 'subscriber', 'post' ) );
    57         $this->assertInstanceOf( 'IXR_Error', $result );
     57        $this->assertIXRError( $result );
    5858        $this->assertEquals( 401, $result->code );
    5959    }
     
    6363
    6464        $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'editor', 'editor', $this->cpt_name, array( 'labels', 'cap', 'menu', 'taxonomies' ) ) );
    65         $this->assertNotInstanceOf( 'IXR_Error', $result );
     65        $this->assertNotIXRError( $result );
    6666
    6767        // check data types
  • trunk/tests/phpunit/tests/xmlrpc/wp/getPostTypes.php

    r25002 r40417  
    77    function test_invalid_username_password() {
    88        $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'username', 'password', 'post' ) );
    9         $this->assertInstanceOf( 'IXR_Error', $result );
     9        $this->assertIXRError( $result );
    1010        $this->assertEquals( 403, $result->code );
    1111    }
     
    1515
    1616        $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'subscriber', 'subscriber' ) );
    17         $this->assertNotInstanceOf( 'IXR_Error', $result );
     17        $this->assertNotIXRError( $result );
    1818        $this->assertInternalType( 'array', $result );
    1919        $this->assertEquals( 0, count( $result ) );
     
    2424
    2525        $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'editor', 'editor' ) );
    26         $this->assertNotInstanceOf( 'IXR_Error', $result );
     26        $this->assertNotIXRError( $result );
    2727        $this->assertInternalType( 'array', $result );
    2828        $this->assertGreaterThan( 0, count( $result ) );
     
    3333
    3434        $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'editor', 'editor', array( 'hierarchical' => true ) ) );
    35         $this->assertNotInstanceOf( 'IXR_Error', $result );
     35        $this->assertNotIXRError( $result );
    3636        $this->assertInternalType( 'array', $result );
    3737
  • trunk/tests/phpunit/tests/xmlrpc/wp/getPosts.php

    r38382 r40417  
    88    function test_invalid_username_password() {
    99        $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'username', 'password' ) );
    10         $this->assertInstanceOf( 'IXR_Error', $result );
     10        $this->assertIXRError( $result );
    1111        $this->assertEquals( 403, $result->code );
    1212    }
     
    1919
    2020        $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'subscriber', 'subscriber' ) );
    21         $this->assertInstanceOf( 'IXR_Error', $result );
     21        $this->assertIXRError( $result );
    2222        $this->assertEquals( 401, $result->code );
    2323
    2424        $filter = array( 'post_type' => 'page' );
    2525        $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'subscriber', 'subscriber', $filter ) );
    26         $this->assertInstanceOf( 'IXR_Error', $result );
     26        $this->assertIXRError( $result );
    2727        $this->assertEquals( 401, $result->code );
    2828    }
     
    3232
    3333        $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor' ) );
    34         $this->assertNotInstanceOf( 'IXR_Error', $result );
     34        $this->assertNotIXRError( $result );
    3535    }
    3636
     
    4040        $filter = array( 'post_type' => 'invalid_post_type_name' );
    4141        $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
    42         $this->assertInstanceOf( 'IXR_Error', $result );
     42        $this->assertIXRError( $result );
    4343    }
    4444
     
    6363        $filter = array( 'post_type' => $cpt_name, 'number' => $num_posts + 10 );
    6464        $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
    65         $this->assertNotInstanceOf( 'IXR_Error', $results );
     65        $this->assertNotIXRError( $results );
    6666        $this->assertEquals( $num_posts, count( $results ) );
    6767
     
    8787        $filter2 = array( 'post_type' => $cpt_name, 'number' => $num_posts, 'orderby' => 'comment_count', 'order' => 'DESC' );
    8888        $results2 = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter2 ) );
    89         $this->assertNotInstanceOf( 'IXR_Error', $results2 );
     89        $this->assertNotIXRError( $results2 );
    9090        $last_comment_count = 100;
    9191        foreach ( $results2 as $post ) {
     
    101101        $filter3 = array( 'post_type' => $cpt_name, 'post_status' => 'draft' );
    102102        $results3 = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter3 ) );
    103         $this->assertNotInstanceOf( 'IXR_Error', $results3 );
     103        $this->assertNotIXRError( $results3 );
    104104        $this->assertEquals( 1, count( $results3 ) );
    105105        $this->assertEquals( $post->ID, $results3[0]['post_id'] );
     
    114114        // check default fields
    115115        $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor' ) );
    116         $this->assertNotInstanceOf( 'IXR_Error', $results );
     116        $this->assertNotIXRError( $results );
    117117        $expected_fields = array( 'post_id', 'post_title', 'terms', 'custom_fields', 'link' ); // subset of expected fields
    118118        foreach( $expected_fields as $field ) {
     
    124124        $fields = array( 'post_name', 'post_author', 'enclosure' );
    125125        $results2 = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter, $fields ) );
    126         $this->assertNotInstanceOf( 'IXR_Error', $results2 );
     126        $this->assertNotIXRError( $results2 );
    127127        $expected_fields = array_merge( $fields, array( 'post_id' ) );
    128128        foreach ( array_keys( $results2[0] ) as $field ) {
     
    143143        $filter = array( 's' => 'Third' );
    144144        $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
    145         $this->assertNotInstanceOf( 'IXR_Error', $results );
     145        $this->assertNotIXRError( $results );
    146146        $this->assertEquals( 0, count( $results ) );
    147147
     
    149149        $filter = array( 's' => 'First:' );
    150150        $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
    151         $this->assertNotInstanceOf( 'IXR_Error', $results );
     151        $this->assertNotIXRError( $results );
    152152        $this->assertEquals( 1, count( $results ) );
    153153    }
  • trunk/tests/phpunit/tests/xmlrpc/wp/getProfile.php

    r25394 r40417  
    99    function test_invalid_username_password() {
    1010        $result = $this->myxmlrpcserver->wp_getProfile( array( 1, 'username', 'password' ) );
    11         $this->assertInstanceOf( 'IXR_Error', $result );
     11        $this->assertIXRError( $result );
    1212        $this->assertEquals( 403, $result->code );
    1313    }
     
    1717
    1818        $result = $this->myxmlrpcserver->wp_getProfile( array( 1, 'subscriber', 'subscriber' ) );
    19         $this->assertNotInstanceOf( 'IXR_Error', $result );
     19        $this->assertNotIXRError( $result );
    2020        $this->assertEquals( $subscriber_id, $result['user_id'] );
    2121        $this->assertContains( 'subscriber', $result['roles'] );
     
    2626
    2727        $result = $this->myxmlrpcserver->wp_getProfile( array( 1, 'administrator', 'administrator' ) );
    28         $this->assertNotInstanceOf( 'IXR_Error', $result );
     28        $this->assertNotIXRError( $result );
    2929        $this->assertEquals( $administrator_id, $result['user_id'] );
    3030        $this->assertContains( 'administrator', $result['roles'] );
     
    3737
    3838        $result = $this->myxmlrpcserver->wp_getProfile( array( 1, 'editor', 'editor', $fields ) );
    39         $this->assertNotInstanceOf( 'IXR_Error', $result );
     39        $this->assertNotIXRError( $result );
    4040        $this->assertEquals( $editor_id, $result['user_id'] );
    4141
  • trunk/tests/phpunit/tests/xmlrpc/wp/getRevisions.php

    r35242 r40417  
    88    function test_invalid_username_password() {
    99        $result = $this->myxmlrpcserver->wp_getRevisions( array( 1, 'username', 'password', 0 ) );
    10         $this->assertInstanceOf( 'IXR_Error', $result );
     10        $this->assertIXRError( $result );
    1111        $this->assertEquals( 403, $result->code );
    1212    }
     
    1818
    1919        $result = $this->myxmlrpcserver->wp_getRevisions( array( 1, 'subscriber', 'subscriber', $post_id ) );
    20         $this->assertInstanceOf( 'IXR_Error', $result );
     20        $this->assertIXRError( $result );
    2121        $this->assertEquals( 401, $result->code );
    2222    }
     
    2727        $post_id = self::factory()->post->create();
    2828        $result = $this->myxmlrpcserver->wp_getRevisions( array( 1, 'editor', 'editor', $post_id ) );
    29         $this->assertNotInstanceOf( 'IXR_Error', $result );
     29        $this->assertNotIXRError( $result );
    3030    }
    3131
  • trunk/tests/phpunit/tests/xmlrpc/wp/getTaxonomies.php

    r25002 r40417  
    88    function test_invalid_username_password() {
    99        $result = $this->myxmlrpcserver->wp_getTaxonomies( array( 1, 'username', 'password' ) );
    10         $this->assertInstanceOf( 'IXR_Error', $result );
     10        $this->assertIXRError( $result );
    1111        $this->assertEquals( 403, $result->code );
    1212    }
     
    1616
    1717        $result = $this->myxmlrpcserver->wp_getTaxonomies( array( 1, 'editor', 'editor' ) );
    18         $this->assertNotInstanceOf( 'IXR_Error', $result );
     18        $this->assertNotIXRError( $result );
    1919    }
    2020}
  • trunk/tests/phpunit/tests/xmlrpc/wp/getTaxonomy.php

    r38078 r40417  
    88    function test_invalid_username_password() {
    99        $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'username', 'password', 'category' ) );
    10         $this->assertInstanceOf( 'IXR_Error', $result );
     10        $this->assertIXRError( $result );
    1111        $this->assertEquals( 403, $result->code );
    1212    }
     
    1616
    1717        $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', '' ) );
    18         $this->assertInstanceOf( 'IXR_Error', $result );
     18        $this->assertIXRError( $result );
    1919        $this->assertEquals( 403, $result->code );
    2020        $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message );
     
    2525
    2626        $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'not_existing' ) );
    27         $this->assertInstanceOf( 'IXR_Error', $result );
     27        $this->assertIXRError( $result );
    2828        $this->assertEquals( 403, $result->code );
    2929        $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message );
     
    3434
    3535        $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'subscriber', 'subscriber', 'category' ) );
    36         $this->assertInstanceOf( 'IXR_Error', $result );
     36        $this->assertIXRError( $result );
    3737        $this->assertEquals( 401, $result->code );
    3838        $this->assertEquals( __( 'Sorry, you are not allowed to assign terms in this taxonomy.' ), $result->message );
     
    4343
    4444        $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'category' ) );
    45         $this->assertNotInstanceOf( 'IXR_Error', $result );
     45        $this->assertNotIXRError( $result );
    4646    }
    4747
     
    5050
    5151        $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'category' ) );
    52         $this->assertNotInstanceOf( 'IXR_Error', $result );
     52        $this->assertNotIXRError( $result );
    5353        $taxonomy = get_taxonomy( 'category' );
    5454        $this->assertEquals( 'category', $result['name'], 'name' );
  • trunk/tests/phpunit/tests/xmlrpc/wp/getTerm.php

    r39189 r40417  
    1616    function test_invalid_username_password() {
    1717        $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'username', 'password', 'category', 1 ) );
    18         $this->assertInstanceOf( 'IXR_Error', $result );
     18        $this->assertIXRError( $result );
    1919        $this->assertEquals( 403, $result->code );
    2020    }
     
    2424
    2525        $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', '', 0 ) );
    26         $this->assertInstanceOf( 'IXR_Error', $result );
     26        $this->assertIXRError( $result );
    2727        $this->assertEquals( 403, $result->code );
    2828        $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message );
     
    3333
    3434        $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'not_existing', 0 ) );
    35         $this->assertInstanceOf( 'IXR_Error', $result );
     35        $this->assertIXRError( $result );
    3636        $this->assertEquals( 403, $result->code );
    3737        $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message );
     
    4242
    4343        $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'subscriber', 'subscriber', 'category', self::$term_id ) );
    44         $this->assertInstanceOf( 'IXR_Error', $result );
     44        $this->assertIXRError( $result );
    4545        $this->assertEquals( 401, $result->code );
    4646        $this->assertEquals( __( 'Sorry, you are not allowed to assign this term.' ), $result->message );
     
    5252
    5353        $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', '' ) );
    54         $this->assertInstanceOf( 'IXR_Error', $result );
     54        $this->assertIXRError( $result );
    5555        $this->assertEquals( 500, $result->code );
    5656        $this->assertEquals( __('Empty Term'), $result->message );
     
    6161
    6262        $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', 9999 ) );
    63         $this->assertInstanceOf( 'IXR_Error', $result );
     63        $this->assertIXRError( $result );
    6464        $this->assertEquals( 404, $result->code );
    6565        $this->assertEquals( __( 'Invalid term ID.' ), $result->message );
     
    7373        $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', self::$term_id ) );
    7474
    75         $this->assertNotInstanceOf( 'IXR_Error', $result );
     75        $this->assertNotIXRError( $result );
    7676        $this->assertEquals( $result, $term );
    7777
  • trunk/tests/phpunit/tests/xmlrpc/wp/getTerms.php

    r38938 r40417  
    88    function test_invalid_username_password() {
    99        $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'username', 'password', 'category' ) );
    10         $this->assertInstanceOf( 'IXR_Error', $result );
     10        $this->assertIXRError( $result );
    1111        $this->assertEquals( 403, $result->code );
    1212    }
     
    1616
    1717        $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', '' ) );
    18         $this->assertInstanceOf( 'IXR_Error', $result );
     18        $this->assertIXRError( $result );
    1919        $this->assertEquals( 403, $result->code );
    2020        $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message );
     
    2525
    2626        $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'not_existing' ) );
    27         $this->assertInstanceOf( 'IXR_Error', $result );
     27        $this->assertIXRError( $result );
    2828        $this->assertEquals( 403, $result->code );
    2929        $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message );
     
    3434
    3535        $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'subscriber', 'subscriber', 'category' ) );
    36         $this->assertInstanceOf( 'IXR_Error', $result );
     36        $this->assertIXRError( $result );
    3737        $this->assertEquals( 401, $result->code );
    3838        $this->assertEquals( __( 'Sorry, you are not allowed to assign terms in this taxonomy.' ), $result->message );
     
    4646
    4747        $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category' ) );
    48         $this->assertNotInstanceOf( 'IXR_Error', $results );
     48        $this->assertNotIXRError( $results );
    4949
    5050        foreach( $results as $term ) {
     
    7272        // test fetching all terms
    7373        $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name ) );
    74         $this->assertNotInstanceOf( 'IXR_Error', $results );
     74        $this->assertNotIXRError( $results );
    7575
    7676        $this->assertEquals( $num_terms, count( $results ) );
     
    8282        $filter = array( 'number' => 5 );
    8383        $results2 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
    84         $this->assertNotInstanceOf( 'IXR_Error', $results );
     84        $this->assertNotIXRError( $results );
    8585        $this->assertEquals( 5, count( $results2 ) );
    8686        $this->assertEquals( $results[1]['term_id'], $results2[1]['term_id'] ); // check one of the terms
     
    8888        $filter['offset'] = 10;
    8989        $results3 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
    90         $this->assertNotInstanceOf( 'IXR_Error', $results3 );
     90        $this->assertNotIXRError( $results3 );
    9191        $this->assertEquals( $num_terms - 10, count( $results3 ) );
    9292        $this->assertEquals( $results[11]['term_id'], $results3[1]['term_id'] );
     
    9595        $filter = array( 'hide_empty' => true );
    9696        $results4 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) );
    97         $this->assertNotInstanceOf( 'IXR_Error', $results4 );
     97        $this->assertNotIXRError( $results4 );
    9898        $this->assertEquals( 0, count( $results4 ) );
    9999
     
    112112        $filter = array( 'orderby' => 'count', 'order' => 'DESC' );
    113113        $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
    114         $this->assertNotInstanceOf( 'IXR_Error', $results );
     114        $this->assertNotIXRError( $results );
    115115        $this->assertNotEquals( 0, count( $results ) );
    116116
     
    134134        $filter = array( 'search' => $name );
    135135        $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
    136         $this->assertNotInstanceOf( 'IXR_Error', $results );
     136        $this->assertNotIXRError( $results );
    137137        $this->assertEquals( 1, count( $results ) );
    138138        $this->assertEquals( $name, $results[0]['name'] );
     
    142142        $filter = array( 'search' => substr( $name, 0, 10 ) );
    143143        $results2 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) );
    144         $this->assertNotInstanceOf( 'IXR_Error', $results2 );
     144        $this->assertNotIXRError( $results2 );
    145145        $this->assertEquals( 1, count( $results2 ) );
    146146        $this->assertEquals( $name, $results2[0]['name'] );
  • trunk/tests/phpunit/tests/xmlrpc/wp/getUser.php

    r38938 r40417  
    2626    function test_invalid_username_password() {
    2727        $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'username', 'password', 1 ) );
    28         $this->assertInstanceOf( 'IXR_Error', $result );
     28        $this->assertIXRError( $result );
    2929        $this->assertEquals( 403, $result->code );
    3030    }
     
    3232    function test_invalid_user() {
    3333        $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', 34902348908234 ) );
    34         $this->assertInstanceOf( 'IXR_Error', $result );
     34        $this->assertIXRError( $result );
    3535        $this->assertEquals( 404, $result->code );
    3636    }
     
    4141
    4242        $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'subscriber', 'subscriber', $editor_id ) );
    43         $this->assertInstanceOf( 'IXR_Error', $result );
     43        $this->assertIXRError( $result );
    4444        $this->assertEquals( 401, $result->code );
    4545    }
     
    4949
    5050        $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'subscriber', 'subscriber', $subscriber_id ) );
    51         $this->assertNotInstanceOf( 'IXR_Error', $result );
     51        $this->assertNotIXRError( $result );
    5252        $this->assertEquals( $subscriber_id, $result['user_id'] );
    5353    }
     
    7373
    7474        $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', $user_id ) );
    75         $this->assertNotInstanceOf( 'IXR_Error', $result );
     75        $this->assertNotIXRError( $result );
    7676
    7777        // check data types
     
    112112
    113113        $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', $editor_id, array() ) );
    114         $this->assertNotInstanceOf( 'IXR_Error', $result );
     114        $this->assertNotIXRError( $result );
    115115        $this->assertEquals( $editor_id, $result['user_id'] );
    116116
     
    123123
    124124        $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', $editor_id, array( 'basic' ) ) );
    125         $this->assertNotInstanceOf( 'IXR_Error', $result );
     125        $this->assertNotIXRError( $result );
    126126        $this->assertEquals( $editor_id, $result['user_id'] );
    127127
     
    139139
    140140        $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', $editor_id, $fields ) );
    141         $this->assertNotInstanceOf( 'IXR_Error', $result );
     141        $this->assertNotIXRError( $result );
    142142        $this->assertEquals( $editor_id, $result['user_id'] );
    143143
  • trunk/tests/phpunit/tests/xmlrpc/wp/getUsers.php

    r38938 r40417  
    99    function test_invalid_username_password() {
    1010        $results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'username', 'password' ) );
    11         $this->assertInstanceOf( 'IXR_Error', $results );
     11        $this->assertIXRError( $results );
    1212        $this->assertEquals( 403, $results->code );
    1313    }
     
    1717
    1818        $results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'subscriber', 'subscriber' ) );
    19         $this->assertInstanceOf( 'IXR_Error', $results );
     19        $this->assertIXRError( $results );
    2020        $this->assertEquals( 401, $results->code );
    2121    }
     
    2525
    2626        $result = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator' ) );
    27         $this->assertNotInstanceOf( 'IXR_Error', $result );
     27        $this->assertNotIXRError( $result );
    2828
    2929        // check data types
     
    5050        $filter = array( 'role' => 'invalidrole' );
    5151        $results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter ) );
    52         $this->assertInstanceOf( 'IXR_Error', $results );
     52        $this->assertIXRError( $results );
    5353        $this->assertEquals( 403, $results->code );
    5454    }
     
    6464        $filter = array( 'role' => 'editor' );
    6565        $results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter ) );
    66         $this->assertNotInstanceOf( 'IXR_Error', $results );
     66        $this->assertNotIXRError( $results );
    6767        $this->assertCount( 1, $results );
    6868        $this->assertEquals( $editor_id, $results[0]['user_id'] );
     
    7171        $filter2 = array( 'who' => 'authors' );
    7272        $results2 = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter2 ) );
    73         $this->assertNotInstanceOf( 'IXR_Error', $results2 );
     73        $this->assertNotIXRError( $results2 );
    7474        $this->assertCount( 3, array_intersect( array( $author_id, $editor_id, $administrator_id ), wp_list_pluck( $results2, 'user_id' ) ) );
    7575    }
     
    105105        $filter = array( 'orderby' => 'email', 'order' => 'ASC' );
    106106        $results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter ) );
    107         $this->assertNotInstanceOf( 'IXR_Error', $results );
     107        $this->assertNotIXRError( $results );
    108108
    109109        $last_email = '';
  • trunk/tests/phpunit/tests/xmlrpc/wp/newComment.php

    r39045 r40417  
    1414        ) ) );
    1515 
    16         $this->assertNotInstanceOf( 'IXR_Error', $result );
     16        $this->assertNotIXRError( $result );
    1717    }
    1818 
     
    2525        ) ) );
    2626 
    27         $this->assertInstanceOf( 'IXR_Error', $result );
     27        $this->assertIXRError( $result );
    2828        $this->assertEquals( 403, $result->code );
    2929    }
     
    4141        ) ) );
    4242
    43         $this->assertInstanceOf( 'IXR_Error', $result );
     43        $this->assertIXRError( $result );
    4444        $this->assertEquals( 403, $result->code );
    4545    }
     
    5555        // First time it's a valid comment
    5656        $result = $this->myxmlrpcserver->wp_newComment( $comment_args  );
    57         $this->assertNotInstanceOf( 'IXR_Error', $result );
     57        $this->assertNotIXRError( $result );
    5858
    5959        // Run second time for duplication error
    6060        $result = $this->myxmlrpcserver->wp_newComment( $comment_args );
    6161
    62         $this->assertInstanceOf( 'IXR_Error', $result );
     62        $this->assertIXRError( $result );
    6363        $this->assertEquals( 403, $result->code );
    6464    }
  • trunk/tests/phpunit/tests/xmlrpc/wp/newPost.php

    r38382 r40417  
    88    function test_invalid_username_password() {
    99        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'username', 'password', array() ) );
    10         $this->assertInstanceOf( 'IXR_Error', $result );
     10        $this->assertIXRError( $result );
    1111        $this->assertEquals( 403, $result->code );
    1212    }
     
    1616
    1717        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'subscriber', 'subscriber', array() ) );
    18         $this->assertInstanceOf( 'IXR_Error', $result );
     18        $this->assertIXRError( $result );
    1919        $this->assertEquals( 401, $result->code );
    2020    }
     
    2424
    2525        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', array() ) );
    26         $this->assertInstanceOf( 'IXR_Error', $result );
     26        $this->assertIXRError( $result );
    2727        $this->assertEquals( 500, $result->code );
    2828        $this->assertEquals( 'Content, title, and excerpt are empty.', $result->message );
     
    3434        $post = array( 'post_title' => 'Test' );
    3535        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
    36         $this->assertNotInstanceOf( 'IXR_Error', $result );
     36        $this->assertNotIXRError( $result );
    3737        $this->assertStringMatchesFormat( '%d', $result );
    3838    }
     
    4343        $post = array( 'post_title' => 'Test', 'ID' => 103948 );
    4444        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
    45         $this->assertNotInstanceOf( 'IXR_Error', $result );
     45        $this->assertNotIXRError( $result );
    4646        $this->assertNotEquals( '103948', $result );
    4747    }
     
    5252        $post = array( 'post_title' => 'Test', 'post_status' => 'publish' );
    5353        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
    54         $this->assertNotInstanceOf( 'IXR_Error', $result );
     54        $this->assertNotIXRError( $result );
    5555    }
    5656
     
    6060        $post = array( 'post_title' => 'Test', 'post_status' => 'publish' );
    6161        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
    62         $this->assertInstanceOf( 'IXR_Error', $result );
     62        $this->assertIXRError( $result );
    6363        $this->assertEquals( 401, $result->code );
    6464    }
     
    6969        $post = array( 'post_title' => 'Test', 'post_status' => 'private' );
    7070        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
    71         $this->assertNotInstanceOf( 'IXR_Error', $result );
     71        $this->assertNotIXRError( $result );
    7272    }
    7373
     
    7777        $post = array( 'post_title' => 'Test', 'post_status' => 'private' );
    7878        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
    79         $this->assertInstanceOf( 'IXR_Error', $result );
     79        $this->assertIXRError( $result );
    8080        $this->assertEquals( 401, $result->code );
    8181    }
     
    8787        $post = array( 'post_title' => 'Test', 'post_author' => $other_author_id );
    8888        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
    89         $this->assertNotInstanceOf( 'IXR_Error', $result );
     89        $this->assertNotIXRError( $result );
    9090    }
    9191
     
    9696        $post = array( 'post_title' => 'Test', 'post_author' => $other_author_id );
    9797        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
    98         $this->assertInstanceOf( 'IXR_Error', $result );
     98        $this->assertIXRError( $result );
    9999        $this->assertEquals( 401, $result->code );
    100100    }
     
    105105        $post = array( 'post_title' => 'Test', 'post_author' => 99999999 );
    106106        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
    107         $this->assertInstanceOf( 'IXR_Error', $result );
     107        $this->assertIXRError( $result );
    108108        $this->assertEquals( 404, $result->code );
    109109    }
     
    114114        $post = array( 'post_title' => 'Test' );
    115115        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
    116         $this->assertNotInstanceOf( 'IXR_Error', $result );
     116        $this->assertNotIXRError( $result );
    117117        $this->assertStringMatchesFormat( '%d', $result );
    118118
     
    133133        $post = array( 'post_title' => 'Post Thumbnail Test', 'post_thumbnail' => $attachment_id );
    134134        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
    135         $this->assertNotInstanceOf( 'IXR_Error', $result );
     135        $this->assertNotIXRError( $result );
    136136        $this->assertEquals( $attachment_id, get_post_meta( $result, '_thumbnail_id', true ) );
    137137
     
    144144        $post = array( 'post_title' => 'Test', 'post_status' => 'foobar_status' );
    145145        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) );
    146         $this->assertNotInstanceOf( 'IXR_Error', $result );
     146        $this->assertNotIXRError( $result );
    147147        $this->assertEquals( 'draft', get_post_status( $result ) );
    148148    }
     
    153153        $post = array( 'post_title' => 'Test', 'sticky' => true );
    154154        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) );
    155         $this->assertInstanceOf( 'IXR_Error', $result );
     155        $this->assertIXRError( $result );
    156156        $this->assertEquals( 401, $result->code );
    157157    }
     
    162162        $post = array( 'post_title' => 'Test', 'sticky' => true );
    163163        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
    164         $this->assertNotInstanceOf( 'IXR_Error', $result );
     164        $this->assertNotIXRError( $result );
    165165        $this->assertTrue( is_sticky( $result ) );
    166166    }
     
    171171        $post = array( 'post_title' => 'Test', 'post_status' => 'private', 'sticky' => true );
    172172        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
    173         $this->assertInstanceOf( 'IXR_Error', $result );
     173        $this->assertIXRError( $result );
    174174        $this->assertEquals( 401, $result->code );
    175175    }
     
    180180        $post = array( 'post_title' => 'Test', 'post_format' => 'quote' );
    181181        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
    182         $this->assertNotInstanceOf( 'IXR_Error', $result );
     182        $this->assertNotIXRError( $result );
    183183        $this->assertEquals( 'quote', get_post_format( $result ) );
    184184    }
     
    189189        $post = array( 'post_title' => 'Test', 'post_format' => 'tumblr' );
    190190        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
    191         $this->assertNotInstanceOf( 'IXR_Error', $result );
     191        $this->assertNotIXRError( $result );
    192192        $this->assertEquals( '', get_post_format( $result ) );
    193193    }
     
    203203        );
    204204        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
    205         $this->assertInstanceOf( 'IXR_Error', $result );
     205        $this->assertIXRError( $result );
    206206        $this->assertEquals( 401, $result->code );
    207207
     
    213213        );
    214214        $result2 = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post2 ) );
    215         $this->assertInstanceOf( 'IXR_Error', $result2 );
     215        $this->assertIXRError( $result2 );
    216216        $this->assertEquals( 401, $result2->code );
    217217    }
     
    227227        );
    228228        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
    229         $this->assertInstanceOf( 'IXR_Error', $result );
     229        $this->assertIXRError( $result );
    230230        $this->assertEquals( 403, $result->code );
    231231    }
     
    248248        );
    249249        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
    250         $this->assertNotInstanceOf( 'IXR_Error', $result );
     250        $this->assertNotIXRError( $result );
    251251
    252252        $post_tags = wp_get_object_terms( $result, 'post_tag', array( 'fields' => 'ids' ) );
     
    275275        );
    276276        $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) );
    277         $this->assertNotInstanceOf( 'IXR_Error', $result );
     277        $this->assertNotIXRError( $result );
    278278        // verify that cat2 was created
    279279        $cat2 = get_term_by( 'name', $cat2_name, 'category' );
     
    292292        );
    293293        $result2 = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post2 ) );
    294         $this->assertInstanceOf( 'IXR_Error', $result2 );
     294        $this->assertIXRError( $result2 );
    295295        $this->assertEquals( 401, $result2->code );
    296296    }
  • trunk/tests/phpunit/tests/xmlrpc/wp/newTerm.php

    r39189 r40417  
    1616    function test_invalid_username_password() {
    1717        $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'username', 'password', array() ) );
    18         $this->assertInstanceOf( 'IXR_Error', $result );
     18        $this->assertIXRError( $result );
    1919        $this->assertEquals( 403, $result->code );
    2020    }
     
    2424
    2525        $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => '' ) ) );
    26         $this->assertInstanceOf( 'IXR_Error', $result );
     26        $this->assertIXRError( $result );
    2727        $this->assertEquals( 403, $result->code );
    2828        $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message );
     
    3333
    3434        $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'not_existing' ) ) );
    35         $this->assertInstanceOf( 'IXR_Error', $result );
     35        $this->assertIXRError( $result );
    3636        $this->assertEquals( 403, $result->code );
    3737        $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message );
     
    4242
    4343        $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'subscriber', 'subscriber', array( 'taxonomy' => 'category' ) ) );
    44         $this->assertInstanceOf( 'IXR_Error', $result );
     44        $this->assertIXRError( $result );
    4545        $this->assertEquals( 401, $result->code );
    4646        $this->assertEquals( __( 'Sorry, you are not allowed to create terms in this taxonomy.' ), $result->message );
     
    5151
    5252        $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'name' => '' ) ) );
    53         $this->assertInstanceOf( 'IXR_Error', $result );
     53        $this->assertIXRError( $result );
    5454        $this->assertEquals( 403, $result->code );
    5555        $this->assertEquals( __( 'The term name cannot be empty.' ), $result->message );
     
    6060
    6161        $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'post_tag', 'parent' => self::$parent_term_id, 'name' => 'test' ) ) );
    62         $this->assertInstanceOf( 'IXR_Error', $result );
     62        $this->assertIXRError( $result );
    6363        $this->assertEquals( 403, $result->code );
    6464        $this->assertEquals( __( 'This taxonomy is not hierarchical.' ), $result->message );
     
    6969
    7070        $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => 'dasda', 'name' => 'test' ) ) );
    71         $this->assertInstanceOf( 'IXR_Error', $result );
     71        $this->assertIXRError( $result );
    7272        $this->assertEquals( 500, $result->code );
    7373    }
     
    7777
    7878        $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => 9999, 'name' => 'test' ) ) );
    79         $this->assertInstanceOf( 'IXR_Error', $result );
     79        $this->assertIXRError( $result );
    8080        $this->assertEquals( 403, $result->code );
    8181        $this->assertEquals( __( 'Parent term does not exist.' ), $result->message );
     
    8787
    8888        $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'name' => 'test' ) ) );
    89         $this->assertNotInstanceOf( 'IXR_Error', $result );
     89        $this->assertNotIXRError( $result );
    9090        $this->assertStringMatchesFormat( '%d', $result );
    9191    }
     
    9595
    9696        $result  = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => self::$parent_term_id, 'name' => 'test' ) ) );
    97         $this->assertNotInstanceOf( 'IXR_Error', $result );
     97        $this->assertNotIXRError( $result );
    9898        $this->assertStringMatchesFormat( '%d', $result );
    9999    }
     
    104104        $taxonomy = array( 'taxonomy' => 'category', 'parent' => self::$parent_term_id, 'name' => 'test_all', 'description' => 'Test all', 'slug' => 'test_all' );
    105105        $result  = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', $taxonomy ) );
    106         $this->assertNotInstanceOf( 'IXR_Error', $result );
     106        $this->assertNotIXRError( $result );
    107107        $this->assertStringMatchesFormat( '%d', $result );
    108108    }
  • trunk/tests/phpunit/tests/xmlrpc/wp/restoreRevision.php

    r35242 r40417  
    2424    function test_invalid_username_password() {
    2525        $result = $this->myxmlrpcserver->wp_restoreRevision( array( 1, 'username', 'password', $this->revision_id ) );
    26         $this->assertInstanceOf( 'IXR_Error', $result );
     26        $this->assertIXRError( $result );
    2727        $this->assertEquals( 403, $result->code );
    2828    }
     
    3232
    3333        $result = $this->myxmlrpcserver->wp_restoreRevision( array( 1, 'subscriber', 'subscriber', $this->revision_id ) );
    34         $this->assertInstanceOf( 'IXR_Error', $result );
     34        $this->assertIXRError( $result );
    3535        $this->assertEquals( 401, $result->code );
    3636    }
     
    4040
    4141        $result = $this->myxmlrpcserver->wp_restoreRevision( array( 1, 'editor', 'editor', $this->revision_id ) );
    42         $this->assertNotInstanceOf( 'IXR_Error', $result );
     42        $this->assertNotIXRError( $result );
    4343    }
    4444
  • trunk/tests/phpunit/tests/xmlrpc/wp/uploadFile.php

    r34604 r40417  
    2626
    2727        $result = $this->myxmlrpcserver->mw_newMediaObject( array( 0, 'editor', 'editor', $data ) );
    28         $this->assertNotInstanceOf( 'IXR_Error', $result );
     28        $this->assertNotIXRError( $result );
    2929
    3030        // check data types
Note: See TracChangeset for help on using the changeset viewer.