mirror of
git://develop.git.wordpress.org/
synced 2025-01-18 05:18:42 +01:00
Build/Test Tools: Make use of PHPUnit's @requires
notation.
Fixes #38256 git-svn-id: https://develop.svn.wordpress.org/trunk@38759 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
3fad194f64
commit
b3d15125a6
@ -3,15 +3,10 @@
|
||||
/**
|
||||
* @group http
|
||||
* @group external-http
|
||||
*
|
||||
* @requires extension openssl
|
||||
*/
|
||||
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() {
|
||||
// this url give a direct 200 response
|
||||
|
@ -108,12 +108,10 @@ class Tests_Image_Functions extends WP_UnitTestCase {
|
||||
/**
|
||||
* Test save image file and mime_types
|
||||
* @ticket 6821
|
||||
*
|
||||
* @requires extension fileinfo
|
||||
*/
|
||||
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' );
|
||||
|
||||
// Mime types
|
||||
@ -160,12 +158,10 @@ class Tests_Image_Functions extends WP_UnitTestCase {
|
||||
/**
|
||||
* Test that a passed mime type overrides the extension in the filename
|
||||
* @ticket 6821
|
||||
*
|
||||
* @requires extension fileinfo
|
||||
*/
|
||||
public function test_mime_overrides_filename() {
|
||||
if ( ! extension_loaded( 'fileinfo' ) ) {
|
||||
$this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
|
||||
}
|
||||
|
||||
// Test each image editor engine
|
||||
$classes = array('WP_Image_Editor_GD', 'WP_Image_Editor_Imagick');
|
||||
foreach ( $classes as $class ) {
|
||||
@ -198,12 +194,10 @@ class Tests_Image_Functions extends WP_UnitTestCase {
|
||||
/**
|
||||
* Test that mime types are correctly inferred from file extensions
|
||||
* @ticket 6821
|
||||
*
|
||||
* @requires extension fileinfo
|
||||
*/
|
||||
public function test_inferred_mime_types() {
|
||||
if ( ! extension_loaded( 'fileinfo' ) ) {
|
||||
$this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
|
||||
}
|
||||
|
||||
// Mime types
|
||||
$mime_types = array(
|
||||
'jpg' => 'image/jpeg',
|
||||
@ -296,14 +290,11 @@ class Tests_Image_Functions extends WP_UnitTestCase {
|
||||
unlink( $file );
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires extension openssl
|
||||
* @requires function imagejpeg
|
||||
*/
|
||||
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',
|
||||
0, 0, 100, 100, 100, 100, false,
|
||||
DIR_TESTDATA . '/images/' . rand_str() . '.jpg' );
|
||||
@ -323,11 +314,10 @@ class Tests_Image_Functions extends WP_UnitTestCase {
|
||||
$this->assertInstanceOf( 'WP_Error', $file );
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires extension openssl
|
||||
*/
|
||||
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',
|
||||
0, 0, 100, 100, 100, 100 );
|
||||
$this->assertInstanceOf( 'WP_Error', $file );
|
||||
|
@ -4,17 +4,11 @@
|
||||
* @group image
|
||||
* @group media
|
||||
* @group upload
|
||||
*
|
||||
* @requires extension gd
|
||||
* @requires extension exif
|
||||
*/
|
||||
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() {
|
||||
// exif from a Nikon D70
|
||||
|
Loading…
x
Reference in New Issue
Block a user