Tests: Convert the checks for imagejpeg() function availability to use the @requires annotation.

This better utilizes the PHPUnit native functionality.

Props ayeshrajans, jrf, johnbillion.
Fixes #50639. See #50640.

git-svn-id: https://develop.svn.wordpress.org/trunk@49024 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-09-21 11:34:06 +00:00
parent f7570fec4a
commit b984a64c98
4 changed files with 34 additions and 73 deletions
+2 -8
View File
@@ -143,14 +143,11 @@ class Tests_Functions_Deprecated extends WP_UnitTestCase {
*
* @ticket 6821
* @expectedDeprecated wp_save_image_file
* @requires function imagejpeg
*
* @covers ::wp_save_image_file
*/
public function test_wp_save_image_file_deprecated_with_gd_resource() {
if ( ! function_exists( 'imagejpeg' ) ) {
$this->fail( 'jpeg support unavailable' );
}
// Call wp_save_image_file().
require_once ABSPATH . 'wp-admin/includes/image-edit.php';
$file = wp_tempnam();
@@ -168,14 +165,11 @@ class Tests_Functions_Deprecated extends WP_UnitTestCase {
* Tests that wp_save_image_file() doesn't have a deprecated argument when passed a WP_Image_Editor.
*
* @ticket 6821
* @requires function imagejpeg
*
* @covers ::wp_save_image_file
*/
public function test_wp_save_image_file_not_deprecated_with_wp_image_editor() {
if ( ! function_exists( 'imagejpeg' ) ) {
$this->fail( 'jpeg support unavailable' );
}
// Call wp_save_image_file().
require_once ABSPATH . 'wp-admin/includes/image-edit.php';
$file = wp_tempnam();