IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/tests/phpunit/tests/image/intermediateSize.php b/tests/phpunit/tests/image/intermediateSize.php
|
a
|
b
|
|
| 15 | 15 | parent::tear_down(); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | | public function _make_attachment( $file, $parent_post_id = 0 ) { |
| 19 | | $contents = file_get_contents( $file ); |
| 20 | | $upload = wp_upload_bits( wp_basename( $file ), null, $contents ); |
| 21 | | |
| 22 | | return parent::_make_attachment( $upload, $parent_post_id ); |
| 23 | | } |
| 24 | | |
| 25 | 18 | public function test_make_intermediate_size_no_size() { |
| 26 | 19 | $image = image_make_intermediate_size( DIR_TESTDATA . '/images/a2-small.jpg', 0, 0, false ); |
| 27 | 20 | |
| … |
… |
|
| 96 | 89 | add_image_size( 'test-size', 330, 220, true ); |
| 97 | 90 | |
| 98 | 91 | $file = DIR_TESTDATA . '/images/waffles.jpg'; |
| 99 | | $id = $this->_make_attachment( $file, 0 ); |
| | 92 | $id = $this->_upload_file_and_make_attachment( $file ); |
| 100 | 93 | |
| 101 | 94 | // Look for a size by name. |
| 102 | 95 | $image = image_get_intermediate_size( $id, 'test-size' ); |
| … |
… |
|
| 120 | 113 | add_image_size( 'false-width', 600, 220, true ); |
| 121 | 114 | |
| 122 | 115 | $file = DIR_TESTDATA . '/images/waffles.jpg'; |
| 123 | | $id = $this->_make_attachment( $file, 0 ); |
| | 116 | $id = $this->_upload_file_and_make_attachment( $file ); |
| 124 | 117 | |
| 125 | 118 | // Look for a size by array that exists. |
| 126 | 119 | // Note: Staying larger than 300px to miss default medium crop. |
| … |
… |
|
| 143 | 136 | add_image_size( 'false-width', 150, 220, true ); |
| 144 | 137 | |
| 145 | 138 | $file = DIR_TESTDATA . '/images/waffles.jpg'; |
| 146 | | $id = $this->_make_attachment( $file, 0 ); |
| | 139 | $id = $this->_upload_file_and_make_attachment( $file ); |
| 147 | 140 | |
| 148 | 141 | // Look for a size by array that doesn't exist. |
| 149 | 142 | // Note: Staying larger than 300px to miss default medium crop. |
| … |
… |
|
| 165 | 158 | add_image_size( 'false-width', 150, 220, true ); |
| 166 | 159 | |
| 167 | 160 | $file = DIR_TESTDATA . '/images/waffles.jpg'; |
| 168 | | $id = $this->_make_attachment( $file, 0 ); |
| | 161 | $id = $this->_upload_file_and_make_attachment( $file ); |
| 169 | 162 | |
| 170 | 163 | // Look for a size by array that doesn't exist. |
| 171 | 164 | // Note: Staying larger than 300px to miss default medium crop. |
| … |
… |
|
| 189 | 182 | add_image_size( 'false-height', $width, 100, true ); |
| 190 | 183 | |
| 191 | 184 | $file = DIR_TESTDATA . '/images/waffles.jpg'; |
| 192 | | $id = $this->_make_attachment( $file, 0 ); |
| | 185 | $id = $this->_upload_file_and_make_attachment( $file ); |
| 193 | 186 | |
| 194 | 187 | $original = wp_get_attachment_metadata( $id ); |
| 195 | 188 | $image_w = $width; |
| … |
… |
|
| 218 | 211 | add_image_size( 'false-height', 300, $height, true ); |
| 219 | 212 | |
| 220 | 213 | $file = DIR_TESTDATA . '/images/waffles.jpg'; |
| 221 | | $id = $this->_make_attachment( $file, 0 ); |
| | 214 | $id = $this->_upload_file_and_make_attachment( $file ); |
| 222 | 215 | |
| 223 | 216 | $original = wp_get_attachment_metadata( $id ); |
| 224 | 217 | $image_h = $height; |
| … |
… |
|
| 245 | 238 | add_image_size( 'off-by-one', $width, $height, true ); |
| 246 | 239 | |
| 247 | 240 | $file = DIR_TESTDATA . '/images/waffles.jpg'; |
| 248 | | $id = $this->_make_attachment( $file, 0 ); |
| | 241 | $id = $this->_upload_file_and_make_attachment( $file ); |
| 249 | 242 | |
| 250 | 243 | $original = wp_get_attachment_metadata( $id ); |
| 251 | 244 | $image_h = $height; |
| … |
… |
|
| 267 | 260 | add_image_size( 'test-size', 200, 100, true ); |
| 268 | 261 | |
| 269 | 262 | $file = DIR_TESTDATA . '/images/waffles.jpg'; |
| 270 | | $id = $this->_make_attachment( $file, 0 ); |
| | 263 | $id = $this->_upload_file_and_make_attachment( $file ); |
| 271 | 264 | |
| 272 | 265 | // Request a size by array that doesn't exist and is smaller than the 'thumbnail'. |
| 273 | 266 | $image = image_get_intermediate_size( $id, array( 50, 25 ) ); |
| … |
… |
|
| 282 | 275 | */ |
| 283 | 276 | public function test_get_intermediate_size_with_small_size_array_fallback() { |
| 284 | 277 | $file = DIR_TESTDATA . '/images/waffles.jpg'; |
| 285 | | $id = $this->_make_attachment( $file, 0 ); |
| | 278 | $id = $this->_upload_file_and_make_attachment( $file ); |
| 286 | 279 | |
| 287 | 280 | $original = wp_get_attachment_metadata( $id ); |
| 288 | 281 | $thumbnail_file = $original['sizes']['thumbnail']['file']; |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/tests/phpunit/tests/image/siteIcon.php b/tests/phpunit/tests/image/siteIcon.php
|
a
|
b
|
|
| 160 | 160 | return $this->attachment_id; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | | $filename = DIR_TESTDATA . '/images/test-image.jpg'; |
| 164 | | $contents = file_get_contents( $filename ); |
| 165 | | |
| 166 | | $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); |
| 167 | | |
| 168 | | $this->attachment_id = $this->_make_attachment( $upload ); |
| | 163 | $this->attachment_id = $this->_upload_file_and_make_attachment( DIR_TESTDATA . '/images/test-image.jpg' ); |
| 169 | 164 | return $this->attachment_id; |
| 170 | 165 | } |
| 171 | 166 | } |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/tests/phpunit/tests/ajax/Attachments.php b/tests/phpunit/tests/ajax/Attachments.php
|
a
|
b
|
|
| 20 | 20 | // Become an administrator. |
| 21 | 21 | $this->_setRole( 'administrator' ); |
| 22 | 22 | |
| 23 | | $filename = DIR_TESTDATA . '/images/canola.jpg'; |
| 24 | | $contents = file_get_contents( $filename ); |
| 25 | | |
| 26 | | $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); |
| 27 | | $attachment = $this->_make_attachment( $upload ); |
| | 23 | $attachment = $this->_upload_file_and_make_attachment( DIR_TESTDATA . '/images/canola.jpg' ); |
| 28 | 24 | |
| 29 | 25 | // Set up a default request. |
| 30 | 26 | $_POST['nonce'] = wp_create_nonce( 'media-send-to-editor' ); |
| … |
… |
|
| 67 | 63 | // Become an administrator. |
| 68 | 64 | $this->_setRole( 'administrator' ); |
| 69 | 65 | |
| 70 | | $filename = DIR_TESTDATA . '/formatting/entities.txt'; |
| 71 | | $contents = file_get_contents( $filename ); |
| 72 | | |
| 73 | | $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); |
| 74 | | $attachment = $this->_make_attachment( $upload ); |
| | 66 | $attachment = $this->_upload_file_and_make_attachment( DIR_TESTDATA . '/formatting/entities.txt' ); |
| 75 | 67 | |
| 76 | 68 | // Set up a default request. |
| 77 | 69 | $_POST['nonce'] = wp_create_nonce( 'media-send-to-editor' ); |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/tests/phpunit/includes/abstract-testcase.php b/tests/phpunit/includes/abstract-testcase.php
|
a
|
b
|
|
| 1507 | 1507 | return $id; |
| 1508 | 1508 | } |
| 1509 | 1509 | |
| | 1510 | /** |
| | 1511 | * Uploads given file and creates an attachment post from it. |
| | 1512 | * |
| | 1513 | * @since 6.1.0 |
| | 1514 | * |
| | 1515 | * @param array $filename Absolute path to the file to upload. |
| | 1516 | * @param int $parent_post_id Optional. Parent post ID. |
| | 1517 | * |
| | 1518 | * @return int|WP_Error The attachment ID on success. The value 0 or WP_Error on failure. |
| | 1519 | */ |
| | 1520 | public function _upload_file_and_make_attachment( $filename, $parent_post_id = 0 ) { |
| | 1521 | $contents = file_get_contents( $filename ); |
| | 1522 | $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); |
| | 1523 | |
| | 1524 | return $this->_make_attachment( $upload, $parent_post_id ); |
| | 1525 | } |
| | 1526 | |
| 1510 | 1527 | /** |
| 1511 | 1528 | * Updates the modified and modified GMT date of a post in the database. |
| 1512 | 1529 | * |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/tests/phpunit/tests/post/attachments.php b/tests/phpunit/tests/post/attachments.php
|
a
|
b
|
|
| 441 | 441 | } |
| 442 | 442 | |
| 443 | 443 | public function test_wp_attachment_is() { |
| 444 | | $filename = DIR_TESTDATA . '/images/test-image.jpg'; |
| 445 | | $contents = file_get_contents( $filename ); |
| 446 | | |
| 447 | | $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); |
| 448 | | $attachment_id = $this->_make_attachment( $upload ); |
| | 444 | $attachment_id = $this->_upload_file_and_make_attachment( DIR_TESTDATA . '/images/test-image.jpg' ); |
| 449 | 445 | |
| 450 | 446 | $this->assertTrue( wp_attachment_is_image( $attachment_id ) ); |
| 451 | 447 | $this->assertTrue( wp_attachment_is( 'image', $attachment_id ) ); |
| … |
… |
|
| 459 | 455 | add_filter( 'upload_mimes', array( $this, 'allow_psd_mime_type' ), 10, 2 ); |
| 460 | 456 | } |
| 461 | 457 | |
| 462 | | $filename = DIR_TESTDATA . '/images/test-image.psd'; |
| 463 | | $contents = file_get_contents( $filename ); |
| 464 | | |
| 465 | | $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); |
| 466 | | $attachment_id = $this->_make_attachment( $upload ); |
| | 458 | $attachment_id = $this->_upload_file_and_make_attachment( DIR_TESTDATA . '/images/test-image.psd' ); |
| 467 | 459 | |
| 468 | 460 | $this->assertFalse( wp_attachment_is_image( $attachment_id ) ); |
| 469 | 461 | $this->assertTrue( wp_attachment_is( 'psd', $attachment_id ) ); |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/tests/phpunit/tests/xmlrpc/wp/getMediaItem.php b/tests/phpunit/tests/xmlrpc/wp/getMediaItem.php
|
a
|
b
|
|
| 19 | 19 | |
| 20 | 20 | add_theme_support( 'post-thumbnails' ); |
| 21 | 21 | |
| 22 | | $filename = ( DIR_TESTDATA . '/images/waffles.jpg' ); |
| 23 | | $contents = file_get_contents( $filename ); |
| 24 | | $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); |
| 25 | | |
| 26 | | $this->attachment_id = $this->_make_attachment( $upload, self::$post_id ); |
| | 22 | $this->attachment_id = $this->_upload_file_and_make_attachment( DIR_TESTDATA . '/images/waffles.jpg', self::$post_id ); |
| 27 | 23 | $this->attachment_data = get_post( $this->attachment_id, ARRAY_A ); |
| 28 | 24 | |
| 29 | 25 | set_post_thumbnail( self::$post_id, $this->attachment_id ); |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/tests/phpunit/tests/ajax/MediaEdit.php b/tests/phpunit/tests/ajax/MediaEdit.php
|
a
|
b
|
|
| 35 | 35 | public function testCropImageThumbnail() { |
| 36 | 36 | require_once ABSPATH . 'wp-admin/includes/image-edit.php'; |
| 37 | 37 | |
| 38 | | $filename = DIR_TESTDATA . '/images/canola.jpg'; |
| 39 | | $contents = file_get_contents( $filename ); |
| 40 | | |
| 41 | | $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); |
| 42 | | $id = $this->_make_attachment( $upload ); |
| | 38 | $id = $this->_upload_file_and_make_attachment( DIR_TESTDATA . '/images/canola.jpg' ); |
| 43 | 39 | |
| 44 | 40 | $_REQUEST['action'] = 'image-editor'; |
| 45 | 41 | $_REQUEST['context'] = 'edit-attachment'; |
| … |
… |
|
| 70 | 66 | |
| 71 | 67 | require_once ABSPATH . 'wp-admin/includes/image-edit.php'; |
| 72 | 68 | |
| 73 | | $filename = DIR_TESTDATA . '/images/canola.jpg'; |
| 74 | | $contents = file_get_contents( $filename ); |
| 75 | | |
| 76 | | $upload = wp_upload_bits( wp_basename( $filename ), null, $contents ); |
| 77 | | $id = $this->_make_attachment( $upload ); |
| | 69 | $id = $this->_make_attachment( DIR_TESTDATA . '/images/canola.jpg' ); |
| 78 | 70 | |
| 79 | 71 | $_REQUEST['action'] = 'image-editor'; |
| 80 | 72 | $_REQUEST['context'] = 'edit-attachment'; |