Media: Add a unit test for `wp_get_mime_types()`.
Props pbearne. Fixes #47701. git-svn-id: https://develop.svn.wordpress.org/trunk@45646 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
9d00289c60
commit
2ae276c44f
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Test wp_get_mime_types().
|
||||
*
|
||||
* @group functions.php
|
||||
*/
|
||||
class Tests_wp_get_mime_types extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 47701
|
||||
*/
|
||||
public function test_all_mime_match() {
|
||||
$mime_types_start = wp_get_mime_types();
|
||||
|
||||
$this->assertInternalType( 'array', $mime_types_start );
|
||||
$this->assertNotEmpty( $mime_types_start );
|
||||
|
||||
add_filter( 'mime_types', '__return_empty_array' );
|
||||
$mime_types_empty = wp_get_mime_types();
|
||||
$this->assertSame( array(), $mime_types_empty );
|
||||
|
||||
remove_filter( 'mime_types', '__return_empty_array' );
|
||||
$mime_types = wp_get_mime_types();
|
||||
$this->assertInternalType( 'array', $mime_types );
|
||||
$this->assertNotEmpty( $mime_types );
|
||||
// Did it revert to the original after filter remove?
|
||||
$this->assertSame( $mime_types_start, $mime_types );
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue