Changeset 40417 for trunk/tests/phpunit/tests/xmlrpc/wp/editPost.php
- Timestamp:
- 04/12/2017 02:58:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.