Changeset 35498 for trunk/tests/phpunit/tests/media.php
- Timestamp:
- 11/04/2015 12:21:23 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/media.php
r35479 r35498 786 786 foreach ( $sizes as $size ) { 787 787 $size_array = $this->_get_image_size_array_from_name( $size ); 788 $image_url = wp_get_attachment_image_url( self::$large_id, $size );788 $image_url = wp_get_attachment_image_url( $id, $size ); 789 789 $this->assertSame( $expected, wp_calculate_image_srcset( $image_url, $size_array, $image_meta ) ); 790 790 } 791 792 // Remove the attachment 793 wp_delete_attachment( $id ); 791 794 792 795 // Leave the uploads option the way you found it. … … 801 804 // Start by getting the attachment metadata. 802 805 $image_meta = wp_get_attachment_metadata( self::$large_id ); 803 $image_url = wp_get_attachment_image_url( self::$large_id );806 $image_url = wp_get_attachment_image_url( self::$large_id, 'medium' ); 804 807 $size_array = $this->_get_image_size_array_from_name( 'medium' ); 805 808 … … 807 810 $hash = 'e' . time() . rand(100, 999); 808 811 812 $filename_base = basename( $image_meta['file'], '.png' ); 813 814 // Add the hash to the image URL 815 $image_url = str_replace( $filename_base, $filename_base . '-' . $hash, $image_url ); 816 809 817 // Replace file paths for full and medium sizes with hashed versions. 810 $filename_base = basename( $image_meta['file'], '.png' );811 818 $image_meta['file'] = str_replace( $filename_base, $filename_base . '-' . $hash, $image_meta['file'] ); 812 819 $image_meta['sizes']['medium']['file'] = str_replace( $filename_base, $filename_base . '-' . $hash, $image_meta['sizes']['medium']['file'] );
Note: See TracChangeset
for help on using the changeset viewer.