Make WordPress Core

Changeset 31670


Ignore:
Timestamp:
03/07/2015 06:47:04 PM (10 years ago)
Author:
boonebgorges
Message:

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].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/attachments.php

    r31647 r31670  
    454454
    455455    public function test_wp_attachment_is_default() {
     456        // On Multisite, psd is not an allowed mime type by default.
     457        if ( is_multisite() ) {
     458            add_filter( 'upload_mimes', array( $this, 'whitelist_psd_mime_type' ), 10, 2 );
     459        }
     460
    456461        $filename = DIR_TESTDATA . '/images/test-image.psd';
    457462        $contents = file_get_contents( $filename );
     
    464469        $this->assertFalse( wp_attachment_is( 'audio', $attachment_id ) );
    465470        $this->assertFalse( wp_attachment_is( 'video', $attachment_id ) );
     471
     472        if ( is_multisite() ) {
     473            remove_filter( 'upload_mimes', array( $this, 'whitelist_psd_mime_type' ), 10, 2 );
     474        }
     475    }
     476
     477    public function whitelist_psd_mime_type( $mimes ) {
     478        $mimes['psd'] = 'application/octet-stream';
     479        return $mimes;
    466480    }
    467481}
Note: See TracChangeset for help on using the changeset viewer.