Changeset 57755 for trunk/tests/phpunit/tests/image/header.php
- Timestamp:
- 03/02/2024 08:13:02 PM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/image/header.php
r56548 r57755 109 109 } 110 110 111 public function test_create_attachment_object() {112 $id = wp_insert_attachment(113 array(114 'post_status' => 'publish',115 'post_title' => 'foo.png',116 'post_type' => 'post',117 'guid' => 'http://localhost/foo.png',118 )119 );120 121 $cropped = 'foo-cropped.png';122 123 $object = $this->custom_image_header->create_attachment_object( $cropped, $id );124 $this->assertSame( 'foo-cropped.png', $object['post_title'] );125 $this->assertSame( 'http://localhost/' . $cropped, $object['guid'] );126 $this->assertSame( 'custom-header', $object['context'] );127 $this->assertSame( 'image/jpeg', $object['post_mime_type'] );128 }129 130 111 public function test_insert_cropped_attachment() { 131 112 $id = wp_insert_attachment( … … 139 120 140 121 $cropped = 'foo-cropped.png'; 141 $object = $this->custom_image_header->create_attachment_object( $cropped, $id);122 $object = wp_copy_parent_attachment_properties( $cropped, $id, 'custom-header' ); 142 123 143 124 $cropped_id = $this->custom_image_header->insert_attachment( $object, $cropped ); … … 162 143 // Create inital crop object. 163 144 $cropped_1 = 'foo-cropped-1.png'; 164 $object = $this->custom_image_header->create_attachment_object( $cropped_1, $id);145 $object = wp_copy_parent_attachment_properties( $cropped_1, $id, 'custom-header' ); 165 146 166 147 // Ensure no previous crop exists. … … 176 157 // Create second crop. 177 158 $cropped_2 = 'foo-cropped-2.png'; 178 $object = $this->custom_image_header->create_attachment_object( $cropped_2, $id );159 $object = wp_copy_parent_attachment_properties( $cropped_2, $id ); 179 160 180 161 // Test that a previous crop is found.
Note: See TracChangeset
for help on using the changeset viewer.