WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/16/2016 05:47:41 PM (5 years ago)
Author:
ocean90
Message:

Responsive images: Skip images with a missing $image_meta['file'] value.

Props joemcgill.
See [37002].
Fixes #35480.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/media.php

    r37002 r37018  
    11851185
    11861186        // File name is incorrect
     1187        $image_meta3 = $image_meta;
     1188        $image_meta3['file'] = '/';
     1189        $this->assertFalse( wp_calculate_image_srcset( $size_array, $image_src, $image_meta3 ) );
     1190
     1191        // File name is incorrect
    11871192        $image_meta4 = $image_meta;
    1188         $image_meta4['file'] = '/';
     1193        unset( $image_meta4['file'] );
    11891194        $this->assertFalse( wp_calculate_image_srcset( $size_array, $image_src, $image_meta4 ) );
    11901195
    11911196        // Intermediate size is string instead of array.
    1192         $image_meta3 = $image_meta;
    1193         $image_meta3['sizes']['medium_large'] = '';
     1197        $image_meta5 = $image_meta;
     1198        $image_meta5['sizes']['medium_large'] = '';
    11941199        unset( $srcset[768] );
    11951200        $expected_srcset = implode( ', ', $srcset );
    1196         $this->assertSame( $expected_srcset, wp_calculate_image_srcset( $size_array, $image_src, $image_meta3 ) );
     1201        $this->assertSame( $expected_srcset, wp_calculate_image_srcset( $size_array, $image_src, $image_meta5 ) );
    11971202    }
    11981203
Note: See TracChangeset for help on using the changeset viewer.