WordPress.org

Make WordPress Core

Changeset 498 in tests


Ignore:
Timestamp:
01/31/2012 09:50:59 PM (6 years ago)
Author:
convissor
Message:

Skip TestImageResize tests if gd extension is not installed.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_image.php

    r408 r498  
    443443class TestImageResize extends WPTestCase {
    444444    // image_resize( $file, $max_w, $max_h, $crop=false, $suffix=null, $dest_path=null, $jpeg_quality=75)
     445
     446    function setUp() {
     447        $this->checkPHPExtension('gd');
     448        parent::setUp();
     449    }
    445450
    446451    function test_resize_jpg() {
  • wp-testlib/base.php

    r477 r498  
    450450    }
    451451
     452    /**
     453     * Skips the current test the given PHP extension is not loaded
     454     * @param string $ext  the PHP extension name to check
     455     * @return void
     456     */
     457    function checkPHPExtension($ext) {
     458        if ( !extension_loaded($ext) ) {
     459            $this->markTestSkipped("The $ext PHP extension is not loaded.");
     460        }
     461    }
    452462
    453463    // convenience function: return the # of posts associated with a tag
Note: See TracChangeset for help on using the changeset viewer.