Changeset 47343 for branches/3.7/tests/phpunit/tests/image/functions.php
- Timestamp:
- 02/22/2020 12:05:12 PM (6 years ago)
- Location:
- branches/3.7
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
tests/phpunit/tests/image/functions.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/3.7
- Property svn:mergeinfo changed
-
branches/3.7/tests/phpunit/tests/image/functions.php
r25409 r47343 31 31 $finfo = new finfo(); 32 32 $mime_type = $finfo->file( $filename, FILEINFO_MIME ); 33 } elseif ( function_exists('mime_content_type') ) {34 $mime_type = mime_content_type( $filename );35 33 } 36 34 if ( false !== strpos( $mime_type, ';' ) ) { … … 91 89 $files = array( 92 90 // 'test-image-cmyk.jpg', Allowed in r9727 93 'test-image.bmp',91 // 'test-image.bmp', Allowed in r28589 94 92 // 'test-image-grayscale.jpg', Allowed in r9727 95 93 'test-image.pct', … … 113 111 */ 114 112 public function test_wp_save_image_file() { 113 if ( ! extension_loaded( 'fileinfo' ) ) { 114 $this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' ); 115 } 116 115 117 include_once( ABSPATH . 'wp-admin/includes/image-edit.php' ); 116 118 … … 143 145 144 146 // Clean up 145 @unlink( $file );146 @unlink( $ret['path'] );147 unlink( $file ); 148 unlink( $ret['path'] ); 147 149 } 148 150 … … 157 159 */ 158 160 public function test_mime_overrides_filename() { 161 if ( ! extension_loaded( 'fileinfo' ) ) { 162 $this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' ); 163 } 159 164 160 165 // Test each image editor engine … … 181 186 182 187 // Clean up 183 @unlink( $file );184 @unlink( $ret['path'] );188 unlink( $file ); 189 unlink( $ret['path'] ); 185 190 unset( $img ); 186 191 } … … 192 197 */ 193 198 public function test_inferred_mime_types() { 199 if ( ! extension_loaded( 'fileinfo' ) ) { 200 $this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' ); 201 } 194 202 195 203 // Mime types … … 224 232 $this->assertNotInstanceOf( 'WP_Error', $ret ); 225 233 $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) ); 226 @unlink( $file ); 227 @unlink( $ret['path'] ); 234 unlink( $ret['path'] ); 228 235 } 229 236 … … 284 291 $this->markTestSkipped( 'jpeg support unavailable' ); 285 292 286 $file = wp_crop_image( 'http://asdftestblog1.files.wordpress.com/2008/04/canola.jpg', 293 if ( ! extension_loaded( 'openssl' ) ) { 294 $this->markTestSkipped( 'Tests_Image_Functions::test_wp_crop_image_url() requires openssl.' ); 295 } 296 297 $file = wp_crop_image( 'https://asdftestblog1.files.wordpress.com/2008/04/canola.jpg', 287 298 0, 0, 100, 100, 100, 100, false, 288 299 DIR_TESTDATA . '/images/' . rand_str() . '.jpg' ); … … 304 315 305 316 public function test_wp_crop_image_url_not_exist() { 306 $file = wp_crop_image( 'http://asdftestblog1.files.wordpress.com/2008/04/canoladoesnotexist.jpg', 317 if ( ! extension_loaded( 'openssl' ) ) { 318 $this->markTestSkipped( 'Tests_Image_Functions::test_wp_crop_image_url_not_exist() requires openssl.' ); 319 } 320 321 $file = wp_crop_image( 'https://asdftestblog1.files.wordpress.com/2008/04/canoladoesnotexist.jpg', 307 322 0, 0, 100, 100, 100, 100 ); 308 323 $this->assertInstanceOf( 'WP_Error', $file );
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)