Build/Test Tools: Revert [38759]. PHPUnit's `@requires` syntax was introduced in PHPUnit 3.7, but the tests for PHP 5.2 use PHPUnit 3.6 because it's the latest version that supports PHP 5.2.
Fixes #38256 git-svn-id: https://develop.svn.wordpress.org/trunk@38761 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
471103de31
commit
b45f2feada
|
@ -3,10 +3,15 @@
|
||||||
/**
|
/**
|
||||||
* @group http
|
* @group http
|
||||||
* @group external-http
|
* @group external-http
|
||||||
*
|
|
||||||
* @requires extension openssl
|
|
||||||
*/
|
*/
|
||||||
class Tests_HTTP_Functions extends WP_UnitTestCase {
|
class Tests_HTTP_Functions extends WP_UnitTestCase {
|
||||||
|
public function setUp() {
|
||||||
|
if ( ! extension_loaded( 'openssl' ) ) {
|
||||||
|
$this->markTestSkipped( 'Tests_HTTP_Functions requires openssl.' );
|
||||||
|
}
|
||||||
|
|
||||||
|
parent::setUp();
|
||||||
|
}
|
||||||
|
|
||||||
function test_head_request() {
|
function test_head_request() {
|
||||||
// this url give a direct 200 response
|
// this url give a direct 200 response
|
||||||
|
|
|
@ -108,10 +108,12 @@ class Tests_Image_Functions extends WP_UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* Test save image file and mime_types
|
* Test save image file and mime_types
|
||||||
* @ticket 6821
|
* @ticket 6821
|
||||||
*
|
|
||||||
* @requires extension fileinfo
|
|
||||||
*/
|
*/
|
||||||
public function test_wp_save_image_file() {
|
public function test_wp_save_image_file() {
|
||||||
|
if ( ! extension_loaded( 'fileinfo' ) ) {
|
||||||
|
$this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
|
||||||
|
}
|
||||||
|
|
||||||
include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
|
include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
|
||||||
|
|
||||||
// Mime types
|
// Mime types
|
||||||
|
@ -158,10 +160,12 @@ class Tests_Image_Functions extends WP_UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* Test that a passed mime type overrides the extension in the filename
|
* Test that a passed mime type overrides the extension in the filename
|
||||||
* @ticket 6821
|
* @ticket 6821
|
||||||
*
|
|
||||||
* @requires extension fileinfo
|
|
||||||
*/
|
*/
|
||||||
public function test_mime_overrides_filename() {
|
public function test_mime_overrides_filename() {
|
||||||
|
if ( ! extension_loaded( 'fileinfo' ) ) {
|
||||||
|
$this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
|
||||||
|
}
|
||||||
|
|
||||||
// Test each image editor engine
|
// Test each image editor engine
|
||||||
$classes = array('WP_Image_Editor_GD', 'WP_Image_Editor_Imagick');
|
$classes = array('WP_Image_Editor_GD', 'WP_Image_Editor_Imagick');
|
||||||
foreach ( $classes as $class ) {
|
foreach ( $classes as $class ) {
|
||||||
|
@ -194,10 +198,12 @@ class Tests_Image_Functions extends WP_UnitTestCase {
|
||||||
/**
|
/**
|
||||||
* Test that mime types are correctly inferred from file extensions
|
* Test that mime types are correctly inferred from file extensions
|
||||||
* @ticket 6821
|
* @ticket 6821
|
||||||
*
|
|
||||||
* @requires extension fileinfo
|
|
||||||
*/
|
*/
|
||||||
public function test_inferred_mime_types() {
|
public function test_inferred_mime_types() {
|
||||||
|
if ( ! extension_loaded( 'fileinfo' ) ) {
|
||||||
|
$this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
|
||||||
|
}
|
||||||
|
|
||||||
// Mime types
|
// Mime types
|
||||||
$mime_types = array(
|
$mime_types = array(
|
||||||
'jpg' => 'image/jpeg',
|
'jpg' => 'image/jpeg',
|
||||||
|
@ -290,11 +296,14 @@ class Tests_Image_Functions extends WP_UnitTestCase {
|
||||||
unlink( $file );
|
unlink( $file );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @requires extension openssl
|
|
||||||
* @requires function imagejpeg
|
|
||||||
*/
|
|
||||||
public function test_wp_crop_image_url() {
|
public function test_wp_crop_image_url() {
|
||||||
|
if ( !function_exists( 'imagejpeg' ) )
|
||||||
|
$this->markTestSkipped( 'jpeg support unavailable' );
|
||||||
|
|
||||||
|
if ( ! extension_loaded( 'openssl' ) ) {
|
||||||
|
$this->markTestSkipped( 'Tests_Image_Functions::test_wp_crop_image_url() requires openssl.' );
|
||||||
|
}
|
||||||
|
|
||||||
$file = wp_crop_image( 'https://asdftestblog1.files.wordpress.com/2008/04/canola.jpg',
|
$file = wp_crop_image( 'https://asdftestblog1.files.wordpress.com/2008/04/canola.jpg',
|
||||||
0, 0, 100, 100, 100, 100, false,
|
0, 0, 100, 100, 100, 100, false,
|
||||||
DIR_TESTDATA . '/images/' . rand_str() . '.jpg' );
|
DIR_TESTDATA . '/images/' . rand_str() . '.jpg' );
|
||||||
|
@ -314,10 +323,11 @@ class Tests_Image_Functions extends WP_UnitTestCase {
|
||||||
$this->assertInstanceOf( 'WP_Error', $file );
|
$this->assertInstanceOf( 'WP_Error', $file );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @requires extension openssl
|
|
||||||
*/
|
|
||||||
public function test_wp_crop_image_url_not_exist() {
|
public function test_wp_crop_image_url_not_exist() {
|
||||||
|
if ( ! extension_loaded( 'openssl' ) ) {
|
||||||
|
$this->markTestSkipped( 'Tests_Image_Functions::test_wp_crop_image_url_not_exist() requires openssl.' );
|
||||||
|
}
|
||||||
|
|
||||||
$file = wp_crop_image( 'https://asdftestblog1.files.wordpress.com/2008/04/canoladoesnotexist.jpg',
|
$file = wp_crop_image( 'https://asdftestblog1.files.wordpress.com/2008/04/canoladoesnotexist.jpg',
|
||||||
0, 0, 100, 100, 100, 100 );
|
0, 0, 100, 100, 100, 100 );
|
||||||
$this->assertInstanceOf( 'WP_Error', $file );
|
$this->assertInstanceOf( 'WP_Error', $file );
|
||||||
|
|
|
@ -4,11 +4,17 @@
|
||||||
* @group image
|
* @group image
|
||||||
* @group media
|
* @group media
|
||||||
* @group upload
|
* @group upload
|
||||||
*
|
|
||||||
* @requires extension gd
|
|
||||||
* @requires extension exif
|
|
||||||
*/
|
*/
|
||||||
class Tests_Image_Meta extends WP_UnitTestCase {
|
class Tests_Image_Meta extends WP_UnitTestCase {
|
||||||
|
function setUp() {
|
||||||
|
if ( ! extension_loaded( 'gd' ) )
|
||||||
|
$this->markTestSkipped( 'The gd PHP extension is not loaded.' );
|
||||||
|
if ( ! extension_loaded( 'exif' ) )
|
||||||
|
$this->markTestSkipped( 'The exif PHP extension is not loaded.' );
|
||||||
|
if ( ! is_callable( 'wp_read_image_metadata' ) )
|
||||||
|
$this->markTestSkipped( 'wp_read_image_metadata() is not callable.' );
|
||||||
|
parent::setUp();
|
||||||
|
}
|
||||||
|
|
||||||
function test_exif_d70() {
|
function test_exif_d70() {
|
||||||
// exif from a Nikon D70
|
// exif from a Nikon D70
|
||||||
|
|
Loading…
Reference in New Issue