Make WordPress Core

Ticket #34898: 34898-test.diff

File 34898-test.diff, 1.1 KB (added by joemcgill, 9 years ago)

Adds unit tests

  • tests/phpunit/tests/media.php

    diff --git tests/phpunit/tests/media.php tests/phpunit/tests/media.php
    index 55a53a1..bbce06d 100644
    EOF; 
    10591059        }
    10601060
    10611061        /**
     1062         * When we're rendering a 'srcset' for responsive images we're relying on the wp-image-* class name,
     1063         * but the class name may not be consistent with attachment IDs when working with imported content
     1064         * or when editing the src attribute manually. This can result in different images shown on different
     1065         * screen sizes or screen densities.
     1066         *
     1067         * @ticket 34898
     1068         * @ticket 33641
     1069         */
     1070        function test_wp_make_content_images_responsive_wrong() {
     1071                $image = get_image_tag( self::$large_id, '', '', '', 'medium' );
     1072
     1073                // Replace the src URL
     1074                $image_wrong_src = preg_replace( '|src="[^"]+"|', 'src="http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/foo.jpg"', $image );
     1075
     1076                $this->assertSame( $image_wrong_src, wp_make_content_images_responsive( $image_wrong_src) );
     1077        }
     1078
     1079        /**
    10621080         * @ticket 33641
    10631081         */
    10641082        function test_wp_make_content_images_responsive_with_preexisting_srcset() {