Changeset 32919 for trunk/tests/phpunit/tests/post/attachments.php
- Timestamp:
- 06/24/2015 12:42:33 AM (11 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/post/attachments.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/post/attachments.php
r32342 r32919 501 501 } 502 502 503 public function test_upload_mimes_filter_is_applied() { 504 $filename = DIR_TESTDATA . '/images/test-image.jpg'; 505 $contents = file_get_contents( $filename ); 506 507 $upload = wp_upload_bits( basename( $filename ), null, $contents ); 508 509 $this->assertFalse( $upload['error'] ); 510 511 add_filter( 'upload_mimes', array( $this, 'blacklist_jpg_mime_type' ) ); 512 513 $upload = wp_upload_bits( basename( $filename ), null, $contents ); 514 515 $this->assertNotEmpty( $upload['error'] ); 516 517 remove_filter( 'upload_mimes', array( $this, 'blacklist_jpg_mime_type' ) ); 518 } 519 503 520 public function whitelist_psd_mime_type( $mimes ) { 504 521 $mimes['psd'] = 'application/octet-stream'; 505 522 return $mimes; 506 523 } 524 525 public function blacklist_jpg_mime_type( $mimes ) { 526 unset( $mimes['jpg|jpeg|jpe'] ); 527 return $mimes; 528 } 507 529 }
Note: See TracChangeset
for help on using the changeset viewer.