Make WordPress Core

Changeset 38759


Ignore:
Timestamp:
10/08/2016 01:19:11 AM (8 years ago)
Author:
johnbillion
Message:

Build/Test Tools: Make use of PHPUnit's @requires notation.

Fixes #38256

Location:
trunk/tests/phpunit/tests
Files:
3 edited

Legend:

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

    r38758 r38759  
    44 * @group http
    55 * @group external-http
     6 *
     7 * @requires extension openssl
    68 */
    79class Tests_HTTP_Functions extends WP_UnitTestCase {
    8     public function setUp() {
    9         if ( ! extension_loaded( 'openssl' ) ) {
    10             $this->markTestSkipped( 'Tests_HTTP_Functions requires openssl.' );
    11         }
    12 
    13         parent::setUp();
    14     }
    1510
    1611    function test_head_request() {
  • trunk/tests/phpunit/tests/image/functions.php

    r31512 r38759  
    109109     * Test save image file and mime_types
    110110     * @ticket 6821
     111     *
     112     * @requires extension fileinfo
    111113     */
    112114    public function test_wp_save_image_file() {
    113         if ( ! extension_loaded( 'fileinfo' ) ) {
    114             $this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
    115         }
    116 
    117115        include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
    118116
     
    161159     * Test that a passed mime type overrides the extension in the filename
    162160     * @ticket 6821
     161     *
     162     * @requires extension fileinfo
    163163     */
    164164    public function test_mime_overrides_filename() {
    165         if ( ! extension_loaded( 'fileinfo' ) ) {
    166             $this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
    167         }
    168 
    169165        // Test each image editor engine
    170166        $classes = array('WP_Image_Editor_GD', 'WP_Image_Editor_Imagick');
     
    199195     * Test that mime types are correctly inferred from file extensions
    200196     * @ticket 6821
     197     *
     198     * @requires extension fileinfo
    201199     */
    202200    public function test_inferred_mime_types() {
    203         if ( ! extension_loaded( 'fileinfo' ) ) {
    204             $this->markTestSkipped( 'The fileinfo PHP extension is not loaded.' );
    205         }
    206 
    207201        // Mime types
    208202        $mime_types = array(
     
    297291    }
    298292
     293    /**
     294     * @requires extension openssl
     295     * @requires function imagejpeg
     296     */
    299297    public function test_wp_crop_image_url() {
    300         if ( !function_exists( 'imagejpeg' ) )
    301             $this->markTestSkipped( 'jpeg support unavailable' );
    302 
    303         if ( ! extension_loaded( 'openssl' ) ) {
    304             $this->markTestSkipped( 'Tests_Image_Functions::test_wp_crop_image_url() requires openssl.' );
    305         }
    306 
    307298        $file = wp_crop_image( 'https://asdftestblog1.files.wordpress.com/2008/04/canola.jpg',
    308299                              0, 0, 100, 100, 100, 100, false,
     
    324315    }
    325316
     317    /**
     318     * @requires extension openssl
     319     */
    326320    public function test_wp_crop_image_url_not_exist() {
    327         if ( ! extension_loaded( 'openssl' ) ) {
    328             $this->markTestSkipped( 'Tests_Image_Functions::test_wp_crop_image_url_not_exist() requires openssl.' );
    329         }
    330 
    331321        $file = wp_crop_image( 'https://asdftestblog1.files.wordpress.com/2008/04/canoladoesnotexist.jpg',
    332322                              0, 0, 100, 100, 100, 100 );
  • trunk/tests/phpunit/tests/image/meta.php

    r34374 r38759  
    55 * @group media
    66 * @group upload
     7 *
     8 * @requires extension gd
     9 * @requires extension exif
    710 */
    811class Tests_Image_Meta extends WP_UnitTestCase {
    9     function setUp() {
    10         if ( ! extension_loaded( 'gd' ) )
    11             $this->markTestSkipped( 'The gd PHP extension is not loaded.' );
    12         if ( ! extension_loaded( 'exif' ) )
    13             $this->markTestSkipped( 'The exif PHP extension is not loaded.' );
    14         if ( ! is_callable( 'wp_read_image_metadata' ) )
    15             $this->markTestSkipped( 'wp_read_image_metadata() is not callable.' );
    16         parent::setUp();
    17     }
    1812
    1913    function test_exif_d70() {
Note: See TracChangeset for help on using the changeset viewer.