Changeset 41732 for trunk/tests/phpunit/tests/image/header.php
- Timestamp:
- 10/04/2017 02:58:07 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/image/header.php
r41017 r41732 138 138 } 139 139 140 /** 141 * @ticket 21819 142 */ 143 function test_check_get_previous_crop() { 144 $id = wp_insert_attachment( array( 145 'post_status' => 'publish', 146 'post_title' => 'foo.png', 147 'post_type' => 'post', 148 'guid' => 'http://localhost/foo.png' 149 ) ); 150 151 // Create inital crop object. 152 $cropped_1 = 'foo-cropped-1.png'; 153 $object = $this->custom_image_header->create_attachment_object( $cropped_1, $id ); 154 155 // Ensure no previous crop exists. 156 $previous = $this->custom_image_header->get_previous_crop( $object ); 157 $this->assertFalse( $previous ); 158 159 // Create the inital crop attachment and set it as the header. 160 $cropped_1_id = $this->custom_image_header->insert_attachment( $object, $cropped_1 ); 161 $key = '_wp_attachment_custom_header_last_used_' . get_stylesheet(); 162 update_post_meta( $cropped_1_id, $key, time() ); 163 update_post_meta( $cropped_1_id, '_wp_attachment_is_custom_header', get_stylesheet() ); 164 165 // Create second crop. 166 $cropped_2 = 'foo-cropped-2.png'; 167 $object = $this->custom_image_header->create_attachment_object( $cropped_2, $id ); 168 169 // Test that a previous crop is found. 170 $previous = $this->custom_image_header->get_previous_crop( $object ); 171 $this->assertSame( $previous, $cropped_1_id ); 172 } 140 173 }
Note: See TracChangeset
for help on using the changeset viewer.