Changeset 52389 for trunk/tests/phpunit/tests/image/intermediateSize.php
- Timestamp:
- 12/19/2021 01:42:37 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/image/intermediateSize.php
r52010 r52389 182 182 */ 183 183 public function test_get_intermediate_sizes_by_array_zero_height() { 184 // Generate randomwidth.185 $ random_w = rand( 300, 400 );184 // Use this width. 185 $width = 300; 186 186 187 187 // Only one dimention match shouldn't return false positive (see: #17626). 188 add_image_size( 'test-size', $ random_w, 0, false );189 add_image_size( 'false-height', $ random_w, 100, true );188 add_image_size( 'test-size', $width, 0, false ); 189 add_image_size( 'false-height', $width, 100, true ); 190 190 191 191 $file = DIR_TESTDATA . '/images/waffles.jpg'; … … 193 193 194 194 $original = wp_get_attachment_metadata( $id ); 195 $image_w = $ random_w;195 $image_w = $width; 196 196 $image_h = round( ( $image_w / $original['width'] ) * $original['height'] ); 197 197 198 198 // Look for a size by array that exists. 199 199 // Note: Staying larger than 300px to miss default medium crop. 200 $image = image_get_intermediate_size( $id, array( $ random_w, 0 ) );200 $image = image_get_intermediate_size( $id, array( $width, 0 ) ); 201 201 202 202 // Test for the expected string because the array will by definition
Note: See TracChangeset
for help on using the changeset viewer.