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