Changeset 42343 for trunk/tests/phpunit/tests/ajax/MediaEdit.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/ajax/MediaEdit.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/ajax/MediaEdit.php
r39173 r42343 31 31 32 32 $filename = DIR_TESTDATA . '/images/canola.jpg'; 33 $contents = file_get_contents( $filename);33 $contents = file_get_contents( $filename ); 34 34 35 $upload = wp_upload_bits( basename($filename), null, $contents);36 $id = $this->_make_attachment($upload);35 $upload = wp_upload_bits( basename( $filename ), null, $contents ); 36 $id = $this->_make_attachment( $upload ); 37 37 38 $_REQUEST['action'] = 'image-editor';38 $_REQUEST['action'] = 'image-editor'; 39 39 $_REQUEST['context'] = 'edit-attachment'; 40 $_REQUEST['postid'] = $id;41 $_REQUEST['target'] = 'thumbnail';42 $_REQUEST['do'] = 'save';40 $_REQUEST['postid'] = $id; 41 $_REQUEST['target'] = 'thumbnail'; 42 $_REQUEST['do'] = 'save'; 43 43 $_REQUEST['history'] = '[{"c":{"x":5,"y":8,"w":289,"h":322}}]'; 44 44 45 $media_meta = wp_get_attachment_metadata( $id);46 $this->assertArrayHasKey( 'sizes', $media_meta, 'attachment should have size data');47 $this->assertArrayHasKey( 'medium', $media_meta['sizes'], 'attachment should have data for medium size');48 $ret = wp_save_image( $id);45 $media_meta = wp_get_attachment_metadata( $id ); 46 $this->assertArrayHasKey( 'sizes', $media_meta, 'attachment should have size data' ); 47 $this->assertArrayHasKey( 'medium', $media_meta['sizes'], 'attachment should have data for medium size' ); 48 $ret = wp_save_image( $id ); 49 49 50 $media_meta = wp_get_attachment_metadata( $id);51 $this->assertArrayHasKey( 'sizes', $media_meta, 'cropped attachment should have size data');52 $this->assertArrayHasKey( 'medium', $media_meta['sizes'], 'cropped attachment should have data for medium size');50 $media_meta = wp_get_attachment_metadata( $id ); 51 $this->assertArrayHasKey( 'sizes', $media_meta, 'cropped attachment should have size data' ); 52 $this->assertArrayHasKey( 'medium', $media_meta['sizes'], 'cropped attachment should have data for medium size' ); 53 53 } 54 54 … … 65 65 66 66 $upload = wp_upload_bits( basename( $filename ), null, $contents ); 67 $id = $this->_make_attachment( $upload );67 $id = $this->_make_attachment( $upload ); 68 68 69 $_REQUEST['action'] = 'image-editor';69 $_REQUEST['action'] = 'image-editor'; 70 70 $_REQUEST['context'] = 'edit-attachment'; 71 $_REQUEST['postid'] = $id;72 $_REQUEST['target'] = 'all';73 $_REQUEST['do'] = 'save';71 $_REQUEST['postid'] = $id; 72 $_REQUEST['target'] = 'all'; 73 $_REQUEST['do'] = 'save'; 74 74 $_REQUEST['history'] = '[{"c":{"x":5,"y":8,"w":289,"h":322}}]'; 75 75 … … 77 77 78 78 $media_meta = wp_get_attachment_metadata( $id ); 79 $sizes1 = $media_meta['sizes'];79 $sizes1 = $media_meta['sizes']; 80 80 81 81 $_REQUEST['history'] = '[{"c":{"x":5,"y":8,"w":189,"h":322}}]'; … … 84 84 85 85 $media_meta = wp_get_attachment_metadata( $id ); 86 $sizes2 = $media_meta['sizes'];86 $sizes2 = $media_meta['sizes']; 87 87 88 88 $file_path = dirname( get_attached_file( $id ) );
Note: See TracChangeset
for help on using the changeset viewer.