Changeset 697 in tests
- Timestamp:
- 04/25/2012 02:22:31 PM (14 years ago)
- File:
-
- 1 edited
-
wp-testcase/test-xmlrpc-api/test_wp_editPost.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-testcase/test-xmlrpc-api/test_wp_editPost.php
r684 r697 4 4 5 5 function test_invalid_username_password() { 6 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'username', 'password' ) );6 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'username', 'password', 0, array() ) ); 7 7 $this->assertInstanceOf( 'IXR_Error', $result ); 8 8 $this->assertEquals( 403, $result->code ); … … 139 139 } 140 140 141 function test_edit_custom_fields() { 142 $contributor_id = get_user_by( 'login', 'contributor' )->ID; 143 $post = array( 'post_title' => 'Post test', 'post_author' => $contributor_id ); 144 $post_id = wp_insert_post( $post ); 145 $mid_edit = add_post_meta( $post_id, 'custom_field_key', '12345678' ); 146 $mid_delete = add_post_meta( $post_id, 'custom_field_to_delete', '12345678' ); 147 148 $new_title = 'Post test (updated)'; 149 $post2 = array( 150 'post_title' => $new_title, 151 'custom_fields' => 152 array( 153 array( 'id' => $mid_delete ), 154 array( 'id' => $mid_edit, 'key' => 'custom_field_key', 'value' => '87654321' ), 155 ) 156 ); 157 158 $result = $this->myxmlrpcserver->wp_editPost( array( 1, 'contributor', 'contributor', $post_id, $post2 ) ); 159 $this->assertNotInstanceOf( 'IXR_Error', $result ); 160 $this->assertTrue($result); 161 162 $out = wp_get_single_post( $post_id ); 163 $this->assertEquals( $new_title, $out->post_title ); 164 165 $edited_object = get_metadata_by_mid( 'post', $mid_edit ); 166 $this->assertEquals( '87654321', $edited_object->meta_value ); 167 $this->assertFalse( get_metadata_by_mid( 'post', $mid_delete ) ); 168 } 169 141 170 }
Note: See TracChangeset
for help on using the changeset viewer.