Changeset 35309 for trunk/tests/phpunit/tests/xmlrpc/wp/getMediaItem.php
- Timestamp:
- 10/21/2015 01:58:52 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/xmlrpc/wp/getMediaItem.php
r25002 r35309 23 23 $contents = file_get_contents( $filename ); 24 24 $upload = wp_upload_bits(basename($filename), null, $contents); 25 $mime = wp_check_filetype( $filename );26 $this->attachment_data = array(27 'post_title' => basename( $upload['file'] ),28 'post_content' => '',29 'post_type' => 'attachment',30 'post_parent' => $this->post_id,31 'post_mime_type' => $mime['type'],32 'guid' => $upload[ 'url' ]33 );34 25 35 $id = wp_insert_attachment( $this->attachment_data, $upload[ 'file' ], $this->post_id ); 36 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); 37 $this->attachment_id = $id; 26 $this->attachment_id = $this->_make_attachment( $upload, $this->post_id ); 27 $this->attachment_data = get_post( $this->attachment_id, ARRAY_A ); 38 28 39 29 set_post_thumbnail( $this->post_id, $this->attachment_id ); … … 42 32 function tearDown() { 43 33 remove_theme_support( 'post-thumbnails' ); 34 35 $this->remove_added_uploads(); 44 36 45 37 parent::tearDown();
Note: See TracChangeset
for help on using the changeset viewer.