Changeset 40417
- Timestamp:
- 04/12/2017 02:58:33 PM (8 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/testcase.php
r40416 r40417 437 437 } 438 438 $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 ); 439 450 } 440 451 -
trunk/tests/phpunit/tests/xmlrpc/basic.php
r37980 r40417 12 12 $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'username', 'password' ) ); 13 13 14 $this->assertI nstanceOf( 'IXR_Error',$result );14 $this->assertIXRError( $result ); 15 15 // If disabled, 405 would result. 16 16 $this->assertEquals( 403, $result->code ); -
trunk/tests/phpunit/tests/xmlrpc/mt/getRecentPostTitles.php
r35242 r40417 8 8 function test_invalid_username_password() { 9 9 $result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'username', 'password' ) ); 10 $this->assertI nstanceOf( 'IXR_Error',$result );10 $this->assertIXRError( $result ); 11 11 $this->assertEquals( 403, $result->code ); 12 12 } … … 16 16 17 17 $result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) ); 18 $this->assertI nstanceOf( 'IXR_Error',$result );18 $this->assertIXRError( $result ); 19 19 $this->assertEquals( 500, $result->code ); 20 20 } … … 26 26 27 27 $result = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) ); 28 $this->assertNotI nstanceOf( 'IXR_Error',$result );28 $this->assertNotIXRError( $result ); 29 29 $this->assertEquals( 0, count( $result ) ); 30 30 } … … 36 36 37 37 $results = $this->myxmlrpcserver->mt_getRecentPostTitles( array( 1, 'author', 'author' ) ); 38 $this->assertNotI nstanceOf( 'IXR_Error',$results );38 $this->assertNotIXRError( $results ); 39 39 40 40 foreach( $results as $result ) { -
trunk/tests/phpunit/tests/xmlrpc/mw/editPost.php
r37044 r40417 9 9 $post = array(); 10 10 $result = $this->myxmlrpcserver->mw_editPost( array( 1, 'username', 'password', $post ) ); 11 $this->assertI nstanceOf( 'IXR_Error',$result );11 $this->assertIXRError( $result ); 12 12 $this->assertEquals( 403, $result->code ); 13 13 } … … 21 21 $post2 = array( 'title' => $new_title ); 22 22 $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) ); 23 $this->assertNotI nstanceOf( 'IXR_Error',$result );23 $this->assertNotIXRError( $result ); 24 24 $this->assertTrue($result); 25 25 … … 38 38 $post2 = array( 'title' => $new_title ); 39 39 $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'editor', 'editor', $post2 ) ); 40 $this->assertNotI nstanceOf( 'IXR_Error',$result );40 $this->assertNotIXRError( $result ); 41 41 $this->assertTrue($result); 42 42 … … 56 56 $post2 = array( 'title' => $new_title ); 57 57 $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) ); 58 $this->assertI nstanceOf( 'IXR_Error',$result );58 $this->assertIXRError( $result ); 59 59 $this->assertEquals( 401, $result->code ); 60 60 … … 73 73 $post2 = array( 'wp_author_id' => $author_id ); 74 74 $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'editor', 'editor', $post2 ) ); 75 $this->assertNotI nstanceOf( 'IXR_Error',$result );75 $this->assertNotIXRError( $result ); 76 76 $this->assertTrue($result); 77 77 … … 89 89 $post2 = array( 'wp_author_id' => $author_id ); 90 90 $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) ); 91 $this->assertI nstanceOf( 'IXR_Error',$result );91 $this->assertIXRError( $result ); 92 92 $this->assertEquals( 401, $result->code ); 93 93 … … 108 108 $post2 = array( 'wp_author_id' => $editor_id ); 109 109 $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'editor', 'editor', $post2 ) ); 110 $this->assertNotI nstanceOf( 'IXR_Error',$result );110 $this->assertNotIXRError( $result ); 111 111 $this->assertTrue($result); 112 112 … … 132 132 $post2 = array( 'wp_post_thumbnail' => $attachment_id ); 133 133 $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'author', 'author', $post2 ) ); 134 $this->assertNotI nstanceOf( 'IXR_Error',$result );134 $this->assertNotIXRError( $result ); 135 135 $this->assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) ); 136 136 … … 138 138 $post3 = array( 'post_content' => 'Updated post' ); 139 139 $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'author', 'author', $post3 ) ); 140 $this->assertNotI nstanceOf( 'IXR_Error',$result );140 $this->assertNotIXRError( $result ); 141 141 $this->assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) ); 142 142 … … 147 147 $post4 = array( 'wp_post_thumbnail' => $attachment2_id ); 148 148 $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'author', 'author', $post4 ) ); 149 $this->assertNotI nstanceOf( 'IXR_Error',$result );149 $this->assertNotIXRError( $result ); 150 150 $this->assertEquals( $attachment2_id, get_post_meta( $post_id, '_thumbnail_id', true ) ); 151 151 … … 153 153 $post5 = array( 'wp_post_thumbnail' => '' ); 154 154 $result = $this->myxmlrpcserver->mw_editPost( array($post_id, 'author', 'author', $post5 ) ); 155 $this->assertNotI nstanceOf( 'IXR_Error',$result );155 $this->assertNotIXRError( $result ); 156 156 $this->assertEquals( '', get_post_meta( $post_id, '_thumbnail_id', true ) ); 157 157 … … 167 167 $post2 = array( 'title' => 'New Title', 'post_author' => $contributor_id ); 168 168 $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) ); 169 $this->assertNotI nstanceOf( 'IXR_Error',$result );169 $this->assertNotIXRError( $result ); 170 170 $this->assertTrue($result); 171 171 … … 175 175 $post3 = array( 'description' => 'New Content', 'post_author' => $contributor_id ); 176 176 $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post3 ) ); 177 $this->assertNotI nstanceOf( 'IXR_Error',$result );177 $this->assertNotIXRError( $result ); 178 178 $this->assertTrue($result); 179 179 … … 184 184 $post4 = array( 'mt_excerpt' => 'New Excerpt', 'post_author' => $contributor_id ); 185 185 $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post4 ) ); 186 $this->assertNotI nstanceOf( 'IXR_Error',$result );186 $this->assertNotIXRError( $result ); 187 187 $this->assertTrue($result); 188 188 … … 203 203 204 204 $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'editor', 'editor', array( 'sticky' => '1' ) ) ); 205 $this->assertNotI nstanceOf( 'IXR_Error',$result );205 $this->assertNotIXRError( $result ); 206 206 $this->assertTrue( $result ); 207 207 } … … 216 216 $post2 = array( 'post_type' => 'page' ); 217 217 $result = $this->myxmlrpcserver->mw_editPost( array( $post_id, 'contributor', 'contributor', $post2 ) ); 218 $this->assertI nstanceOf( 'IXR_Error',$result );218 $this->assertIXRError( $result ); 219 219 $this->assertEquals( $result->code, 401 ); 220 220 } -
trunk/tests/phpunit/tests/xmlrpc/mw/getPost.php
r39189 r40417 20 20 function test_invalid_username_password() { 21 21 $result = $this->myxmlrpcserver->mw_getPost( array( self::$post_id, 'username', 'password' ) ); 22 $this->assertI nstanceOf( 'IXR_Error',$result );22 $this->assertIXRError( $result ); 23 23 $this->assertEquals( 403, $result->code ); 24 24 } … … 28 28 29 29 $result = $this->myxmlrpcserver->mw_getPost( array( self::$post_id, 'subscriber', 'subscriber' ) ); 30 $this->assertI nstanceOf( 'IXR_Error',$result );30 $this->assertIXRError( $result ); 31 31 $this->assertEquals( 401, $result->code ); 32 32 } … … 37 37 function test_invalid_postid() { 38 38 $result = $this->myxmlrpcserver->mw_getPost( array( 9999, 'author', 'author' ) ); 39 $this->assertI nstanceOf( 'IXR_Error',$result );39 $this->assertIXRError( $result ); 40 40 $this->assertEquals( 404, $result->code ); 41 41 } … … 46 46 $fields = array( 'post' ); 47 47 $result = $this->myxmlrpcserver->mw_getPost( array( self::$post_id, 'author', 'author' ) ); 48 $this->assertNotI nstanceOf( 'IXR_Error',$result );48 $this->assertNotIXRError( $result ); 49 49 50 50 // Check data types … … 97 97 $fields = array( 'post' ); 98 98 $result = $this->myxmlrpcserver->mw_getPost( array( self::$post_id, 'author', 'author' ) ); 99 $this->assertNotI nstanceOf( 'IXR_Error',$result );99 $this->assertNotIXRError( $result ); 100 100 101 101 $this->assertInternalType( 'string', $result['wp_post_thumbnail'] ); … … 109 109 $fields = array( 'post' ); 110 110 $result = $this->myxmlrpcserver->mw_getPost( array( self::$post_id, 'author', 'author' ) ); 111 $this->assertNotI nstanceOf( 'IXR_Error',$result );111 $this->assertNotIXRError( $result ); 112 112 113 113 $this->assertInstanceOf( 'IXR_Date', $result['dateCreated'] ); -
trunk/tests/phpunit/tests/xmlrpc/mw/getRecentPosts.php
r39189 r40417 21 21 function test_invalid_username_password() { 22 22 $result = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'username', 'password' ) ); 23 $this->assertI nstanceOf( 'IXR_Error',$result );23 $this->assertIXRError( $result ); 24 24 $this->assertEquals( 403, $result->code ); 25 25 } … … 32 32 33 33 $result = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'subscriber', 'subscriber' ) ); 34 $this->assertI nstanceOf( 'IXR_Error',$result );34 $this->assertIXRError( $result ); 35 35 $this->assertEquals( 401, $result->code ); 36 36 } … … 40 40 41 41 $result = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'author', 'author' ) ); 42 $this->assertNotI nstanceOf( 'IXR_Error',$result );42 $this->assertNotIXRError( $result ); 43 43 $this->assertEquals( 0, count( $result ) ); 44 44 } … … 49 49 $fields = array( 'post' ); 50 50 $results = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'author', 'author' ) ); 51 $this->assertNotI nstanceOf( 'IXR_Error',$results );51 $this->assertNotIXRError( $results ); 52 52 53 53 foreach( $results as $result ) { … … 100 100 101 101 $results = $this->myxmlrpcserver->mw_getRecentPosts( array( self::$post_id, 'author', 'author' ) ); 102 $this->assertNotI nstanceOf( 'IXR_Error',$results );102 $this->assertNotIXRError( $results ); 103 103 104 104 foreach( $results as $result ) { … … 120 120 121 121 $results = $this->myxmlrpcserver->mw_getRecentPosts( array( 1, 'editor', 'editor' ) ); 122 $this->assertNotI nstanceOf( 'IXR_Error',$results );122 $this->assertNotIXRError( $results ); 123 123 124 124 foreach( $results as $result ) { -
trunk/tests/phpunit/tests/xmlrpc/mw/newPost.php
r36163 r40417 9 9 $post = array(); 10 10 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'username', 'password', $post ) ); 11 $this->assertI nstanceOf( 'IXR_Error',$result );11 $this->assertIXRError( $result ); 12 12 $this->assertEquals( 403, $result->code ); 13 13 } … … 18 18 $post = array(); 19 19 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'subscriber', 'subscriber', $post ) ); 20 $this->assertI nstanceOf( 'IXR_Error',$result );20 $this->assertIXRError( $result ); 21 21 $this->assertEquals( 401, $result->code ); 22 22 } … … 27 27 $post = array(); 28 28 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) ); 29 $this->assertI nstanceOf( 'IXR_Error',$result );29 $this->assertIXRError( $result ); 30 30 $this->assertEquals( 500, $result->code ); 31 31 $this->assertEquals( 'Content, title, and excerpt are empty.', $result->message ); … … 37 37 $post = array( 'title' => 'Test' ); 38 38 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) ); 39 $this->assertNotI nstanceOf( 'IXR_Error',$result );39 $this->assertNotIXRError( $result ); 40 40 $this->assertStringMatchesFormat( '%d', $result ); 41 41 } … … 46 46 $post = array( 'title' => 'Test', 'ID' => 103948 ); 47 47 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) ); 48 $this->assertNotI nstanceOf( 'IXR_Error',$result );48 $this->assertNotIXRError( $result ); 49 49 $this->assertNotEquals( '103948', $result ); 50 50 } … … 55 55 $post = array( 'title' => 'Test', 'post_status' => 'publish' ); 56 56 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) ); 57 $this->assertNotI nstanceOf( 'IXR_Error',$result );57 $this->assertNotIXRError( $result ); 58 58 } 59 59 … … 63 63 $post = array( 'title' => 'Test', 'post_status' => 'publish' ); 64 64 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'contributor', 'contributor', $post ) ); 65 $this->assertI nstanceOf( 'IXR_Error',$result );65 $this->assertIXRError( $result ); 66 66 $this->assertEquals( 401, $result->code ); 67 67 } … … 73 73 $post = array( 'title' => 'Test', 'wp_author_id' => $other_author_id ); 74 74 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) ); 75 $this->assertNotI nstanceOf( 'IXR_Error',$result );75 $this->assertNotIXRError( $result ); 76 76 } 77 77 … … 82 82 $post = array( 'title' => 'Test', 'wp_author_id' => $other_author_id ); 83 83 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'contributor', 'contributor', $post ) ); 84 $this->assertI nstanceOf( 'IXR_Error',$result );84 $this->assertIXRError( $result ); 85 85 $this->assertEquals( 401, $result->code ); 86 86 } … … 94 94 $post = array( 'title' => 'Test', 'wp_author_id' => 99999999 ); 95 95 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) ); 96 $this->assertI nstanceOf( 'IXR_Error',$result );96 $this->assertIXRError( $result ); 97 97 $this->assertEquals( 404, $result->code ); 98 98 } … … 103 103 $post = array( 'title' => 'Test' ); 104 104 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) ); 105 $this->assertNotI nstanceOf( 'IXR_Error',$result );105 $this->assertNotIXRError( $result ); 106 106 $this->assertStringMatchesFormat( '%d', $result ); 107 107 … … 122 122 $post = array( 'title' => 'Post Thumbnail Test', 'wp_post_thumbnail' => $attachment_id ); 123 123 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) ); 124 $this->assertNotI nstanceOf( 'IXR_Error',$result );124 $this->assertNotIXRError( $result ); 125 125 $this->assertEquals( $attachment_id, get_post_meta( $result, '_thumbnail_id', true ) ); 126 126 … … 133 133 $post = array( 'title' => 'Test', 'post_type' => 'page' ); 134 134 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'author', 'author', $post ) ); 135 $this->assertI nstanceOf( 'IXR_Error',$result );135 $this->assertIXRError( $result ); 136 136 $this->assertEquals( 401, $result->code ); 137 137 } … … 142 142 $post = array( 'title' => 'Test', 'post_type' => 'page' ); 143 143 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) ); 144 $this->assertNotI nstanceOf( 'IXR_Error',$result );144 $this->assertNotIXRError( $result ); 145 145 $this->assertStringMatchesFormat( '%d', $result ); 146 146 … … 163 163 ); 164 164 $result = $this->myxmlrpcserver->mw_newPost( array( 1, 'editor', 'editor', $post ) ); 165 $this->assertNotI nstanceOf( 'IXR_Error',$result );165 $this->assertNotIXRError( $result ); 166 166 $this->assertStringMatchesFormat( '%d', $result ); 167 167 -
trunk/tests/phpunit/tests/xmlrpc/wp/deletePost.php
r35242 r40417 8 8 function test_invalid_username_password() { 9 9 $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'username', 'password', 0 ) ); 10 $this->assertI nstanceOf( 'IXR_Error',$result );10 $this->assertIXRError( $result ); 11 11 $this->assertEquals( 403, $result->code ); 12 12 } … … 16 16 17 17 $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'editor', 'editor', 340982340 ) ); 18 $this->assertI nstanceOf( 'IXR_Error',$result );18 $this->assertIXRError( $result ); 19 19 $this->assertEquals( 404, $result->code ); 20 20 } … … 25 25 26 26 $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'subscriber', 'subscriber', $post_id ) ); 27 $this->assertI nstanceOf( 'IXR_Error',$result );27 $this->assertIXRError( $result ); 28 28 $this->assertEquals( 401, $result->code ); 29 29 } … … 34 34 35 35 $result = $this->myxmlrpcserver->wp_deletePost( array( 1, 'editor', 'editor', $post_id ) ); 36 $this->assertNotI nstanceOf( 'IXR_Error',$result );36 $this->assertNotIXRError( $result ); 37 37 $this->assertTrue( $result ); 38 38 -
trunk/tests/phpunit/tests/xmlrpc/wp/deleteTerm.php
r39189 r40417 15 15 function test_invalid_username_password() { 16 16 $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'username', 'password', 'category', 0 ) ); 17 $this->assertI nstanceOf( 'IXR_Error',$result );17 $this->assertIXRError( $result ); 18 18 $this->assertEquals( 403, $result->code ); 19 19 } … … 23 23 24 24 $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', '', 0 ) ); 25 $this->assertI nstanceOf( 'IXR_Error',$result );25 $this->assertIXRError( $result ); 26 26 $this->assertEquals( 403, $result->code ); 27 27 $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message ); … … 32 32 33 33 $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', 'not_existing', 0 ) ); 34 $this->assertI nstanceOf( 'IXR_Error',$result );34 $this->assertIXRError( $result ); 35 35 $this->assertEquals( 403, $result->code ); 36 36 $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message ); … … 41 41 42 42 $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'subscriber', 'subscriber', 'category', self::$term_id ) ); 43 $this->assertI nstanceOf( 'IXR_Error',$result );43 $this->assertIXRError( $result ); 44 44 $this->assertEquals( 401, $result->code ); 45 45 $this->assertEquals( __( 'Sorry, you are not allowed to delete this term.' ), $result->message ); … … 50 50 51 51 $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', '' ) ); 52 $this->assertI nstanceOf( 'IXR_Error',$result );52 $this->assertIXRError( $result ); 53 53 $this->assertEquals( 500, $result->code ); 54 54 $this->assertEquals( __('Empty Term'), $result->message ); … … 59 59 60 60 $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', 9999 ) ); 61 $this->assertI nstanceOf( 'IXR_Error',$result );61 $this->assertIXRError( $result ); 62 62 $this->assertEquals( 404, $result->code ); 63 63 $this->assertEquals( __( 'Invalid term ID.' ), $result->message ); … … 68 68 69 69 $result = $this->myxmlrpcserver->wp_deleteTerm( array( 1, 'editor', 'editor', 'category', self::$term_id ) ); 70 $this->assertNotI nstanceOf( 'IXR_Error',$result );70 $this->assertNotIXRError( $result ); 71 71 $this->assertInternalType( 'boolean', $result ); 72 72 } -
trunk/tests/phpunit/tests/xmlrpc/wp/editComment.php
r38938 r40417 23 23 'status' => 'hold' 24 24 ) ) ); 25 $this->assertNotI nstanceOf( 'IXR_Error',$result );25 $this->assertNotIXRError( $result ); 26 26 $this->assertTrue( $result ); 27 27 } … … 43 43 44 44 $result = $this->myxmlrpcserver->wp_editComment( array( 1, 'author', 'author', $comment_id, array( 'status' => 'hold' ) ) ); 45 $this->assertI nstanceOf( 'IXR_Error',$result );45 $this->assertIXRError( $result ); 46 46 $this->assertEquals( 403, $result->code ); 47 47 $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 8 8 function test_invalid_username_password() { 9 9 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'username', 'password', 0, array() ) ); 10 $this->assertI nstanceOf( 'IXR_Error',$result );10 $this->assertIXRError( $result ); 11 11 $this->assertEquals( 403, $result->code ); 12 12 } … … 21 21 $post2 = array( 'post_title' => $new_title ); 22 22 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) ); 23 $this->assertNotI nstanceOf( 'IXR_Error',$result );23 $this->assertNotIXRError( $result ); 24 24 $this->assertTrue($result); 25 25 … … 38 38 $post2 = array( 'post_title' => $new_title ); 39 39 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) ); 40 $this->assertNotI nstanceOf( 'IXR_Error',$result );40 $this->assertNotIXRError( $result ); 41 41 $this->assertTrue($result); 42 42 … … 56 56 $post2 = array( 'post_title' => $new_title ); 57 57 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) ); 58 $this->assertI nstanceOf( 'IXR_Error',$result );58 $this->assertIXRError( $result ); 59 59 $this->assertEquals( 401, $result->code ); 60 60 … … 73 73 $post2 = array( 'post_author' => $author_id ); 74 74 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) ); 75 $this->assertNotI nstanceOf( 'IXR_Error',$result );75 $this->assertNotIXRError( $result ); 76 76 $this->assertTrue($result); 77 77 … … 89 89 $post2 = array( 'post_author' => $author_id ); 90 90 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) ); 91 $this->assertI nstanceOf( 'IXR_Error',$result );91 $this->assertIXRError( $result ); 92 92 $this->assertEquals( 401, $result->code ); 93 93 … … 108 108 $post2 = array( 'post_author' => $editor_id ); 109 109 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) ); 110 $this->assertNotI nstanceOf( 'IXR_Error',$result );110 $this->assertNotIXRError( $result ); 111 111 $this->assertTrue($result); 112 112 … … 132 132 $post2 = array( 'post_thumbnail' => $attachment_id ); 133 133 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post2 ) ); 134 $this->assertNotI nstanceOf( 'IXR_Error',$result );134 $this->assertNotIXRError( $result ); 135 135 $this->assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) ); 136 136 137 137 // fetch the post to verify that it appears 138 138 $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $post_id ) ); 139 $this->assertNotI nstanceOf( 'IXR_Error',$result );139 $this->assertNotIXRError( $result ); 140 140 $this->assertArrayHasKey( 'post_thumbnail', $result ); 141 141 $this->assertInternalType( 'array', $result['post_thumbnail'] ); … … 145 145 $post3 = array( 'post_content' => 'Updated post' ); 146 146 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post3 ) ); 147 $this->assertNotI nstanceOf( 'IXR_Error',$result );147 $this->assertNotIXRError( $result ); 148 148 $this->assertEquals( $attachment_id, get_post_meta( $post_id, '_thumbnail_id', true ) ); 149 149 … … 154 154 $post4 = array( 'post_thumbnail' => $attachment2_id ); 155 155 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post4 ) ); 156 $this->assertNotI nstanceOf( 'IXR_Error',$result );156 $this->assertNotIXRError( $result ); 157 157 $this->assertEquals( $attachment2_id, get_post_meta( $post_id, '_thumbnail_id', true ) ); 158 158 … … 160 160 $post5 = array( 'post_thumbnail' => '' ); 161 161 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post5 ) ); 162 $this->assertNotI nstanceOf( 'IXR_Error',$result );162 $this->assertNotIXRError( $result ); 163 163 $this->assertEquals( '', get_post_meta( $post_id, '_thumbnail_id', true ) ); 164 164 … … 166 166 $post6 = array( 'post_thumbnail' => 398420983409 ); 167 167 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'author', 'author', $post_id, $post6 ) ); 168 $this->assertI nstanceOf( 'IXR_Error',$result );168 $this->assertIXRError( $result ); 169 169 $this->assertEquals( 404, $result->code ); 170 170 … … 192 192 193 193 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) ); 194 $this->assertNotI nstanceOf( 'IXR_Error',$result );194 $this->assertNotIXRError( $result ); 195 195 $this->assertTrue($result); 196 196 … … 214 214 $post2 = array( 'sticky' => false ); 215 215 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) ); 216 $this->assertNotI nstanceOf( 'IXR_Error',$result );216 $this->assertNotIXRError( $result ); 217 217 $this->assertFalse( is_sticky( $post_id ) ); 218 218 } … … 226 226 $post2 = array( 'post_password' => 'foobar', 'sticky' => false ); 227 227 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $post2 ) ); 228 $this->assertNotI nstanceOf( 'IXR_Error',$result );228 $this->assertNotIXRError( $result ); 229 229 $this->assertFalse( is_sticky( $post_id ) ); 230 230 } … … 246 246 $struct = array( 'post_content' => 'First edit', 'if_not_modified_since' => new IXR_Date( $yesterday ) ); 247 247 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $struct ) ); 248 $this->assertNotI nstanceOf( 'IXR_Error',$result );248 $this->assertNotIXRError( $result ); 249 249 250 250 // Make sure the edit went through. … … 254 254 $struct = array( 'post_content' => 'Second edit', 'if_not_modified_since' => new IXR_Date( $yesterday ) ); 255 255 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $struct ) ); 256 $this->assertI nstanceOf( 'IXR_Error',$result );256 $this->assertIXRError( $result ); 257 257 $this->assertEquals( 409, $result->code ); 258 258 … … 274 274 $struct = array( 'post_content' => 'First edit' ); 275 275 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $struct ) ); 276 $this->assertNotI nstanceOf( 'IXR_Error',$result );276 $this->assertNotIXRError( $result ); 277 277 278 278 // Make sure that the post status is still inherit … … 291 291 $struct = array( 'post_status' => 'doesnt_exists' ); 292 292 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $struct ) ); 293 $this->assertNotI nstanceOf( 'IXR_Error',$result );293 $this->assertNotIXRError( $result ); 294 294 295 295 // Make sure that the post status is still inherit … … 310 310 311 311 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, array( 'ID' => $post_id, 'post_title' => 'Updated' ) ) ); 312 $this->assertNotI nstanceOf( 'IXR_Error',$result );312 $this->assertNotIXRError( $result ); 313 313 $this->assertEquals( 'Updated', get_post( $post_id )->post_title ); 314 314 … … 337 337 ); 338 338 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'editor', 'editor', $post_id, $new_post_content ) ); 339 $this->assertNotI nstanceOf( 'IXR_Error',$result );339 $this->assertNotIXRError( $result ); 340 340 $this->assertEquals( 'Updated', get_post( $post_id )->post_title ); 341 341 -
trunk/tests/phpunit/tests/xmlrpc/wp/editProfile.php
r39174 r40417 9 9 function test_invalid_username_password() { 10 10 $result = $this->myxmlrpcserver->wp_editProfile( array( 1, 'username', 'password', array() ) ); 11 $this->assertI nstanceOf( 'IXR_Error',$result );11 $this->assertIXRError( $result ); 12 12 $this->assertEquals( 403, $result->code ); 13 13 } … … 26 26 ); 27 27 $result = $this->myxmlrpcserver->wp_editProfile( array( 1, 'subscriber', 'subscriber', $new_data ) ); 28 $this->assertNotI nstanceOf( 'IXR_Error',$result );28 $this->assertNotIXRError( $result ); 29 29 $this->assertTrue( $result ); 30 30 … … 46 46 47 47 $result = $this->myxmlrpcserver->wp_editProfile( array( 1, 'author', 'author', $new_data ) ); 48 $this->assertNotI nstanceOf( 'IXR_Error',$result );48 $this->assertNotIXRError( $result ); 49 49 $this->assertTrue( $result ); 50 50 … … 61 61 62 62 $result = $this->myxmlrpcserver->wp_editProfile( array( 1, 'editor', 'editor', $new_data ) ); 63 $this->assertNotI nstanceOf( 'IXR_Error',$result );63 $this->assertNotIXRError( $result ); 64 64 $this->assertTrue( $result ); 65 65 -
trunk/tests/phpunit/tests/xmlrpc/wp/editTerm.php
r39189 r40417 23 23 function test_invalid_username_password() { 24 24 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'username', 'password', 'category', 1 ) ); 25 $this->assertI nstanceOf( 'IXR_Error',$result );25 $this->assertIXRError( $result ); 26 26 $this->assertEquals( 403, $result->code ); 27 27 } … … 31 31 32 32 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', '', array( 'taxonomy' => '' ) ) ); 33 $this->assertI nstanceOf( 'IXR_Error',$result );33 $this->assertIXRError( $result ); 34 34 $this->assertEquals( 403, $result->code ); 35 35 $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message ); … … 40 40 41 41 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', self::$parent_term, array( 'taxonomy' => 'not_existing' ) ) ); 42 $this->assertI nstanceOf( 'IXR_Error',$result );42 $this->assertIXRError( $result ); 43 43 $this->assertEquals( 403, $result->code ); 44 44 $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message ); … … 49 49 50 50 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'subscriber', 'subscriber', self::$parent_term, array( 'taxonomy' => 'category' ) ) ); 51 $this->assertI nstanceOf( 'IXR_Error',$result );51 $this->assertIXRError( $result ); 52 52 $this->assertEquals( 401, $result->code ); 53 53 $this->assertEquals( __( 'Sorry, you are not allowed to edit this term.' ), $result->message ); … … 58 58 59 59 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', 9999, array( 'taxonomy' => 'category' ) ) ); 60 $this->assertI nstanceOf( 'IXR_Error',$result );60 $this->assertIXRError( $result ); 61 61 $this->assertEquals( 404, $result->code ); 62 62 $this->assertEquals( __( 'Invalid term ID.' ), $result->message ); … … 67 67 68 68 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', '', array( 'taxonomy' => 'category' ) ) ); 69 $this->assertI nstanceOf( 'IXR_Error',$result );69 $this->assertIXRError( $result ); 70 70 $this->assertEquals( 500, $result->code ); 71 71 $this->assertEquals( __('Empty Term'), $result->message ); … … 76 76 77 77 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', self::$parent_term, array( 'taxonomy' => 'category', 'name' => '' ) ) ); 78 $this->assertI nstanceOf( 'IXR_Error',$result );78 $this->assertIXRError( $result ); 79 79 $this->assertEquals( 403, $result->code ); 80 80 $this->assertEquals( __( 'The term name cannot be empty.' ), $result->message ); … … 85 85 86 86 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', self::$post_tag, array( 'taxonomy' => 'post_tag', 'parent' => self::$parent_term ) ) ); 87 $this->assertI nstanceOf( 'IXR_Error',$result );87 $this->assertIXRError( $result ); 88 88 $this->assertEquals( 403, $result->code ); 89 89 $this->assertEquals( __( "This taxonomy is not hierarchical so you can't set a parent." ), $result->message ); … … 94 94 95 95 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', self::$child_term, array( 'taxonomy' => 'category', 'parent' => '', 'name' => 'test' ) ) ); 96 $this->assertNotI nstanceOf( 'IXR_Error',$result );96 $this->assertNotIXRError( $result ); 97 97 $this->assertTrue( $result ); 98 98 } … … 103 103 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', self::$child_term, array( 'taxonomy' => 'category', 'parent' => NULL, 'name' => 'test' ) ) ); 104 104 105 $this->assertNotI nstanceOf( 'IXR_Error',$result );105 $this->assertNotIXRError( $result ); 106 106 $this->assertInternalType( 'boolean', $result ); 107 107 … … 114 114 115 115 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', self::$child_term, array( 'taxonomy' => 'category', 'parent' => 'dasda', 'name' => 'test' ) ) ); 116 $this->assertI nstanceOf( 'IXR_Error',$result );116 $this->assertIXRError( $result ); 117 117 $this->assertEquals( 500, $result->code ); 118 118 } … … 122 122 123 123 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', self::$child_term, array( 'taxonomy' => 'category', 'parent' => 9999, 'name' => 'test' ) ) ); 124 $this->assertI nstanceOf( 'IXR_Error',$result );124 $this->assertIXRError( $result ); 125 125 $this->assertEquals( 403, $result->code ); 126 126 $this->assertEquals( __( 'Parent term does not exist.' ), $result->message ); … … 132 132 $parent_term = get_term_by( 'id', self::$parent_term, 'category' ); 133 133 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', self::$child_term, array( 'taxonomy' => 'category', 'slug' => $parent_term->slug ) ) ); 134 $this->assertI nstanceOf( 'IXR_Error',$result );134 $this->assertIXRError( $result ); 135 135 $this->assertEquals( 500, $result->code ); 136 136 $this->assertEquals( htmlspecialchars( sprintf( __('The slug “%s” is already in use by another term'), $parent_term->slug ) ), $result->message ); … … 143 143 $result = $this->myxmlrpcserver->wp_editTerm( array( 1, 'editor', 'editor', self::$child_term, $fields ) ); 144 144 145 $this->assertNotI nstanceOf( 'IXR_Error',$result );145 $this->assertNotIXRError( $result ); 146 146 $this->assertInternalType( 'boolean', $result ); 147 147 } -
trunk/tests/phpunit/tests/xmlrpc/wp/getComment.php
r39189 r40417 36 36 function test_invalid_username_password() { 37 37 $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'username', 'password', self::$parent_comment_id ) ); 38 $this->assertI nstanceOf( 'IXR_Error',$result );38 $this->assertIXRError( $result ); 39 39 $this->assertEquals( 403, $result->code ); 40 40 } … … 44 44 45 45 $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'contributor', 'contributor', self::$parent_comment_id ) ); 46 $this->assertI nstanceOf( 'IXR_Error',$result );46 $this->assertIXRError( $result ); 47 47 $this->assertEquals( 403, $result->code ); 48 48 } … … 52 52 53 53 $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'editor', 'editor', self::$parent_comment_id ) ); 54 $this->assertNotI nstanceOf( 'IXR_Error',$result );54 $this->assertNotIXRError( $result ); 55 55 56 56 // Check data types … … 88 88 89 89 $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'editor', 'editor', self::$child_comment_id ) ); 90 $this->assertNotI nstanceOf( 'IXR_Error',$result );90 $this->assertNotIXRError( $result ); 91 91 92 92 $this->assertEquals( self::$child_comment_id, $result['comment_id'] ); … … 98 98 99 99 $result = $this->myxmlrpcserver->wp_getComment( array( 1, 'editor', 'editor', 123456789 ) ); 100 $this->assertI nstanceOf( 'IXR_Error',$result );100 $this->assertIXRError( $result ); 101 101 $this->assertEquals( 404, $result->code ); 102 102 } -
trunk/tests/phpunit/tests/xmlrpc/wp/getComments.php
r35242 r40417 9 9 function test_invalid_username_password() { 10 10 $result = $this->myxmlrpcserver->wp_getComments( array( 1, 'username', 'password', array() ) ); 11 $this->assertI nstanceOf( 'IXR_Error',$result );11 $this->assertIXRError( $result ); 12 12 $this->assertEquals( 403, $result->code ); 13 13 } … … 17 17 18 18 $result = $this->myxmlrpcserver->wp_getComments( array( 1, 'contributor', 'contributor', array() ) ); 19 $this->assertI nstanceOf( 'IXR_Error',$result );19 $this->assertIXRError( $result ); 20 20 $this->assertEquals( 401, $result->code ); 21 21 } … … 28 28 29 29 $results = $this->myxmlrpcserver->wp_getComments( array( 1, 'editor', 'editor', array() ) ); 30 $this->assertNotI nstanceOf( 'IXR_Error',$results );30 $this->assertNotIXRError( $results ); 31 31 32 32 foreach( $results as $result ) { … … 45 45 'post_id' => $this->post_id 46 46 ) ) ); 47 $this->assertNotI nstanceOf( 'IXR_Error',$results );47 $this->assertNotIXRError( $results ); 48 48 49 49 foreach( $results as $result ) { … … 61 61 'post_id' => $this->post_id, 62 62 ) ) ); 63 $this->assertNotI nstanceOf( 'IXR_Error',$results );63 $this->assertNotIXRError( $results ); 64 64 65 65 // if no 'number' filter is specified, default should be 10 … … 70 70 'number' => 5 71 71 ) ) ); 72 $this->assertNotI nstanceOf( 'IXR_Error',$results2 );72 $this->assertNotIXRError( $results2 ); 73 73 $this->assertCount( 5, $results2 ); 74 74 } … … 105 105 106 106 $result = $this->myxmlrpcserver->wp_getComments( array( 1, 'contributor', 'contributor' ) ); 107 $this->assertI nstanceOf( 'IXR_Error',$result );107 $this->assertIXRError( $result ); 108 108 $this->assertEquals( 401, $result->code ); 109 109 } … … 141 141 'post_id' => $author_post_id 142 142 ) ) ); 143 $this->assertI nstanceOf( 'IXR_Error',$result1 );143 $this->assertIXRError( $result1 ); 144 144 145 145 $result2 = $this->myxmlrpcserver->wp_getComments( array( 1, 'author', 'author', array( … … 154 154 'post_id' => $editor_post_id 155 155 ) ) ); 156 $this->assertI nstanceOf( 'IXR_Error',$result3 );156 $this->assertIXRError( $result3 ); 157 157 158 158 $result4 = $this->myxmlrpcserver->wp_getComments( array( 1, 'author', 'author', array( -
trunk/tests/phpunit/tests/xmlrpc/wp/getMediaItem.php
r39189 r40417 39 39 function test_invalid_username_password() { 40 40 $result = $this->myxmlrpcserver->wp_getMediaItem( array( 1, 'username', 'password', 0 ) ); 41 $this->assertI nstanceOf( 'IXR_Error',$result );41 $this->assertIXRError( $result ); 42 42 $this->assertEquals( 403, $result->code ); 43 43 } … … 48 48 $fields = array( 'post' ); 49 49 $result = $this->myxmlrpcserver->wp_getMediaItem( array( 1, 'author', 'author', $this->attachment_id, $fields ) ); 50 $this->assertNotI nstanceOf( 'IXR_Error',$result );50 $this->assertNotIXRError( $result ); 51 51 52 52 // Check data types -
trunk/tests/phpunit/tests/xmlrpc/wp/getOptions.php
r25002 r40417 8 8 function test_invalid_username_password() { 9 9 $result = $this->myxmlrpcserver->wp_getOptions( array( 1, 'username', 'password' ) ); 10 $this->assertI nstanceOf( 'IXR_Error',$result );10 $this->assertIXRError( $result ); 11 11 $this->assertEquals( 403, $result->code ); 12 12 } -
trunk/tests/phpunit/tests/xmlrpc/wp/getPage.php
r39189 r40417 21 21 function test_invalid_username_password() { 22 22 $result = $this->myxmlrpcserver->wp_getPage( array( 1, self::$post_id, 'username', 'password' ) ); 23 $this->assertI nstanceOf( 'IXR_Error',$result );23 $this->assertIXRError( $result ); 24 24 $this->assertEquals( 403, $result->code ); 25 25 } … … 32 32 33 33 $result = $this->myxmlrpcserver->wp_getPage( array( 1, 9999, 'editor', 'editor' ) ); 34 $this->assertI nstanceOf( 'IXR_Error',$result );34 $this->assertIXRError( $result ); 35 35 $this->assertEquals( 404, $result->code ); 36 36 } … … 40 40 41 41 $result = $this->myxmlrpcserver->wp_getPage( array( 1, self::$post_id, 'editor', 'editor' ) ); 42 $this->assertNotI nstanceOf( 'IXR_Error',$result );42 $this->assertNotIXRError( $result ); 43 43 44 44 // Check data types … … 81 81 82 82 $result = $this->myxmlrpcserver->wp_getPage( array( 1, self::$post_id, 'editor', 'editor' ) ); 83 $this->assertNotI nstanceOf( 'IXR_Error',$result );83 $this->assertNotIXRError( $result ); 84 84 85 85 $this->assertInstanceOf( 'IXR_Date', $result['dateCreated'] ); -
trunk/tests/phpunit/tests/xmlrpc/wp/getPageList.php
r39189 r40417 21 21 function test_invalid_username_password() { 22 22 $result = $this->myxmlrpcserver->wp_getPageList( array( 1, 'username', 'password' ) ); 23 $this->assertI nstanceOf( 'IXR_Error',$result );23 $this->assertIXRError( $result ); 24 24 $this->assertEquals( 403, $result->code ); 25 25 } … … 29 29 30 30 $result = $this->myxmlrpcserver->wp_getPageList( array( 1, 'contributor', 'contributor' ) ); 31 $this->assertI nstanceOf( 'IXR_Error',$result );31 $this->assertIXRError( $result ); 32 32 $this->assertEquals( 401, $result->code ); 33 33 } … … 37 37 38 38 $results = $this->myxmlrpcserver->wp_getPageList( array( 1, 'editor', 'editor' ) ); 39 $this->assertNotI nstanceOf( 'IXR_Error',$results );39 $this->assertNotIXRError( $results ); 40 40 41 41 foreach( $results as $result ) { -
trunk/tests/phpunit/tests/xmlrpc/wp/getPages.php
r39189 r40417 27 27 function test_invalid_username_password() { 28 28 $result = $this->myxmlrpcserver->wp_getPages( array( 1, 'username', 'password' ) ); 29 $this->assertI nstanceOf( 'IXR_Error',$result );29 $this->assertIXRError( $result ); 30 30 $this->assertEquals( 403, $result->code ); 31 31 } … … 35 35 36 36 $result = $this->myxmlrpcserver->wp_getPages( array( 1, 'contributor', 'contributor' ) ); 37 $this->assertI nstanceOf( 'IXR_Error',$result );37 $this->assertIXRError( $result ); 38 38 $this->assertEquals( 401, $result->code ); 39 39 } … … 41 41 function test_capable_user() { 42 42 $results = $this->myxmlrpcserver->wp_getPages( array( 1, 'administrator', 'administrator' ) ); 43 $this->assertNotI nstanceOf( 'IXR_Error',$results );43 $this->assertNotIXRError( $results ); 44 44 45 45 foreach( $results as $result ) { … … 66 66 67 67 $results = $this->myxmlrpcserver->wp_getPages( array( 1, 'editor', 'editor' ) ); 68 $this->assertNotI nstanceOf( 'IXR_Error',$results );68 $this->assertNotIXRError( $results ); 69 69 70 70 $found_incapable = false; 71 71 foreach( $results as $result ) { 72 72 // WP#20629 73 $this->assertNotI nstanceOf( 'IXR_Error',$result );73 $this->assertNotIXRError( $result ); 74 74 75 75 if ( $result['page_id'] == self::$post_id ) { -
trunk/tests/phpunit/tests/xmlrpc/wp/getPost.php
r35242 r40417 28 28 function test_invalid_username_password() { 29 29 $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'username', 'password', 1 ) ); 30 $this->assertI nstanceOf( 'IXR_Error',$result );30 $this->assertIXRError( $result ); 31 31 $this->assertEquals( 403, $result->code ); 32 32 } … … 37 37 $fields = array( 'post', 'custom_fields' ); 38 38 $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id, $fields ) ); 39 $this->assertNotI nstanceOf( 'IXR_Error',$result );39 $this->assertNotIXRError( $result ); 40 40 41 41 // Check data types … … 80 80 $fields = array(); 81 81 $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id, $fields ) ); 82 $this->assertNotI nstanceOf( 'IXR_Error',$result );82 $this->assertNotIXRError( $result ); 83 83 84 84 // when no fields are requested, only the IDs should be returned … … 89 89 function test_default_fields() { 90 90 $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id ) ); 91 $this->assertNotI nstanceOf( 'IXR_Error',$result );91 $this->assertNotIXRError( $result ); 92 92 93 93 $this->assertArrayHasKey( 'post_id', $result ); … … 100 100 $fields = array( 'post' ); 101 101 $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'author', 'author', $this->post_id, $fields ) ); 102 $this->assertNotI nstanceOf( 'IXR_Error',$result );102 $this->assertNotIXRError( $result ); 103 103 104 104 $this->assertInstanceOf( 'IXR_Date', $result['post_date'] ); … … 131 131 132 132 $result = $this->myxmlrpcserver->wp_getPost( array( 1, 'editor', 'editor', $child_page_id ) ); 133 $this->assertNotI nstanceOf( 'IXR_Error',$result );133 $this->assertNotIXRError( $result ); 134 134 135 135 $this->assertInternalType( 'string', $result['post_id'] ); -
trunk/tests/phpunit/tests/xmlrpc/wp/getPostType.php
r25002 r40417 32 32 function test_invalid_username_password() { 33 33 $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'username', 'password', 'post' ) ); 34 $this->assertI nstanceOf( 'IXR_Error',$result );34 $this->assertIXRError( $result ); 35 35 $this->assertEquals( 403, $result->code ); 36 36 } … … 40 40 41 41 $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'editor', 'editor', 'foobar' ) ); 42 $this->assertI nstanceOf( 'IXR_Error',$result );42 $this->assertIXRError( $result ); 43 43 $this->assertEquals( 403, $result->code ); 44 44 } … … 48 48 49 49 $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'editor', 'editor', 'post' ) ); 50 $this->assertNotI nstanceOf( 'IXR_Error',$result );50 $this->assertNotIXRError( $result ); 51 51 } 52 52 … … 55 55 56 56 $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'subscriber', 'subscriber', 'post' ) ); 57 $this->assertI nstanceOf( 'IXR_Error',$result );57 $this->assertIXRError( $result ); 58 58 $this->assertEquals( 401, $result->code ); 59 59 } … … 63 63 64 64 $result = $this->myxmlrpcserver->wp_getPostType( array( 1, 'editor', 'editor', $this->cpt_name, array( 'labels', 'cap', 'menu', 'taxonomies' ) ) ); 65 $this->assertNotI nstanceOf( 'IXR_Error',$result );65 $this->assertNotIXRError( $result ); 66 66 67 67 // check data types -
trunk/tests/phpunit/tests/xmlrpc/wp/getPostTypes.php
r25002 r40417 7 7 function test_invalid_username_password() { 8 8 $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'username', 'password', 'post' ) ); 9 $this->assertI nstanceOf( 'IXR_Error',$result );9 $this->assertIXRError( $result ); 10 10 $this->assertEquals( 403, $result->code ); 11 11 } … … 15 15 16 16 $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'subscriber', 'subscriber' ) ); 17 $this->assertNotI nstanceOf( 'IXR_Error',$result );17 $this->assertNotIXRError( $result ); 18 18 $this->assertInternalType( 'array', $result ); 19 19 $this->assertEquals( 0, count( $result ) ); … … 24 24 25 25 $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'editor', 'editor' ) ); 26 $this->assertNotI nstanceOf( 'IXR_Error',$result );26 $this->assertNotIXRError( $result ); 27 27 $this->assertInternalType( 'array', $result ); 28 28 $this->assertGreaterThan( 0, count( $result ) ); … … 33 33 34 34 $result = $this->myxmlrpcserver->wp_getPostTypes( array( 1, 'editor', 'editor', array( 'hierarchical' => true ) ) ); 35 $this->assertNotI nstanceOf( 'IXR_Error',$result );35 $this->assertNotIXRError( $result ); 36 36 $this->assertInternalType( 'array', $result ); 37 37 -
trunk/tests/phpunit/tests/xmlrpc/wp/getPosts.php
r38382 r40417 8 8 function test_invalid_username_password() { 9 9 $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'username', 'password' ) ); 10 $this->assertI nstanceOf( 'IXR_Error',$result );10 $this->assertIXRError( $result ); 11 11 $this->assertEquals( 403, $result->code ); 12 12 } … … 19 19 20 20 $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'subscriber', 'subscriber' ) ); 21 $this->assertI nstanceOf( 'IXR_Error',$result );21 $this->assertIXRError( $result ); 22 22 $this->assertEquals( 401, $result->code ); 23 23 24 24 $filter = array( 'post_type' => 'page' ); 25 25 $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'subscriber', 'subscriber', $filter ) ); 26 $this->assertI nstanceOf( 'IXR_Error',$result );26 $this->assertIXRError( $result ); 27 27 $this->assertEquals( 401, $result->code ); 28 28 } … … 32 32 33 33 $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor' ) ); 34 $this->assertNotI nstanceOf( 'IXR_Error',$result );34 $this->assertNotIXRError( $result ); 35 35 } 36 36 … … 40 40 $filter = array( 'post_type' => 'invalid_post_type_name' ); 41 41 $result = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) ); 42 $this->assertI nstanceOf( 'IXR_Error',$result );42 $this->assertIXRError( $result ); 43 43 } 44 44 … … 63 63 $filter = array( 'post_type' => $cpt_name, 'number' => $num_posts + 10 ); 64 64 $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) ); 65 $this->assertNotI nstanceOf( 'IXR_Error',$results );65 $this->assertNotIXRError( $results ); 66 66 $this->assertEquals( $num_posts, count( $results ) ); 67 67 … … 87 87 $filter2 = array( 'post_type' => $cpt_name, 'number' => $num_posts, 'orderby' => 'comment_count', 'order' => 'DESC' ); 88 88 $results2 = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter2 ) ); 89 $this->assertNotI nstanceOf( 'IXR_Error',$results2 );89 $this->assertNotIXRError( $results2 ); 90 90 $last_comment_count = 100; 91 91 foreach ( $results2 as $post ) { … … 101 101 $filter3 = array( 'post_type' => $cpt_name, 'post_status' => 'draft' ); 102 102 $results3 = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter3 ) ); 103 $this->assertNotI nstanceOf( 'IXR_Error',$results3 );103 $this->assertNotIXRError( $results3 ); 104 104 $this->assertEquals( 1, count( $results3 ) ); 105 105 $this->assertEquals( $post->ID, $results3[0]['post_id'] ); … … 114 114 // check default fields 115 115 $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor' ) ); 116 $this->assertNotI nstanceOf( 'IXR_Error',$results );116 $this->assertNotIXRError( $results ); 117 117 $expected_fields = array( 'post_id', 'post_title', 'terms', 'custom_fields', 'link' ); // subset of expected fields 118 118 foreach( $expected_fields as $field ) { … … 124 124 $fields = array( 'post_name', 'post_author', 'enclosure' ); 125 125 $results2 = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter, $fields ) ); 126 $this->assertNotI nstanceOf( 'IXR_Error',$results2 );126 $this->assertNotIXRError( $results2 ); 127 127 $expected_fields = array_merge( $fields, array( 'post_id' ) ); 128 128 foreach ( array_keys( $results2[0] ) as $field ) { … … 143 143 $filter = array( 's' => 'Third' ); 144 144 $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) ); 145 $this->assertNotI nstanceOf( 'IXR_Error',$results );145 $this->assertNotIXRError( $results ); 146 146 $this->assertEquals( 0, count( $results ) ); 147 147 … … 149 149 $filter = array( 's' => 'First:' ); 150 150 $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) ); 151 $this->assertNotI nstanceOf( 'IXR_Error',$results );151 $this->assertNotIXRError( $results ); 152 152 $this->assertEquals( 1, count( $results ) ); 153 153 } -
trunk/tests/phpunit/tests/xmlrpc/wp/getProfile.php
r25394 r40417 9 9 function test_invalid_username_password() { 10 10 $result = $this->myxmlrpcserver->wp_getProfile( array( 1, 'username', 'password' ) ); 11 $this->assertI nstanceOf( 'IXR_Error',$result );11 $this->assertIXRError( $result ); 12 12 $this->assertEquals( 403, $result->code ); 13 13 } … … 17 17 18 18 $result = $this->myxmlrpcserver->wp_getProfile( array( 1, 'subscriber', 'subscriber' ) ); 19 $this->assertNotI nstanceOf( 'IXR_Error',$result );19 $this->assertNotIXRError( $result ); 20 20 $this->assertEquals( $subscriber_id, $result['user_id'] ); 21 21 $this->assertContains( 'subscriber', $result['roles'] ); … … 26 26 27 27 $result = $this->myxmlrpcserver->wp_getProfile( array( 1, 'administrator', 'administrator' ) ); 28 $this->assertNotI nstanceOf( 'IXR_Error',$result );28 $this->assertNotIXRError( $result ); 29 29 $this->assertEquals( $administrator_id, $result['user_id'] ); 30 30 $this->assertContains( 'administrator', $result['roles'] ); … … 37 37 38 38 $result = $this->myxmlrpcserver->wp_getProfile( array( 1, 'editor', 'editor', $fields ) ); 39 $this->assertNotI nstanceOf( 'IXR_Error',$result );39 $this->assertNotIXRError( $result ); 40 40 $this->assertEquals( $editor_id, $result['user_id'] ); 41 41 -
trunk/tests/phpunit/tests/xmlrpc/wp/getRevisions.php
r35242 r40417 8 8 function test_invalid_username_password() { 9 9 $result = $this->myxmlrpcserver->wp_getRevisions( array( 1, 'username', 'password', 0 ) ); 10 $this->assertI nstanceOf( 'IXR_Error',$result );10 $this->assertIXRError( $result ); 11 11 $this->assertEquals( 403, $result->code ); 12 12 } … … 18 18 19 19 $result = $this->myxmlrpcserver->wp_getRevisions( array( 1, 'subscriber', 'subscriber', $post_id ) ); 20 $this->assertI nstanceOf( 'IXR_Error',$result );20 $this->assertIXRError( $result ); 21 21 $this->assertEquals( 401, $result->code ); 22 22 } … … 27 27 $post_id = self::factory()->post->create(); 28 28 $result = $this->myxmlrpcserver->wp_getRevisions( array( 1, 'editor', 'editor', $post_id ) ); 29 $this->assertNotI nstanceOf( 'IXR_Error',$result );29 $this->assertNotIXRError( $result ); 30 30 } 31 31 -
trunk/tests/phpunit/tests/xmlrpc/wp/getTaxonomies.php
r25002 r40417 8 8 function test_invalid_username_password() { 9 9 $result = $this->myxmlrpcserver->wp_getTaxonomies( array( 1, 'username', 'password' ) ); 10 $this->assertI nstanceOf( 'IXR_Error',$result );10 $this->assertIXRError( $result ); 11 11 $this->assertEquals( 403, $result->code ); 12 12 } … … 16 16 17 17 $result = $this->myxmlrpcserver->wp_getTaxonomies( array( 1, 'editor', 'editor' ) ); 18 $this->assertNotI nstanceOf( 'IXR_Error',$result );18 $this->assertNotIXRError( $result ); 19 19 } 20 20 } -
trunk/tests/phpunit/tests/xmlrpc/wp/getTaxonomy.php
r38078 r40417 8 8 function test_invalid_username_password() { 9 9 $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'username', 'password', 'category' ) ); 10 $this->assertI nstanceOf( 'IXR_Error',$result );10 $this->assertIXRError( $result ); 11 11 $this->assertEquals( 403, $result->code ); 12 12 } … … 16 16 17 17 $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', '' ) ); 18 $this->assertI nstanceOf( 'IXR_Error',$result );18 $this->assertIXRError( $result ); 19 19 $this->assertEquals( 403, $result->code ); 20 20 $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message ); … … 25 25 26 26 $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'not_existing' ) ); 27 $this->assertI nstanceOf( 'IXR_Error',$result );27 $this->assertIXRError( $result ); 28 28 $this->assertEquals( 403, $result->code ); 29 29 $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message ); … … 34 34 35 35 $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'subscriber', 'subscriber', 'category' ) ); 36 $this->assertI nstanceOf( 'IXR_Error',$result );36 $this->assertIXRError( $result ); 37 37 $this->assertEquals( 401, $result->code ); 38 38 $this->assertEquals( __( 'Sorry, you are not allowed to assign terms in this taxonomy.' ), $result->message ); … … 43 43 44 44 $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'category' ) ); 45 $this->assertNotI nstanceOf( 'IXR_Error',$result );45 $this->assertNotIXRError( $result ); 46 46 } 47 47 … … 50 50 51 51 $result = $this->myxmlrpcserver->wp_getTaxonomy( array( 1, 'editor', 'editor', 'category' ) ); 52 $this->assertNotI nstanceOf( 'IXR_Error',$result );52 $this->assertNotIXRError( $result ); 53 53 $taxonomy = get_taxonomy( 'category' ); 54 54 $this->assertEquals( 'category', $result['name'], 'name' ); -
trunk/tests/phpunit/tests/xmlrpc/wp/getTerm.php
r39189 r40417 16 16 function test_invalid_username_password() { 17 17 $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'username', 'password', 'category', 1 ) ); 18 $this->assertI nstanceOf( 'IXR_Error',$result );18 $this->assertIXRError( $result ); 19 19 $this->assertEquals( 403, $result->code ); 20 20 } … … 24 24 25 25 $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', '', 0 ) ); 26 $this->assertI nstanceOf( 'IXR_Error',$result );26 $this->assertIXRError( $result ); 27 27 $this->assertEquals( 403, $result->code ); 28 28 $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message ); … … 33 33 34 34 $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'not_existing', 0 ) ); 35 $this->assertI nstanceOf( 'IXR_Error',$result );35 $this->assertIXRError( $result ); 36 36 $this->assertEquals( 403, $result->code ); 37 37 $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message ); … … 42 42 43 43 $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'subscriber', 'subscriber', 'category', self::$term_id ) ); 44 $this->assertI nstanceOf( 'IXR_Error',$result );44 $this->assertIXRError( $result ); 45 45 $this->assertEquals( 401, $result->code ); 46 46 $this->assertEquals( __( 'Sorry, you are not allowed to assign this term.' ), $result->message ); … … 52 52 53 53 $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', '' ) ); 54 $this->assertI nstanceOf( 'IXR_Error',$result );54 $this->assertIXRError( $result ); 55 55 $this->assertEquals( 500, $result->code ); 56 56 $this->assertEquals( __('Empty Term'), $result->message ); … … 61 61 62 62 $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', 9999 ) ); 63 $this->assertI nstanceOf( 'IXR_Error',$result );63 $this->assertIXRError( $result ); 64 64 $this->assertEquals( 404, $result->code ); 65 65 $this->assertEquals( __( 'Invalid term ID.' ), $result->message ); … … 73 73 $result = $this->myxmlrpcserver->wp_getTerm( array( 1, 'editor', 'editor', 'category', self::$term_id ) ); 74 74 75 $this->assertNotI nstanceOf( 'IXR_Error',$result );75 $this->assertNotIXRError( $result ); 76 76 $this->assertEquals( $result, $term ); 77 77 -
trunk/tests/phpunit/tests/xmlrpc/wp/getTerms.php
r38938 r40417 8 8 function test_invalid_username_password() { 9 9 $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'username', 'password', 'category' ) ); 10 $this->assertI nstanceOf( 'IXR_Error',$result );10 $this->assertIXRError( $result ); 11 11 $this->assertEquals( 403, $result->code ); 12 12 } … … 16 16 17 17 $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', '' ) ); 18 $this->assertI nstanceOf( 'IXR_Error',$result );18 $this->assertIXRError( $result ); 19 19 $this->assertEquals( 403, $result->code ); 20 20 $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message ); … … 25 25 26 26 $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'not_existing' ) ); 27 $this->assertI nstanceOf( 'IXR_Error',$result );27 $this->assertIXRError( $result ); 28 28 $this->assertEquals( 403, $result->code ); 29 29 $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message ); … … 34 34 35 35 $result = $this->myxmlrpcserver->wp_getTerms( array( 1, 'subscriber', 'subscriber', 'category' ) ); 36 $this->assertI nstanceOf( 'IXR_Error',$result );36 $this->assertIXRError( $result ); 37 37 $this->assertEquals( 401, $result->code ); 38 38 $this->assertEquals( __( 'Sorry, you are not allowed to assign terms in this taxonomy.' ), $result->message ); … … 46 46 47 47 $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category' ) ); 48 $this->assertNotI nstanceOf( 'IXR_Error',$results );48 $this->assertNotIXRError( $results ); 49 49 50 50 foreach( $results as $term ) { … … 72 72 // test fetching all terms 73 73 $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name ) ); 74 $this->assertNotI nstanceOf( 'IXR_Error',$results );74 $this->assertNotIXRError( $results ); 75 75 76 76 $this->assertEquals( $num_terms, count( $results ) ); … … 82 82 $filter = array( 'number' => 5 ); 83 83 $results2 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) ); 84 $this->assertNotI nstanceOf( 'IXR_Error',$results );84 $this->assertNotIXRError( $results ); 85 85 $this->assertEquals( 5, count( $results2 ) ); 86 86 $this->assertEquals( $results[1]['term_id'], $results2[1]['term_id'] ); // check one of the terms … … 88 88 $filter['offset'] = 10; 89 89 $results3 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) ); 90 $this->assertNotI nstanceOf( 'IXR_Error',$results3 );90 $this->assertNotIXRError( $results3 ); 91 91 $this->assertEquals( $num_terms - 10, count( $results3 ) ); 92 92 $this->assertEquals( $results[11]['term_id'], $results3[1]['term_id'] ); … … 95 95 $filter = array( 'hide_empty' => true ); 96 96 $results4 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', $tax_name, $filter ) ); 97 $this->assertNotI nstanceOf( 'IXR_Error',$results4 );97 $this->assertNotIXRError( $results4 ); 98 98 $this->assertEquals( 0, count( $results4 ) ); 99 99 … … 112 112 $filter = array( 'orderby' => 'count', 'order' => 'DESC' ); 113 113 $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) ); 114 $this->assertNotI nstanceOf( 'IXR_Error',$results );114 $this->assertNotIXRError( $results ); 115 115 $this->assertNotEquals( 0, count( $results ) ); 116 116 … … 134 134 $filter = array( 'search' => $name ); 135 135 $results = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) ); 136 $this->assertNotI nstanceOf( 'IXR_Error',$results );136 $this->assertNotIXRError( $results ); 137 137 $this->assertEquals( 1, count( $results ) ); 138 138 $this->assertEquals( $name, $results[0]['name'] ); … … 142 142 $filter = array( 'search' => substr( $name, 0, 10 ) ); 143 143 $results2 = $this->myxmlrpcserver->wp_getTerms( array( 1, 'editor', 'editor', 'category', $filter ) ); 144 $this->assertNotI nstanceOf( 'IXR_Error',$results2 );144 $this->assertNotIXRError( $results2 ); 145 145 $this->assertEquals( 1, count( $results2 ) ); 146 146 $this->assertEquals( $name, $results2[0]['name'] ); -
trunk/tests/phpunit/tests/xmlrpc/wp/getUser.php
r38938 r40417 26 26 function test_invalid_username_password() { 27 27 $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'username', 'password', 1 ) ); 28 $this->assertI nstanceOf( 'IXR_Error',$result );28 $this->assertIXRError( $result ); 29 29 $this->assertEquals( 403, $result->code ); 30 30 } … … 32 32 function test_invalid_user() { 33 33 $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', 34902348908234 ) ); 34 $this->assertI nstanceOf( 'IXR_Error',$result );34 $this->assertIXRError( $result ); 35 35 $this->assertEquals( 404, $result->code ); 36 36 } … … 41 41 42 42 $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'subscriber', 'subscriber', $editor_id ) ); 43 $this->assertI nstanceOf( 'IXR_Error',$result );43 $this->assertIXRError( $result ); 44 44 $this->assertEquals( 401, $result->code ); 45 45 } … … 49 49 50 50 $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'subscriber', 'subscriber', $subscriber_id ) ); 51 $this->assertNotI nstanceOf( 'IXR_Error',$result );51 $this->assertNotIXRError( $result ); 52 52 $this->assertEquals( $subscriber_id, $result['user_id'] ); 53 53 } … … 73 73 74 74 $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', $user_id ) ); 75 $this->assertNotI nstanceOf( 'IXR_Error',$result );75 $this->assertNotIXRError( $result ); 76 76 77 77 // check data types … … 112 112 113 113 $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', $editor_id, array() ) ); 114 $this->assertNotI nstanceOf( 'IXR_Error',$result );114 $this->assertNotIXRError( $result ); 115 115 $this->assertEquals( $editor_id, $result['user_id'] ); 116 116 … … 123 123 124 124 $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', $editor_id, array( 'basic' ) ) ); 125 $this->assertNotI nstanceOf( 'IXR_Error',$result );125 $this->assertNotIXRError( $result ); 126 126 $this->assertEquals( $editor_id, $result['user_id'] ); 127 127 … … 139 139 140 140 $result = $this->myxmlrpcserver->wp_getUser( array( 1, 'administrator', 'administrator', $editor_id, $fields ) ); 141 $this->assertNotI nstanceOf( 'IXR_Error',$result );141 $this->assertNotIXRError( $result ); 142 142 $this->assertEquals( $editor_id, $result['user_id'] ); 143 143 -
trunk/tests/phpunit/tests/xmlrpc/wp/getUsers.php
r38938 r40417 9 9 function test_invalid_username_password() { 10 10 $results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'username', 'password' ) ); 11 $this->assertI nstanceOf( 'IXR_Error',$results );11 $this->assertIXRError( $results ); 12 12 $this->assertEquals( 403, $results->code ); 13 13 } … … 17 17 18 18 $results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'subscriber', 'subscriber' ) ); 19 $this->assertI nstanceOf( 'IXR_Error',$results );19 $this->assertIXRError( $results ); 20 20 $this->assertEquals( 401, $results->code ); 21 21 } … … 25 25 26 26 $result = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator' ) ); 27 $this->assertNotI nstanceOf( 'IXR_Error',$result );27 $this->assertNotIXRError( $result ); 28 28 29 29 // check data types … … 50 50 $filter = array( 'role' => 'invalidrole' ); 51 51 $results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter ) ); 52 $this->assertI nstanceOf( 'IXR_Error',$results );52 $this->assertIXRError( $results ); 53 53 $this->assertEquals( 403, $results->code ); 54 54 } … … 64 64 $filter = array( 'role' => 'editor' ); 65 65 $results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter ) ); 66 $this->assertNotI nstanceOf( 'IXR_Error',$results );66 $this->assertNotIXRError( $results ); 67 67 $this->assertCount( 1, $results ); 68 68 $this->assertEquals( $editor_id, $results[0]['user_id'] ); … … 71 71 $filter2 = array( 'who' => 'authors' ); 72 72 $results2 = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter2 ) ); 73 $this->assertNotI nstanceOf( 'IXR_Error',$results2 );73 $this->assertNotIXRError( $results2 ); 74 74 $this->assertCount( 3, array_intersect( array( $author_id, $editor_id, $administrator_id ), wp_list_pluck( $results2, 'user_id' ) ) ); 75 75 } … … 105 105 $filter = array( 'orderby' => 'email', 'order' => 'ASC' ); 106 106 $results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter ) ); 107 $this->assertNotI nstanceOf( 'IXR_Error',$results );107 $this->assertNotIXRError( $results ); 108 108 109 109 $last_email = ''; -
trunk/tests/phpunit/tests/xmlrpc/wp/newComment.php
r39045 r40417 14 14 ) ) ); 15 15 16 $this->assertNotI nstanceOf( 'IXR_Error',$result );16 $this->assertNotIXRError( $result ); 17 17 } 18 18 … … 25 25 ) ) ); 26 26 27 $this->assertI nstanceOf( 'IXR_Error',$result );27 $this->assertIXRError( $result ); 28 28 $this->assertEquals( 403, $result->code ); 29 29 } … … 41 41 ) ) ); 42 42 43 $this->assertI nstanceOf( 'IXR_Error',$result );43 $this->assertIXRError( $result ); 44 44 $this->assertEquals( 403, $result->code ); 45 45 } … … 55 55 // First time it's a valid comment 56 56 $result = $this->myxmlrpcserver->wp_newComment( $comment_args ); 57 $this->assertNotI nstanceOf( 'IXR_Error',$result );57 $this->assertNotIXRError( $result ); 58 58 59 59 // Run second time for duplication error 60 60 $result = $this->myxmlrpcserver->wp_newComment( $comment_args ); 61 61 62 $this->assertI nstanceOf( 'IXR_Error',$result );62 $this->assertIXRError( $result ); 63 63 $this->assertEquals( 403, $result->code ); 64 64 } -
trunk/tests/phpunit/tests/xmlrpc/wp/newPost.php
r38382 r40417 8 8 function test_invalid_username_password() { 9 9 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'username', 'password', array() ) ); 10 $this->assertI nstanceOf( 'IXR_Error',$result );10 $this->assertIXRError( $result ); 11 11 $this->assertEquals( 403, $result->code ); 12 12 } … … 16 16 17 17 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'subscriber', 'subscriber', array() ) ); 18 $this->assertI nstanceOf( 'IXR_Error',$result );18 $this->assertIXRError( $result ); 19 19 $this->assertEquals( 401, $result->code ); 20 20 } … … 24 24 25 25 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', array() ) ); 26 $this->assertI nstanceOf( 'IXR_Error',$result );26 $this->assertIXRError( $result ); 27 27 $this->assertEquals( 500, $result->code ); 28 28 $this->assertEquals( 'Content, title, and excerpt are empty.', $result->message ); … … 34 34 $post = array( 'post_title' => 'Test' ); 35 35 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) ); 36 $this->assertNotI nstanceOf( 'IXR_Error',$result );36 $this->assertNotIXRError( $result ); 37 37 $this->assertStringMatchesFormat( '%d', $result ); 38 38 } … … 43 43 $post = array( 'post_title' => 'Test', 'ID' => 103948 ); 44 44 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) ); 45 $this->assertNotI nstanceOf( 'IXR_Error',$result );45 $this->assertNotIXRError( $result ); 46 46 $this->assertNotEquals( '103948', $result ); 47 47 } … … 52 52 $post = array( 'post_title' => 'Test', 'post_status' => 'publish' ); 53 53 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) ); 54 $this->assertNotI nstanceOf( 'IXR_Error',$result );54 $this->assertNotIXRError( $result ); 55 55 } 56 56 … … 60 60 $post = array( 'post_title' => 'Test', 'post_status' => 'publish' ); 61 61 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) ); 62 $this->assertI nstanceOf( 'IXR_Error',$result );62 $this->assertIXRError( $result ); 63 63 $this->assertEquals( 401, $result->code ); 64 64 } … … 69 69 $post = array( 'post_title' => 'Test', 'post_status' => 'private' ); 70 70 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) ); 71 $this->assertNotI nstanceOf( 'IXR_Error',$result );71 $this->assertNotIXRError( $result ); 72 72 } 73 73 … … 77 77 $post = array( 'post_title' => 'Test', 'post_status' => 'private' ); 78 78 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) ); 79 $this->assertI nstanceOf( 'IXR_Error',$result );79 $this->assertIXRError( $result ); 80 80 $this->assertEquals( 401, $result->code ); 81 81 } … … 87 87 $post = array( 'post_title' => 'Test', 'post_author' => $other_author_id ); 88 88 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) ); 89 $this->assertNotI nstanceOf( 'IXR_Error',$result );89 $this->assertNotIXRError( $result ); 90 90 } 91 91 … … 96 96 $post = array( 'post_title' => 'Test', 'post_author' => $other_author_id ); 97 97 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) ); 98 $this->assertI nstanceOf( 'IXR_Error',$result );98 $this->assertIXRError( $result ); 99 99 $this->assertEquals( 401, $result->code ); 100 100 } … … 105 105 $post = array( 'post_title' => 'Test', 'post_author' => 99999999 ); 106 106 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) ); 107 $this->assertI nstanceOf( 'IXR_Error',$result );107 $this->assertIXRError( $result ); 108 108 $this->assertEquals( 404, $result->code ); 109 109 } … … 114 114 $post = array( 'post_title' => 'Test' ); 115 115 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) ); 116 $this->assertNotI nstanceOf( 'IXR_Error',$result );116 $this->assertNotIXRError( $result ); 117 117 $this->assertStringMatchesFormat( '%d', $result ); 118 118 … … 133 133 $post = array( 'post_title' => 'Post Thumbnail Test', 'post_thumbnail' => $attachment_id ); 134 134 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) ); 135 $this->assertNotI nstanceOf( 'IXR_Error',$result );135 $this->assertNotIXRError( $result ); 136 136 $this->assertEquals( $attachment_id, get_post_meta( $result, '_thumbnail_id', true ) ); 137 137 … … 144 144 $post = array( 'post_title' => 'Test', 'post_status' => 'foobar_status' ); 145 145 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'author', 'author', $post ) ); 146 $this->assertNotI nstanceOf( 'IXR_Error',$result );146 $this->assertNotIXRError( $result ); 147 147 $this->assertEquals( 'draft', get_post_status( $result ) ); 148 148 } … … 153 153 $post = array( 'post_title' => 'Test', 'sticky' => true ); 154 154 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'contributor', 'contributor', $post ) ); 155 $this->assertI nstanceOf( 'IXR_Error',$result );155 $this->assertIXRError( $result ); 156 156 $this->assertEquals( 401, $result->code ); 157 157 } … … 162 162 $post = array( 'post_title' => 'Test', 'sticky' => true ); 163 163 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) ); 164 $this->assertNotI nstanceOf( 'IXR_Error',$result );164 $this->assertNotIXRError( $result ); 165 165 $this->assertTrue( is_sticky( $result ) ); 166 166 } … … 171 171 $post = array( 'post_title' => 'Test', 'post_status' => 'private', 'sticky' => true ); 172 172 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) ); 173 $this->assertI nstanceOf( 'IXR_Error',$result );173 $this->assertIXRError( $result ); 174 174 $this->assertEquals( 401, $result->code ); 175 175 } … … 180 180 $post = array( 'post_title' => 'Test', 'post_format' => 'quote' ); 181 181 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) ); 182 $this->assertNotI nstanceOf( 'IXR_Error',$result );182 $this->assertNotIXRError( $result ); 183 183 $this->assertEquals( 'quote', get_post_format( $result ) ); 184 184 } … … 189 189 $post = array( 'post_title' => 'Test', 'post_format' => 'tumblr' ); 190 190 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) ); 191 $this->assertNotI nstanceOf( 'IXR_Error',$result );191 $this->assertNotIXRError( $result ); 192 192 $this->assertEquals( '', get_post_format( $result ) ); 193 193 } … … 203 203 ); 204 204 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) ); 205 $this->assertI nstanceOf( 'IXR_Error',$result );205 $this->assertIXRError( $result ); 206 206 $this->assertEquals( 401, $result->code ); 207 207 … … 213 213 ); 214 214 $result2 = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post2 ) ); 215 $this->assertI nstanceOf( 'IXR_Error',$result2 );215 $this->assertIXRError( $result2 ); 216 216 $this->assertEquals( 401, $result2->code ); 217 217 } … … 227 227 ); 228 228 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) ); 229 $this->assertI nstanceOf( 'IXR_Error',$result );229 $this->assertIXRError( $result ); 230 230 $this->assertEquals( 403, $result->code ); 231 231 } … … 248 248 ); 249 249 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) ); 250 $this->assertNotI nstanceOf( 'IXR_Error',$result );250 $this->assertNotIXRError( $result ); 251 251 252 252 $post_tags = wp_get_object_terms( $result, 'post_tag', array( 'fields' => 'ids' ) ); … … 275 275 ); 276 276 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post ) ); 277 $this->assertNotI nstanceOf( 'IXR_Error',$result );277 $this->assertNotIXRError( $result ); 278 278 // verify that cat2 was created 279 279 $cat2 = get_term_by( 'name', $cat2_name, 'category' ); … … 292 292 ); 293 293 $result2 = $this->myxmlrpcserver->wp_newPost( array( 1, 'editor', 'editor', $post2 ) ); 294 $this->assertI nstanceOf( 'IXR_Error',$result2 );294 $this->assertIXRError( $result2 ); 295 295 $this->assertEquals( 401, $result2->code ); 296 296 } -
trunk/tests/phpunit/tests/xmlrpc/wp/newTerm.php
r39189 r40417 16 16 function test_invalid_username_password() { 17 17 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'username', 'password', array() ) ); 18 $this->assertI nstanceOf( 'IXR_Error',$result );18 $this->assertIXRError( $result ); 19 19 $this->assertEquals( 403, $result->code ); 20 20 } … … 24 24 25 25 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => '' ) ) ); 26 $this->assertI nstanceOf( 'IXR_Error',$result );26 $this->assertIXRError( $result ); 27 27 $this->assertEquals( 403, $result->code ); 28 28 $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message ); … … 33 33 34 34 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'not_existing' ) ) ); 35 $this->assertI nstanceOf( 'IXR_Error',$result );35 $this->assertIXRError( $result ); 36 36 $this->assertEquals( 403, $result->code ); 37 37 $this->assertEquals( __( 'Invalid taxonomy.' ), $result->message ); … … 42 42 43 43 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'subscriber', 'subscriber', array( 'taxonomy' => 'category' ) ) ); 44 $this->assertI nstanceOf( 'IXR_Error',$result );44 $this->assertIXRError( $result ); 45 45 $this->assertEquals( 401, $result->code ); 46 46 $this->assertEquals( __( 'Sorry, you are not allowed to create terms in this taxonomy.' ), $result->message ); … … 51 51 52 52 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'name' => '' ) ) ); 53 $this->assertI nstanceOf( 'IXR_Error',$result );53 $this->assertIXRError( $result ); 54 54 $this->assertEquals( 403, $result->code ); 55 55 $this->assertEquals( __( 'The term name cannot be empty.' ), $result->message ); … … 60 60 61 61 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'post_tag', 'parent' => self::$parent_term_id, 'name' => 'test' ) ) ); 62 $this->assertI nstanceOf( 'IXR_Error',$result );62 $this->assertIXRError( $result ); 63 63 $this->assertEquals( 403, $result->code ); 64 64 $this->assertEquals( __( 'This taxonomy is not hierarchical.' ), $result->message ); … … 69 69 70 70 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => 'dasda', 'name' => 'test' ) ) ); 71 $this->assertI nstanceOf( 'IXR_Error',$result );71 $this->assertIXRError( $result ); 72 72 $this->assertEquals( 500, $result->code ); 73 73 } … … 77 77 78 78 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => 9999, 'name' => 'test' ) ) ); 79 $this->assertI nstanceOf( 'IXR_Error',$result );79 $this->assertIXRError( $result ); 80 80 $this->assertEquals( 403, $result->code ); 81 81 $this->assertEquals( __( 'Parent term does not exist.' ), $result->message ); … … 87 87 88 88 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'name' => 'test' ) ) ); 89 $this->assertNotI nstanceOf( 'IXR_Error',$result );89 $this->assertNotIXRError( $result ); 90 90 $this->assertStringMatchesFormat( '%d', $result ); 91 91 } … … 95 95 96 96 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', array( 'taxonomy' => 'category', 'parent' => self::$parent_term_id, 'name' => 'test' ) ) ); 97 $this->assertNotI nstanceOf( 'IXR_Error',$result );97 $this->assertNotIXRError( $result ); 98 98 $this->assertStringMatchesFormat( '%d', $result ); 99 99 } … … 104 104 $taxonomy = array( 'taxonomy' => 'category', 'parent' => self::$parent_term_id, 'name' => 'test_all', 'description' => 'Test all', 'slug' => 'test_all' ); 105 105 $result = $this->myxmlrpcserver->wp_newTerm( array( 1, 'editor', 'editor', $taxonomy ) ); 106 $this->assertNotI nstanceOf( 'IXR_Error',$result );106 $this->assertNotIXRError( $result ); 107 107 $this->assertStringMatchesFormat( '%d', $result ); 108 108 } -
trunk/tests/phpunit/tests/xmlrpc/wp/restoreRevision.php
r35242 r40417 24 24 function test_invalid_username_password() { 25 25 $result = $this->myxmlrpcserver->wp_restoreRevision( array( 1, 'username', 'password', $this->revision_id ) ); 26 $this->assertI nstanceOf( 'IXR_Error',$result );26 $this->assertIXRError( $result ); 27 27 $this->assertEquals( 403, $result->code ); 28 28 } … … 32 32 33 33 $result = $this->myxmlrpcserver->wp_restoreRevision( array( 1, 'subscriber', 'subscriber', $this->revision_id ) ); 34 $this->assertI nstanceOf( 'IXR_Error',$result );34 $this->assertIXRError( $result ); 35 35 $this->assertEquals( 401, $result->code ); 36 36 } … … 40 40 41 41 $result = $this->myxmlrpcserver->wp_restoreRevision( array( 1, 'editor', 'editor', $this->revision_id ) ); 42 $this->assertNotI nstanceOf( 'IXR_Error',$result );42 $this->assertNotIXRError( $result ); 43 43 } 44 44 -
trunk/tests/phpunit/tests/xmlrpc/wp/uploadFile.php
r34604 r40417 26 26 27 27 $result = $this->myxmlrpcserver->mw_newMediaObject( array( 0, 'editor', 'editor', $data ) ); 28 $this->assertNotI nstanceOf( 'IXR_Error',$result );28 $this->assertNotIXRError( $result ); 29 29 30 30 // check data types
Note: See TracChangeset
for help on using the changeset viewer.