Unit Tests: Avoid using mime_content_type() as it fails miserably in PHP 5.2.
props bpetty. fixes #26155. git-svn-id: https://develop.svn.wordpress.org/trunk@26705 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a7ee089f6f
commit
e159b7b28a
@ -30,8 +30,6 @@ class Tests_Image_Functions extends WP_UnitTestCase {
|
|||||||
if ( extension_loaded( 'fileinfo' ) ) {
|
if ( extension_loaded( 'fileinfo' ) ) {
|
||||||
$finfo = new finfo();
|
$finfo = new finfo();
|
||||||
$mime_type = $finfo->file( $filename, FILEINFO_MIME );
|
$mime_type = $finfo->file( $filename, FILEINFO_MIME );
|
||||||
} elseif ( function_exists( 'mime_content_type' ) ) {
|
|
||||||
$mime_type = mime_content_type( $filename );
|
|
||||||
}
|
}
|
||||||
if ( false !== strpos( $mime_type, ';' ) ) {
|
if ( false !== strpos( $mime_type, ';' ) ) {
|
||||||
list( $mime_type, $charset ) = explode( ';', $mime_type, 2 );
|
list( $mime_type, $charset ) = explode( ';', $mime_type, 2 );
|
||||||
@ -112,7 +110,7 @@ class Tests_Image_Functions extends WP_UnitTestCase {
|
|||||||
* @ticket 6821
|
* @ticket 6821
|
||||||
*/
|
*/
|
||||||
public function test_wp_save_image_file() {
|
public function test_wp_save_image_file() {
|
||||||
if ( ! extension_loaded( 'fileinfo' ) && ! function_exists( 'mime_content_type' ) ) {
|
if ( ! extension_loaded( 'fileinfo' ) ) {
|
||||||
$this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
|
$this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,7 +158,7 @@ class Tests_Image_Functions extends WP_UnitTestCase {
|
|||||||
* @ticket 6821
|
* @ticket 6821
|
||||||
*/
|
*/
|
||||||
public function test_mime_overrides_filename() {
|
public function test_mime_overrides_filename() {
|
||||||
if ( ! extension_loaded( 'fileinfo' ) && ! function_exists( 'mime_content_type' ) ) {
|
if ( ! extension_loaded( 'fileinfo' ) ) {
|
||||||
$this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
|
$this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +196,7 @@ class Tests_Image_Functions extends WP_UnitTestCase {
|
|||||||
* @ticket 6821
|
* @ticket 6821
|
||||||
*/
|
*/
|
||||||
public function test_inferred_mime_types() {
|
public function test_inferred_mime_types() {
|
||||||
if ( ! extension_loaded( 'fileinfo' ) && ! function_exists( 'mime_content_type' ) ) {
|
if ( ! extension_loaded( 'fileinfo' ) ) {
|
||||||
$this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
|
$this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user