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/functions.php

    r48937 r49025  
    943943    /**
    944944     * @ticket 28786
     945     * @requires function mb_detect_order
    945946     */
    946947    function test_wp_json_encode_non_utf8() {
    947         if ( ! function_exists( 'mb_detect_order' ) ) {
    948             $this->markTestSkipped( 'mbstring extension not available.' );
    949         }
    950 
    951948        $charsets     = mb_detect_order();
    952949        $old_charsets = $charsets;
     
    968965    /**
    969966     * @ticket 28786
     967     * @requires function mb_detect_order
    970968     */
    971969    function test_wp_json_encode_non_utf8_in_array() {
    972         if ( ! function_exists( 'mb_detect_order' ) ) {
    973             $this->markTestSkipped( 'mbstring extension not available.' );
    974         }
    975 
    976970        $charsets     = mb_detect_order();
    977971        $old_charsets = $charsets;
     
    12111205     * @ticket 39550
    12121206     * @dataProvider _wp_check_filetype_and_ext_data
     1207     * @requires extension fileinfo
    12131208     */
    12141209    function test_wp_check_filetype_and_ext( $file, $filename, $expected ) {
    1215         if ( ! extension_loaded( 'fileinfo' ) ) {
    1216             $this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
    1217         }
    1218 
    12191210        $this->assertSame( $expected, wp_check_filetype_and_ext( $file, $filename ) );
    12201211    }
     
    12231214     * @ticket 39550
    12241215     * @group ms-excluded
     1216     * @requires extension fileinfo
    12251217     */
    12261218    function test_wp_check_filetype_and_ext_with_filtered_svg() {
    1227         if ( ! extension_loaded( 'fileinfo' ) ) {
    1228             $this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
    1229         }
    1230 
    12311219        $file     = DIR_TESTDATA . '/uploads/video-play.svg';
    12321220        $filename = 'video-play.svg';
     
    12481236     * @ticket 39550
    12491237     * @group ms-excluded
     1238     * @requires extension fileinfo
    12501239     */
    12511240    function test_wp_check_filetype_and_ext_with_filtered_woff() {
    1252         if ( ! extension_loaded( 'fileinfo' ) ) {
    1253             $this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
    1254         }
    1255 
    12561241        $file     = DIR_TESTDATA . '/uploads/dashicons.woff';
    12571242        $filename = 'dashicons.woff';
Note: See TracChangeset for help on using the changeset viewer.