Make WordPress Core


Ignore:
Timestamp:
09/17/2015 12:36:12 AM (11 years ago)
Author:
wonderboymusic
Message:

In wp_mime_type_icon(), the length of the $wilds array varies depending on what is passed as $mime. Loop over $wilds instead of arbitrarily checking $wilds[0].

Adds unit tests.

Fixes #33012.

File:
1 edited

Legend:

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

    r33188 r34255  
    513513        $upload = wp_upload_bits( basename( $filename ), null, $contents );
    514514
     515        remove_filter( 'upload_mimes', array( $this, 'blacklist_jpg_mime_type' ) );
     516
    515517        $this->assertNotEmpty( $upload['error'] );
    516 
    517         remove_filter( 'upload_mimes', array( $this, 'blacklist_jpg_mime_type' ) );
    518518    }
    519519
     
    527527        return $mimes;
    528528    }
     529
     530    /**
     531     * @ticket 33012
     532     */
     533    public function test_wp_mime_type_icon() {
     534        $icon = wp_mime_type_icon();
     535
     536        $this->assertContains( 'images/media/default.png', $icon );
     537    }
     538
     539    /**
     540     * @ticket 33012
     541     */
     542    public function test_wp_mime_type_icon_video() {
     543        $icon = wp_mime_type_icon( 'video/mp4' );
     544
     545        $this->assertContains( 'images/media/video.png', $icon );
     546    }
    529547}
Note: See TracChangeset for help on using the changeset viewer.