Changeset 53481 for trunk/tests/phpunit/tests/media.php
- Timestamp:
- 06/09/2022 04:19:39 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/media.php
r53480 r53481 2531 2531 2532 2532 $html = '<img src="%1$s" alt="" width="%2$d" height="%3$d" class="align%4$s size-medium wp-image-%5$d" />'; 2533 $expected = sprintf( $html, $attachment[0], $attachment[1], $attachment[2], $align, $id ); 2533 $expected = sprintf( 2534 $html, 2535 $attachment[0], 2536 $attachment[1], 2537 $attachment[2], 2538 $align, 2539 $id 2540 ); 2534 2541 2535 2542 $this->assertSame( $expected, get_image_send_to_editor( $id, $caption, $title, $align ) ); … … 2557 2564 $html = '[caption id="attachment_%9$d" align="align%7$s" width="%5$d"]' . $html . ' %10$s[/caption]'; 2558 2565 2559 $expected = sprintf( $html, $url, 'attachment wp-att-' . $id, $attachment[0], $alt, $attachment[1], $attachment[2], $align, $size, $id, $caption ); 2566 $expected = sprintf( 2567 $html, 2568 $url, 2569 'attachment wp-att-' . $id, 2570 $attachment[0], 2571 $alt, 2572 $attachment[1], 2573 $attachment[2], 2574 $align, 2575 $size, 2576 $id, 2577 $caption 2578 ); 2560 2579 2561 2580 $this->assertSame( $expected, get_image_send_to_editor( $id, $caption, $title, $align, $url, $rel, $size, $alt ) ); … … 2580 2599 $html = '<a href="%1$s"><img src="%2$s" alt="%3$s" width="%4$d" height="%5$d" class="align%6$s size-%7$s wp-image-%8$d" /></a>'; 2581 2600 2582 $expected = sprintf( $html, $url, $attachment[0], $alt, $attachment[1], $attachment[2], $align, $size, $id ); 2601 $expected = sprintf( 2602 $html, 2603 $url, 2604 $attachment[0], 2605 $alt, 2606 $attachment[1], 2607 $attachment[2], 2608 $align, 2609 $size, 2610 $id 2611 ); 2583 2612 2584 2613 $this->assertSame( $expected, get_image_send_to_editor( $id, $caption, $title, $align, $url, $rel, $size, $alt ) ); … … 2914 2943 %4$s'; 2915 2944 2916 $content_unfiltered = sprintf( $content, $img, $img_no_width_height, $img_no_width, $img_no_height ); 2917 $content_filtered = wp_img_tag_add_decoding_attr( sprintf( $content, $img, $respimg_no_width_height, $img_no_width, $img_no_height ), 'the_content' ); 2945 $content_unfiltered = sprintf( 2946 $content, 2947 $img, 2948 $img_no_width_height, 2949 $img_no_width, 2950 $img_no_height 2951 ); 2952 2953 $content_filtered = sprintf( 2954 $content, 2955 $img, 2956 $respimg_no_width_height, 2957 $img_no_width, 2958 $img_no_height 2959 ); 2960 $content_filtered = wp_img_tag_add_decoding_attr( $content_filtered, 'the_content' ); 2918 2961 2919 2962 // Do not add loading, srcset, and sizes. … … 2972 3015 %8$s'; 2973 3016 2974 $content_unfiltered = sprintf( $content, $img, $img_xhtml, $img_html5, $img_eager, $img_no_width_height, $iframe, $iframe_eager, $iframe_no_width_height ); 2975 $content_filtered = wp_img_tag_add_decoding_attr( sprintf( $content, $lazy_img, $lazy_img_xhtml, $lazy_img_html5, $img_eager, $img_no_width_height, $lazy_iframe, $iframe_eager, $iframe_no_width_height ), 'the_content' ); 3017 $content_unfiltered = sprintf( 3018 $content, 3019 $img, 3020 $img_xhtml, 3021 $img_html5, 3022 $img_eager, 3023 $img_no_width_height, 3024 $iframe, 3025 $iframe_eager, 3026 $iframe_no_width_height 3027 ); 3028 3029 $content_filtered = sprintf( 3030 $content, 3031 $lazy_img, 3032 $lazy_img_xhtml, 3033 $lazy_img_html5, 3034 $img_eager, 3035 $img_no_width_height, 3036 $lazy_iframe, 3037 $iframe_eager, 3038 $iframe_no_width_height 3039 ); 3040 $content_filtered = wp_img_tag_add_decoding_attr( $content_filtered, 'the_content' ); 2976 3041 2977 3042 // Do not add width, height, srcset, and sizes. … … 2992 3057 $img = get_image_tag( self::$large_id, '', '', '', 'medium' ); 2993 3058 $lazy_img = wp_img_tag_add_loading_attr( $img, 'test' ); 3059 $lazy_img = wp_img_tag_add_decoding_attr( $lazy_img, 'the_content' ); 2994 3060 $iframe = '<iframe src="https://www.example.com" width="640" height="360"></iframe>'; 2995 3061 $lazy_iframe = wp_iframe_tag_add_loading_attr( $iframe, 'test' ); … … 3002 3068 3003 3069 $content_unfiltered = sprintf( $content, $img, $iframe ); 3004 $content_filtered = sprintf( $content, wp_img_tag_add_decoding_attr( $lazy_img, 'the_content' ), $lazy_iframe, 'the_content');3070 $content_filtered = sprintf( $content, $lazy_img, $lazy_iframe ); 3005 3071 3006 3072 // Do not add srcset and sizes while testing. … … 3020 3086 */ 3021 3087 public function test_wp_filter_content_tags_loading_lazy_opted_out() { 3022 $img = wp_img_tag_add_decoding_attr( get_image_tag( self::$large_id, '', '', '', 'medium' ), 'the_content' ); 3088 $img = get_image_tag( self::$large_id, '', '', '', 'medium' ); 3089 $img = wp_img_tag_add_decoding_attr( $img, 'the_content' ); 3023 3090 $iframe = '<iframe src="https://www.example.com" width="640" height="360"></iframe>'; 3024 3091 … … 3484 3551 // Following the threshold of 2, the first two content media elements should not be lazy-loaded. 3485 3552 $content_unfiltered = $img1 . $iframe1 . $img2 . $img3 . $iframe2; 3486 $content_expected = wp_img_tag_add_decoding_attr( $img1 . $iframe1 . $lazy_img2 . $lazy_img3 . $lazy_iframe2, 'the_content' ); 3553 $content_expected = $img1 . $iframe1 . $lazy_img2 . $lazy_img3 . $lazy_iframe2; 3554 $content_expected = wp_img_tag_add_decoding_attr( $content_expected, 'the_content' ); 3487 3555 3488 3556 $wp_query = new WP_Query( array( 'post__in' => array( self::$post_ids['publish'] ) ) );
Note: See TracChangeset
for help on using the changeset viewer.