From 5bb3e71cc0c0ccfe30205352be454f7933459585 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Sat, 7 Mar 2015 18:47:04 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/post/attachments.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/phpunit/tests/post/attachments.php b/tests/phpunit/tests/post/attachments.php index 833a56f1e3..881fb641fb 100644 --- a/tests/phpunit/tests/post/attachments.php +++ b/tests/phpunit/tests/post/attachments.php @@ -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; } }