Ticket #34196: working_bad_tests.diff
File working_bad_tests.diff, 14.5 KB (added by , 9 years ago) |
---|
-
src/wp-admin/includes/schema.php
506 506 // 4.3.0 507 507 'finished_splitting_shared_terms' => 1, 508 508 'site_icon' => 0, 509 510 // 4.4.0 511 'medium_large_size_w' => 768, 512 'medium_large_size_h' => 0, 509 513 ); 510 514 511 515 // 3.3 -
src/wp-admin/options.php
84 84 $whitelist_options = array( 85 85 'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'timezone_string', 'WPLANG' ), 86 86 'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ), 87 'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', ' large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ),87 'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'medium_large_size_w', 'medium_large_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ), 88 88 'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'show_on_front', 'page_on_front', 'page_for_posts', 'blog_public' ), 89 89 'writing' => array( 'default_category', 'default_email_category', 'default_link_category', 'default_post_format' ) 90 90 ); -
src/wp-includes/class-wp-image-editor-gd.php
212 212 * @access public 213 213 * 214 214 * @param array $sizes { 215 * An array of image size arrays. Default sizes are 'small', 'medium', ' large'.215 * An array of image size arrays. Default sizes are 'small', 'medium', 'medium_large', 'large'. 216 216 * 217 217 * Either a height or width must be provided. 218 218 * If one of the two is set to null, the resize will -
src/wp-includes/class-wp-image-editor-imagick.php
270 270 * @access public 271 271 * 272 272 * @param array $sizes { 273 * An array of image size arrays. Default sizes are 'small', 'medium', ' large'.273 * An array of image size arrays. Default sizes are 'small', 'medium', 'medium_large', 'large'. 274 274 * 275 275 * Either a height or width must be provided. 276 276 * If one of the two is set to null, the resize will -
src/wp-includes/class-wp-xmlrpc-server.php
513 513 'readonly' => false, 514 514 'option' => 'medium_size_h' 515 515 ), 516 'medium_large_size_w' => array( 517 'desc' => __( 'Medium-Large size image width' ), 518 'readonly' => false, 519 'option' => 'medium_large_size_w' 520 ), 521 'medium_large_size_h' => array( 522 'desc' => __( 'Medium-Large size image height' ), 523 'readonly' => false, 524 'option' => 'medium_large_size_h' 525 ), 516 526 'large_size_w' => array( 517 527 'desc' => __( 'Large size image width' ), 518 528 'readonly' => false, -
src/wp-includes/formatting.php
3662 3662 case 'thumbnail_size_h': 3663 3663 case 'medium_size_w': 3664 3664 case 'medium_size_h': 3665 case 'medium_large_size_w': 3666 case 'medium_large_size_h': 3665 3667 case 'large_size_w': 3666 3668 case 'large_size_h': 3667 3669 case 'mailserver_port': -
src/wp-includes/media.php
14 14 * The `$size` parameter accepts either an array or a string. The supported string 15 15 * values are 'thumb' or 'thumbnail' for the given thumbnail size or defaults at 16 16 * 128 width and 96 height in pixels. Also supported for the string value is 17 * 'medium ' and 'full'. The 'full' isn't actually supported, but any value other17 * 'medium_large', 'medium' and 'full'. The 'full' isn't actually supported, but any value other 18 18 * than the supported will result in the content_width size or 500 if that is 19 19 * not set. 20 20 * … … 60 60 elseif ( $size == 'medium' ) { 61 61 $max_width = intval(get_option('medium_size_w')); 62 62 $max_height = intval(get_option('medium_size_h')); 63 63 64 // if no width is set, default to the theme content width if available 64 65 } 66 elseif ( $size == 'medium_large' ) { 67 /* 68 * We're inserting an Evan-sized image into the editor. If it's a really 69 * big image we'll scale it down to fit reasonably within the editor 70 * itself, and within the theme's content width if it's known. The user 71 * can resize it in the editor if they wish. 72 */ 73 $max_width = intval(get_option('medium_large_size_w')); 74 $max_height = intval(get_option('medium_large_size_h')); 75 76 if ( intval($content_width) > 0 ) { 77 $max_width = min( intval($content_width), $max_width ); 78 } 79 } 65 80 elseif ( $size == 'large' ) { 66 81 /* 67 82 * We're inserting a large size image into the editor. If it's a really … … 71 86 */ 72 87 $max_width = intval(get_option('large_size_w')); 73 88 $max_height = intval(get_option('large_size_h')); 74 if ( intval($content_width) > 0 ) 89 if ( intval($content_width) > 0 ) { 75 90 $max_width = min( intval($content_width), $max_width ); 91 } 76 92 } elseif ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) && in_array( $size, array_keys( $_wp_additional_image_sizes ) ) ) { 77 93 $max_width = intval( $_wp_additional_image_sizes[$size]['width'] ); 78 94 $max_height = intval( $_wp_additional_image_sizes[$size]['height'] ); … … 706 722 */ 707 723 function get_intermediate_image_sizes() { 708 724 global $_wp_additional_image_sizes; 709 $image_sizes = array('thumbnail', 'medium', ' large'); // Standard sizes725 $image_sizes = array('thumbnail', 'medium', 'medium_large', 'large'); // Standard sizes 710 726 if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) ) 711 727 $image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) ); 712 728 … … 716 732 * @since 2.5.0 717 733 * 718 734 * @param array $image_sizes An array of intermediate image sizes. Defaults 719 * are 'thumbnail', 'medium', ' large'.735 * are 'thumbnail', 'medium', 'medium_large', 'large'. 720 736 */ 721 737 return apply_filters( 'intermediate_image_sizes', $image_sizes ); 722 738 } -
tests/phpunit/tests/media.php
728 728 'descriptor' => 'w', 729 729 'value' => $image['sizes']['medium']['width'], 730 730 ), 731 array( 732 'url' => 'http://example.org/wp-content/uploads/' . $year_month . '/' . $image['sizes']['medium_large']['file'], 733 'descriptor' => 'w', 734 'value' => $image['sizes']['medium_large']['width'], 735 ), 731 736 array( 732 737 'url' => 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $year_month . '/' . $image['sizes']['large']['file'], 733 738 'descriptor' => 'w', … … 771 776 'value' => $image['sizes']['medium']['width'], 772 777 ), 773 778 array( 779 'url' => 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image['sizes']['medium_large']['file'], 780 'descriptor' => 'w', 781 'value' => $image['sizes']['medium_large']['width'], 782 ), 783 array( 774 784 'url' => 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image['sizes']['large']['file'], 775 785 'descriptor' => 'w', 776 786 'value' => $image['sizes']['large']['width'], … … 783 793 ); 784 794 785 795 // Set up test cases for all expected size names and a random one. 786 $sizes = array( 'medium', 'large', ' full', 'yoav' );796 $sizes = array( 'medium', 'large', 'medium_large', 'full', 'yoav' ); 787 797 788 798 foreach ( $sizes as $size ) { 789 799 $this->assertSame( $expected, wp_get_attachment_image_srcset_array( $id, $size ) ); … … 875 885 $expected = 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $year_month = date('Y/m') . '/' 876 886 . $image['sizes']['medium']['file'] . ' ' . $image['sizes']['medium']['width'] . 'w, '; 877 887 $expected .= 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $year_month = date('Y/m') . '/' 888 . $image['sizes']['medium_large']['file'] . ' ' . $image['sizes']['medium_large']['width'] . 'w, '; 889 $expected .= 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $year_month = date('Y/m') . '/' 878 890 . $image['sizes']['large']['file'] . ' ' . $image['sizes']['large']['width'] . 'w, '; 879 891 $expected .= 'http://' . WP_TESTS_DOMAIN . '/wp-content/uploads/' . $image['file'] . ' ' . $image['width'] .'w'; 880 892 … … 899 911 */ 900 912 function test_wp_get_attachment_image_sizes() { 901 913 // Test sizes against the default WP sizes. 902 $intermediates = array('thumbnail', 'medium', ' large');914 $intermediates = array('thumbnail', 'medium', 'medium_large', 'large'); 903 915 904 916 foreach( $intermediates as $int ) { 905 917 $width = get_option( $int . '_size_w' ); -
tests/phpunit/tests/post/attachments.php
35 35 // intermediate copies should not exist 36 36 $this->assertFalse( image_get_intermediate_size($id, 'thumbnail') ); 37 37 $this->assertFalse( image_get_intermediate_size($id, 'medium') ); 38 $this->assertFalse( image_get_intermediate_size($id, 'medium_large') ); 38 39 39 // medium and full size will both point to the original40 // medium, medium_large, and full size will both point to the original 40 41 $downsize = image_downsize($id, 'medium'); 41 42 $this->assertEquals( basename( $upload['file'] ), basename($downsize[0]) ); 42 43 $this->assertEquals( 50, $downsize[1] ); 43 44 $this->assertEquals( 50, $downsize[2] ); 44 45 46 $downsize = image_downsize($id, 'medium_large'); 47 $this->assertEquals( basename( $upload['file'] ), basename($downsize[0]) ); 48 $this->assertEquals( 50, $downsize[1] ); 49 $this->assertEquals( 50, $downsize[2] ); 50 45 51 $downsize = image_downsize($id, 'full'); 46 52 $this->assertEquals( basename( $upload['file'] ), basename($downsize[0]) ); 47 53 $this->assertEquals( 50, $downsize[1] ); … … 72 78 $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $thumb['path']) ); 73 79 74 80 $this->assertFalse( image_get_intermediate_size($id, 'medium') ); 81 $this->assertFalse( image_get_intermediate_size($id, 'medium_large') ); 75 82 76 83 // the thumb url should point to the thumbnail intermediate 77 84 $this->assertEquals( $thumb['url'], wp_get_attachment_thumb_url($id) ); … … 82 89 $this->assertEquals( 150, $downsize[1] ); 83 90 $this->assertEquals( 150, $downsize[2] ); 84 91 85 // medium and full will both point to the original92 // medium, medium_large, and full will both point to the original 86 93 $downsize = image_downsize($id, 'medium'); 87 94 $this->assertEquals( 'a2-small.jpg', basename($downsize[0]) ); 88 95 $this->assertEquals( 400, $downsize[1] ); 89 96 $this->assertEquals( 300, $downsize[2] ); 90 97 98 $downsize = image_downsize($id, 'medium_large'); 99 $this->assertEquals( 'a2-small.jpg', basename($downsize[0]) ); 100 $this->assertEquals( 400, $downsize[1] ); 101 $this->assertEquals( 300, $downsize[2] ); 102 91 103 $downsize = image_downsize($id, 'full'); 92 104 $this->assertEquals( 'a2-small.jpg', basename($downsize[0]) ); 93 105 $this->assertEquals( 400, $downsize[1] ); … … 95 107 96 108 } 97 109 98 function test_insert_image_medium () {110 function test_insert_image_medium_sizes() { 99 111 if ( !function_exists( 'imagejpeg' ) ) 100 112 $this->markTestSkipped( 'jpeg support unavailable' ); 101 113 … … 120 132 $this->assertEquals( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] ); 121 133 $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path']) ); 122 134 135 $medium_large = image_get_intermediate_size($id, 'medium_large'); 136 $this->assertEquals( '2007-06-17DSC_4173-768x510.jpg', $medium_large['file'] ); 137 $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $medium_large['path']) ); 138 123 139 // the thumb url should point to the thumbnail intermediate 124 140 $this->assertEquals( $thumb['url'], wp_get_attachment_thumb_url($id) ); 125 141 … … 134 150 $this->assertEquals( 400, $downsize[1] ); 135 151 $this->assertEquals( 602, $downsize[2] ); 136 152 153 $downsize = image_downsize($id, 'medium_large'); 154 $this->assertEquals( '2007-06-17DSC_4173-768x510.jpg', basename($downsize[0]) ); 155 $this->assertEquals( 510, $downsize[1] ); 156 $this->assertEquals( 768, $downsize[2] ); 157 137 158 $downsize = image_downsize($id, 'full'); 138 159 $this->assertEquals( '2007-06-17DSC_4173.jpg', basename($downsize[0]) ); 139 160 $this->assertEquals( 680, $downsize[1] ); … … 166 187 $this->assertEquals( '2007-06-17DSC_4173-400x602.jpg', $medium['file'] ); 167 188 $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $medium['path']) ); 168 189 190 $medium_large = image_get_intermediate_size($id, 'medium_large'); 191 $this->assertEquals( '2007-06-17DSC_4173-510x768.jpg', $medium_large['file'] ); 192 $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $medium_large['path']) ); 193 169 194 $meta = wp_get_attachment_metadata($id); 170 195 $original = $meta['file']; 171 196 $this->assertTrue( is_file($uploads['basedir'] . DIRECTORY_SEPARATOR . $original) ); … … 175 200 176 201 $this->assertFalse( is_file($thumb['path']) ); 177 202 $this->assertFalse( is_file($medium['path']) ); 203 $this->assertFalse( is_file($medium_large['path']) ); 178 204 $this->assertFalse( is_file($original) ); 179 205 } 180 206