Changeset 48170 for trunk/tests/phpunit/tests/media.php
- Timestamp:
- 06/25/2020 06:43:25 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/media.php
r48121 r48170 1964 1964 /** 1965 1965 * @ticket 33641 1966 * @ticket 50367 1966 1967 */ 1967 1968 function test_wp_filter_content_tags() { … … 1983 1984 $img_html5 = str_replace( ' />', '>', $img ); 1984 1985 1986 $hwstring = image_hwstring( $size_array[0], $size_array[1] ); 1987 1985 1988 // Manually add srcset and sizes to the markup from get_image_tag(). 1986 1989 $respimg = preg_replace( '|<img ([^>]+) />|', '<img $1 ' . $srcset . ' ' . $sizes . ' />', $img ); 1987 1990 $respimg_no_size_in_class = preg_replace( '|<img ([^>]+) />|', '<img $1 ' . $srcset . ' ' . $sizes . ' />', $img_no_size_in_class ); 1988 $respimg_no_width_height = preg_replace( '|<img ([^>]+) />|', '<img $1 ' . $ srcset . ' ' . $sizes . ' />', $img_no_width_height );1991 $respimg_no_width_height = preg_replace( '|<img ([^>]+) />|', '<img $1 ' . $hwstring . $srcset . ' ' . $sizes . ' />', $img_no_width_height ); 1989 1992 $respimg_with_sizes_attr = preg_replace( '|<img ([^>]+) />|', '<img $1 ' . $srcset . ' />', $img_with_sizes_attr ); 1990 1993 $respimg_xhtml = preg_replace( '|<img ([^>]+)/>|', '<img $1 ' . $srcset . ' ' . $sizes . ' />', $img_xhtml ); … … 1998 2001 %2$s 1999 2002 2000 <p>Image, no width and height attributes. Should have srcset and sizes (from matching the file name).</p>2003 <p>Image, no width and height attributes. Should have width, height, srcset and sizes (from matching the file name).</p> 2001 2004 %3$s 2002 2005 … … 2531 2534 /** 2532 2535 * @ticket 44427 2536 * @ticket 50367 2533 2537 */ 2534 2538 function test_wp_lazy_load_content_media() { 2535 $img = get_image_tag( self::$large_id, '', '', '', 'medium' ); 2536 $img_xhtml = str_replace( ' />', '/>', $img ); 2537 $img_html5 = str_replace( ' />', '>', $img ); 2538 $iframe = '<iframe src="https://www.example.com"></iframe>'; 2539 $image_meta = wp_get_attachment_metadata( self::$large_id ); 2540 $size_array = $this->_get_image_size_array_from_meta( $image_meta, 'medium' ); 2541 2542 $img = get_image_tag( self::$large_id, '', '', '', 'medium' ); 2543 $img_xhtml = str_replace( ' />', '/>', $img ); 2544 $img_html5 = str_replace( ' />', '>', $img ); 2545 $img_no_width_height = str_replace( ' width="' . $size_array[0] . '"', '', $img ); 2546 $img_no_width_height = str_replace( ' height="' . $size_array[1] . '"', '', $img_no_width_height ); 2547 $iframe = '<iframe src="https://www.example.com"></iframe>'; 2539 2548 2540 2549 $lazy_img = wp_img_tag_add_loading_attr( $img, 'test' ); … … 2552 2561 <p>Image, HTML 5.0 style.</p> 2553 2562 %3$s 2554 <p>Image, with pre-existing "loading" attribute.</p> 2563 <p>Image, with pre-existing "loading" attribute. Should not be modified.</p> 2564 %4$s 2565 <p>Image, without dimension attributes. Should not be modified.</p> 2555 2566 %5$s 2556 2567 <p>Iframe, standard. Should not be modified.</p> 2557 % 4$s';2558 2559 $content_unfiltered = sprintf( $content, $img, $img_xhtml, $img_html5, $i frame, $img_eager);2560 $content_filtered = sprintf( $content, $lazy_img, $lazy_img_xhtml, $lazy_img_html5, $i frame, $img_eager);2568 %6$s'; 2569 2570 $content_unfiltered = sprintf( $content, $img, $img_xhtml, $img_html5, $img_eager, $img_no_width_height, $iframe ); 2571 $content_filtered = sprintf( $content, $lazy_img, $lazy_img_xhtml, $lazy_img_html5, $img_eager, $img_no_width_height, $iframe ); 2561 2572 2562 2573 // Do not add srcset and sizes.
Note: See TracChangeset
for help on using the changeset viewer.