Whitelist 'psd' for uploads when testing `wp_attachment_is() on multisite.

It's not allowed by default, which causes the fixture not to be built.

See #25275 [31647].

git-svn-id: https://develop.svn.wordpress.org/trunk@31670 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges 2015-03-07 18:47:04 +00:00
parent a11372afe1
commit 5bb3e71cc0
1 changed files with 14 additions and 0 deletions

View File

@ -453,6 +453,11 @@ class Tests_Post_Attachments extends WP_UnitTestCase {
}
public function test_wp_attachment_is_default() {
// On Multisite, psd is not an allowed mime type by default.
if ( is_multisite() ) {
add_filter( 'upload_mimes', array( $this, 'whitelist_psd_mime_type' ), 10, 2 );
}
$filename = DIR_TESTDATA . '/images/test-image.psd';
$contents = file_get_contents( $filename );
@ -463,5 +468,14 @@ class Tests_Post_Attachments extends WP_UnitTestCase {
$this->assertTrue( wp_attachment_is( 'psd', $attachment_id ) );
$this->assertFalse( wp_attachment_is( 'audio', $attachment_id ) );
$this->assertFalse( wp_attachment_is( 'video', $attachment_id ) );
if ( is_multisite() ) {
remove_filter( 'upload_mimes', array( $this, 'whitelist_psd_mime_type' ), 10, 2 );
}
}
public function whitelist_psd_mime_type( $mimes ) {
$mimes['psd'] = 'application/octet-stream';
return $mimes;
}
}