diff --git tests/phpunit/tests/media.php tests/phpunit/tests/media.php
index 67158d7..bab45cf 100644
|
|
|
EOF;
|
| 961 | 961 | $img_no_width_height = str_replace( ' width="' . $size_array[0] . '"', '', $img ); |
| 962 | 962 | $img_no_width_height = str_replace( ' height="' . $size_array[1] . '"', '', $img_no_width_height ); |
| 963 | 963 | $img_no_size_id = str_replace( 'wp-image-', 'id-', $img ); |
| | 964 | $img_with_sizes_attr = str_replace( '<img ', '<img sizes="99vw" ', $img ); |
| 964 | 965 | |
| 965 | 966 | // Manually add srcset and sizes to the markup from get_image_tag(); |
| 966 | 967 | $respimg = preg_replace( '|<img ([^>]+) />|', '<img $1 ' . $srcset . ' ' . $sizes . ' />', $img ); |
| 967 | 968 | $respimg_no_size_in_class = preg_replace( '|<img ([^>]+) />|', '<img $1 ' . $srcset . ' ' . $sizes . ' />', $img_no_size_in_class ); |
| 968 | 969 | $respimg_no_width_height = preg_replace( '|<img ([^>]+) />|', '<img $1 ' . $srcset . ' ' . $sizes . ' />', $img_no_width_height ); |
| | 970 | $respimg_with_sizes_attr = preg_replace('|<img ([^>]+) />|', '<img $1 ' . $srcset . ' />', $img_with_sizes_attr ); |
| 969 | 971 | |
| 970 | 972 | $content = ' |
| 971 | 973 | <p>Image, standard. Should have srcset and sizes.</p> |
| … |
… |
EOF;
|
| 978 | 980 | %3$s |
| 979 | 981 | |
| 980 | 982 | <p>Image, no attachment ID class. Should NOT have srcset and sizes.</p> |
| 981 | | %4$s'; |
| | 983 | %4$s |
| 982 | 984 | |
| 983 | | $content_unfiltered = sprintf( $content, $img, $img_no_size_in_class, $img_no_width_height, $img_no_size_id ); |
| 984 | | $content_filtered = sprintf( $content, $respimg, $respimg_no_size_in_class, $respimg_no_width_height, $img_no_size_id ); |
| | 985 | <p>Image, with sizes attribute. Should NOT have two sizes attributes.</p> |
| | 986 | %5$s'; |
| | 987 | |
| | 988 | $content_unfiltered = sprintf( $content, $img, $img_no_size_in_class, $img_no_width_height, $img_no_size_id, $img_with_sizes_attr ); |
| | 989 | $content_filtered = sprintf( $content, $respimg, $respimg_no_size_in_class, $respimg_no_width_height, $img_no_size_id, $respimg_with_sizes_attr ); |
| 985 | 990 | |
| 986 | 991 | $this->assertSame( $content_filtered, wp_make_content_images_responsive( $content_unfiltered ) ); |
| 987 | 992 | } |