Changeset 55935 for trunk/tests/phpunit/tests/ajax/wpAjaxImageEditor.php
- Timestamp:
- 06/18/2023 02:22:40 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/ajax/wpAjaxImageEditor.php
r55859 r55935 27 27 $this->remove_added_uploads(); 28 28 parent::tear_down(); 29 }30 31 /**32 * @ticket 2298533 * @requires function imagejpeg34 *35 * @covers ::wp_insert_attachment36 * @covers ::wp_save_image37 */38 public function testCropImageThumbnail() {39 require_once ABSPATH . 'wp-admin/includes/image-edit.php';40 41 $filename = DIR_TESTDATA . '/images/canola.jpg';42 $contents = file_get_contents( $filename );43 44 $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );45 $id = $this->_make_attachment( $upload );46 47 $_REQUEST['action'] = 'image-editor';48 $_REQUEST['context'] = 'edit-attachment';49 $_REQUEST['postid'] = $id;50 $_REQUEST['target'] = 'thumbnail';51 $_REQUEST['do'] = 'save';52 $_REQUEST['history'] = '[{"c":{"x":5,"y":8,"w":289,"h":322}}]';53 54 $media_meta = wp_get_attachment_metadata( $id );55 $this->assertArrayHasKey( 'sizes', $media_meta, 'attachment should have size data' );56 $this->assertArrayHasKey( 'medium', $media_meta['sizes'], 'attachment should have data for medium size' );57 $ret = wp_save_image( $id );58 59 $media_meta = wp_get_attachment_metadata( $id );60 $this->assertArrayHasKey( 'sizes', $media_meta, 'cropped attachment should have size data' );61 $this->assertArrayHasKey( 'medium', $media_meta['sizes'], 'cropped attachment should have data for medium size' );62 29 } 63 30
Note: See TracChangeset
for help on using the changeset viewer.