Make WordPress Core


Ignore:
Timestamp:
09/21/2020 01:25:38 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: Convert a few more function_exists() and extension_loaded() checks to @requires annotations.

This better utilizes the PHPUnit native functionality.

Follow-up to [49024].

See #50639, #50640.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/image/functions.php

    r49024 r49025  
    150150     *
    151151     * @ticket 6821
     152     * @requires extension fileinfo
    152153     */
    153154    public function test_wp_save_image_file() {
    154         if ( ! extension_loaded( 'fileinfo' ) ) {
    155             $this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
    156         }
    157 
    158155        $classes = array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' );
    159156
     
    209206     *
    210207     * @ticket 6821
     208     * @requires extension fileinfo
    211209     */
    212210    public function test_mime_overrides_filename() {
    213         if ( ! extension_loaded( 'fileinfo' ) ) {
    214             $this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
    215         }
    216 
    217211        $classes = array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' );
    218212
     
    254248     *
    255249     * @ticket 6821
     250     * @requires extension fileinfo
    256251     */
    257252    public function test_inferred_mime_types() {
    258         if ( ! extension_loaded( 'fileinfo' ) ) {
    259             $this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
    260         }
    261 
    262253        $classes = array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' );
    263254
     
    374365    /**
    375366     * @requires function imagejpeg
     367     * @requires extension openssl
    376368     */
    377369    public function test_wp_crop_image_url() {
    378         if ( ! extension_loaded( 'openssl' ) ) {
    379             $this->markTestSkipped( 'Tests_Image_Functions::test_wp_crop_image_url() requires openssl.' );
    380         }
    381 
    382370        $file = wp_crop_image(
    383371            'https://asdftestblog1.files.wordpress.com/2008/04/canola.jpg',
     
    419407    }
    420408
     409    /**
     410     * @requires extension openssl
     411     */
    421412    public function test_wp_crop_image_url_not_exist() {
    422         if ( ! extension_loaded( 'openssl' ) ) {
    423             $this->markTestSkipped( 'Tests_Image_Functions::test_wp_crop_image_url_not_exist() requires openssl.' );
    424         }
    425 
    426413        $file = wp_crop_image(
    427414            'https://asdftestblog1.files.wordpress.com/2008/04/canoladoesnotexist.jpg',
Note: See TracChangeset for help on using the changeset viewer.