Changeset 51462 for trunk/tests/phpunit/tests/media.php
- Timestamp:
- 07/19/2021 02:00:11 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/media.php
r51451 r51462 824 824 ); 825 825 826 $this->assert Contains( 'src="https://example.com/foo.mp3', $actual );827 $this->assert NotContains( 'loop', $actual );828 $this->assert NotContains( 'autoplay', $actual );829 $this->assert Contains( 'preload="none"', $actual );830 $this->assert Contains( 'class="wp-audio-shortcode"', $actual );831 $this->assert Contains( 'style="width: 100%;"', $actual );826 $this->assertStringContainsString( 'src="https://example.com/foo.mp3', $actual ); 827 $this->assertStringNotContainsString( 'loop', $actual ); 828 $this->assertStringNotContainsString( 'autoplay', $actual ); 829 $this->assertStringContainsString( 'preload="none"', $actual ); 830 $this->assertStringContainsString( 'class="wp-audio-shortcode"', $actual ); 831 $this->assertStringContainsString( 'style="width: 100%;"', $actual ); 832 832 833 833 $actual = wp_audio_shortcode( … … 842 842 ); 843 843 844 $this->assert Contains( 'src="https://example.com/foo.mp3', $actual );845 $this->assert Contains( 'loop="1"', $actual );846 $this->assert Contains( 'autoplay="1"', $actual );847 $this->assert Contains( 'preload="1"', $actual );848 $this->assert Contains( 'class="foobar"', $actual );849 $this->assert Contains( 'style="padding:0;"', $actual );844 $this->assertStringContainsString( 'src="https://example.com/foo.mp3', $actual ); 845 $this->assertStringContainsString( 'loop="1"', $actual ); 846 $this->assertStringContainsString( 'autoplay="1"', $actual ); 847 $this->assertStringContainsString( 'preload="1"', $actual ); 848 $this->assertStringContainsString( 'class="foobar"', $actual ); 849 $this->assertStringContainsString( 'style="padding:0;"', $actual ); 850 850 } 851 851 … … 929 929 ); 930 930 931 $this->assert Contains( 'src="https://example.com/foo.mp4', $actual );932 $this->assert NotContains( 'loop', $actual );933 $this->assert NotContains( 'autoplay', $actual );934 $this->assert Contains( 'preload="metadata"', $actual );935 $this->assert Contains( 'width="640"', $actual );936 $this->assert Contains( 'height="360"', $actual );937 $this->assert Contains( 'class="wp-video-shortcode"', $actual );931 $this->assertStringContainsString( 'src="https://example.com/foo.mp4', $actual ); 932 $this->assertStringNotContainsString( 'loop', $actual ); 933 $this->assertStringNotContainsString( 'autoplay', $actual ); 934 $this->assertStringContainsString( 'preload="metadata"', $actual ); 935 $this->assertStringContainsString( 'width="640"', $actual ); 936 $this->assertStringContainsString( 'height="360"', $actual ); 937 $this->assertStringContainsString( 'class="wp-video-shortcode"', $actual ); 938 938 939 939 $actual = wp_video_shortcode( … … 950 950 ); 951 951 952 $this->assert Contains( 'src="https://example.com/foo.mp4', $actual );953 $this->assert Contains( 'poster="https://example.com/foo.png', $actual );954 $this->assert Contains( 'loop="1"', $actual );955 $this->assert Contains( 'autoplay="1"', $actual );956 $this->assert Contains( 'preload="1"', $actual );957 $this->assert Contains( 'width="123"', $actual );958 $this->assert Contains( 'height="456"', $actual );959 $this->assert Contains( 'class="foobar"', $actual );952 $this->assertStringContainsString( 'src="https://example.com/foo.mp4', $actual ); 953 $this->assertStringContainsString( 'poster="https://example.com/foo.png', $actual ); 954 $this->assertStringContainsString( 'loop="1"', $actual ); 955 $this->assertStringContainsString( 'autoplay="1"', $actual ); 956 $this->assertStringContainsString( 'preload="1"', $actual ); 957 $this->assertStringContainsString( 'width="123"', $actual ); 958 $this->assertStringContainsString( 'height="456"', $actual ); 959 $this->assertStringContainsString( 'class="foobar"', $actual ); 960 960 } 961 961 … … 971 971 ); 972 972 973 $this->assert NotContains( 'feature=youtu.be', $actual );973 $this->assertStringNotContainsString( 'feature=youtu.be', $actual ); 974 974 } 975 975 … … 985 985 ); 986 986 987 $this->assert Contains( 'src="https://www.youtube.com/watch?v=72xdCU__XCk', $actual );987 $this->assertStringContainsString( 'src="https://www.youtube.com/watch?v=72xdCU__XCk', $actual ); 988 988 } 989 989 … … 999 999 ); 1000 1000 1001 $this->assert Contains( 'src="https://vimeo.com/76979871', $actual );1002 $this->assert NotContains( 'blah=meh', $actual );1001 $this->assertStringContainsString( 'src="https://vimeo.com/76979871', $actual ); 1002 $this->assertStringNotContainsString( 'blah=meh', $actual ); 1003 1003 } 1004 1004 … … 1014 1014 ); 1015 1015 1016 $this->assert Contains( 'src="https://vimeo.com/76979871?loop=0', $actual );1016 $this->assertStringContainsString( 'src="https://vimeo.com/76979871?loop=0', $actual ); 1017 1017 } 1018 1018 … … 1029 1029 ); 1030 1030 1031 $this->assert Contains( 'src="https://vimeo.com/76979871?loop=1', $actual );1031 $this->assertStringContainsString( 'src="https://vimeo.com/76979871?loop=1', $actual ); 1032 1032 } 1033 1033 … … 2863 2863 $img = wp_img_tag_add_loading_attr( $img, 'test' ); 2864 2864 2865 $this->assert Contains( ' loading="lazy"', $img );2865 $this->assertStringContainsString( ' loading="lazy"', $img ); 2866 2866 } 2867 2867 … … 2874 2874 $img = wp_img_tag_add_loading_attr( $img, 'test' ); 2875 2875 2876 $this->assert NotContains( ' loading=', $img );2876 $this->assertStringNotContainsString( ' loading=', $img ); 2877 2877 } 2878 2878 … … 2885 2885 $img = wp_img_tag_add_loading_attr( $img, 'test' ); 2886 2886 2887 $this->assert NotContains( ' loading=', $img );2887 $this->assertStringNotContainsString( ' loading=', $img ); 2888 2888 2889 2889 // Test specifically that the attribute is not there with double-quotes, 2890 2890 // to avoid regressions. 2891 $this->assert NotContains( ' loading="lazy"', $img );2891 $this->assertStringNotContainsString( ' loading="lazy"', $img ); 2892 2892 } 2893 2893 … … 2900 2900 add_filter( 'wp_img_tag_add_loading_attr', '__return_false' ); 2901 2901 2902 $this->assert NotContains( ' loading=', $img );2902 $this->assertStringNotContainsString( ' loading=', $img ); 2903 2903 } 2904 2904 … … 2910 2910 $iframe = wp_iframe_tag_add_loading_attr( $iframe, 'test' ); 2911 2911 2912 $this->assert Contains( ' loading="lazy"', $iframe );2912 $this->assertStringContainsString( ' loading="lazy"', $iframe ); 2913 2913 } 2914 2914 … … 2920 2920 $iframe = wp_iframe_tag_add_loading_attr( $iframe, 'test' ); 2921 2921 2922 $this->assert NotContains( ' loading=', $iframe );2922 $this->assertStringNotContainsString( ' loading=', $iframe ); 2923 2923 } 2924 2924 … … 2930 2930 $iframe = wp_iframe_tag_add_loading_attr( $iframe, 'test' ); 2931 2931 2932 $this->assert NotContains( ' loading=', $iframe );2932 $this->assertStringNotContainsString( ' loading=', $iframe ); 2933 2933 2934 2934 // Test specifically that the attribute is not there with double-quotes, 2935 2935 // to avoid regressions. 2936 $this->assert NotContains( ' loading="lazy"', $iframe );2936 $this->assertStringNotContainsString( ' loading="lazy"', $iframe ); 2937 2937 } 2938 2938 … … 2945 2945 $iframe = wp_iframe_tag_add_loading_attr( $iframe, 'test' ); 2946 2946 2947 $this->assert NotContains( ' loading=', $iframe );2947 $this->assertStringNotContainsString( ' loading=', $iframe ); 2948 2948 } 2949 2949 … … 2957 2957 $iframe = wp_iframe_tag_add_loading_attr( $iframe, 'test' ); 2958 2958 2959 $this->assert NotContains( ' loading=', $iframe );2959 $this->assertStringNotContainsString( ' loading=', $iframe ); 2960 2960 } 2961 2961 … … 2967 2967 $img = wp_get_attachment_image( self::$large_id ); 2968 2968 2969 $this->assert Contains( ' loading="lazy"', $img );2969 $this->assertStringContainsString( ' loading="lazy"', $img ); 2970 2970 } 2971 2971 … … 2979 2979 2980 2980 // There should not be any loading attribute in this case. 2981 $this->assert NotContains( ' loading=', $img );2981 $this->assertStringNotContainsString( ' loading=', $img ); 2982 2982 } 2983 2983 … … 2994 2994 2995 2995 // There should not be any loading attribute in this case. 2996 $this->assert NotContains( ' loading=', $img );2996 $this->assertStringNotContainsString( ' loading=', $img ); 2997 2997 } 2998 2998 … … 3117 3117 ) 3118 3118 ); 3119 $this->assert Contains( '?attachment_id=', $actual );3119 $this->assertStringContainsString( '?attachment_id=', $actual ); 3120 3120 3121 3121 // File: Links to image file URL. … … 3135 3135 ) 3136 3136 ); 3137 $this->assert NotContains( '<a ', $actual );3137 $this->assertStringNotContainsString( '<a ', $actual ); 3138 3138 } 3139 3139
Note: See TracChangeset
for help on using the changeset viewer.