Skip image mime type tests if both fileinfo PHP extension and mime_content_type() function are missing.

fixes #26155.

git-svn-id: https://develop.svn.wordpress.org/trunk@26318 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2013-11-22 05:37:35 +00:00
parent 2388095150
commit 27972a39a1
1 changed files with 11 additions and 1 deletions

View File

@ -30,7 +30,7 @@ class Tests_Image_Functions extends WP_UnitTestCase {
if ( extension_loaded( 'fileinfo' ) ) {
$finfo = new finfo();
$mime_type = $finfo->file( $filename, FILEINFO_MIME );
} elseif ( function_exists('mime_content_type') ) {
} elseif ( function_exists( 'mime_content_type' ) ) {
$mime_type = mime_content_type( $filename );
}
if ( false !== strpos( $mime_type, ';' ) ) {
@ -112,6 +112,10 @@ class Tests_Image_Functions extends WP_UnitTestCase {
* @ticket 6821
*/
public function test_wp_save_image_file() {
if ( ! extension_loaded( 'fileinfo' ) && ! function_exists( 'mime_content_type' ) ) {
$this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
}
include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
// Mime types
@ -156,6 +160,9 @@ class Tests_Image_Functions extends WP_UnitTestCase {
* @ticket 6821
*/
public function test_mime_overrides_filename() {
if ( ! extension_loaded( 'fileinfo' ) && ! function_exists( 'mime_content_type' ) ) {
$this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
}
// Test each image editor engine
$classes = array('WP_Image_Editor_GD', 'WP_Image_Editor_Imagick');
@ -191,6 +198,9 @@ class Tests_Image_Functions extends WP_UnitTestCase {
* @ticket 6821
*/
public function test_inferred_mime_types() {
if ( ! extension_loaded( 'fileinfo' ) && ! function_exists( 'mime_content_type' ) ) {
$this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
}
// Mime types
$mime_types = array(