Make WordPress Core

Ticket #47701: 47701.2.patch

File 47701.2.patch, 1.1 KB (added by pbearne, 5 years ago)

cleaned up and removed the duplicate data

  • tests/phpunit/tests/functions/wpGetMimeTypes.php

     
     1<?php
     2
     3/**
     4 * Test wp_get_mime_types().
     5 *
     6 * @group functions.php
     7 */
     8class Tests_wp_get_mime_types extends WP_UnitTestCase {
     9
     10        /**
     11         * @ticket 47701
     12         */
     13        public function test_all_mime_match() {
     14                $mime_types_start = wp_get_mime_types();
     15
     16                $this->assertInternalType( 'array', $mime_types_start );
     17                $this->assertNotEmpty( $mime_types_start );
     18
     19                add_filter( 'mime_types', '__return_empty_array' );
     20                $mime_types_empty = wp_get_mime_types();
     21                $this->assertSame( array(), $mime_types_empty );
     22
     23                remove_filter( 'mime_types', '__return_empty_array' );
     24                $mime_types = wp_get_mime_types();
     25                $this->assertInternalType( 'array', $mime_types );
     26                $this->assertNotEmpty( $mime_types );
     27                // and did it revert to the org after filter remove
     28                $this->assertSame( $mime_types_start, $mime_types );
     29        }
     30}