WordPress.org

Make WordPress Core

Changeset 503 in tests


Ignore:
Timestamp:
02/01/12 06:33:16 (2 years ago)
Author:
convissor
Message:

Skip remaining gd functions if gd not installed. Move method callable skips to setUp. Use message parameter when skipping.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testcase/test_image.php

    r498 r503  
    22 
    33class TestImageMetaFunctions extends WPTestCase { 
     4    function setUp() { 
     5        $this->checkPHPExtension('gd'); 
     6        if (!is_callable('wp_read_image_metadata')) 
     7            $this->markTestSkipped('wp_read_image_metadata() is not callable.'); 
     8        parent::setUp(); 
     9    } 
    410 
    511    function test_exif_d70() { 
    6         if (!is_callable('wp_read_image_metadata')) 
    7             $this->markTestSkipped(); 
    8  
    912        // exif from a Nikon D70 
    1013        $out = wp_read_image_metadata(DIR_TESTDATA.'/images/2004-07-22-DSC_0008.jpg'); 
     
    2326 
    2427    function test_exif_d70_mf() { 
    25         if (!is_callable('wp_read_image_metadata')) 
    26             $this->markTestSkipped(); 
    27  
    2828        // exif from a Nikon D70 - manual focus lens, so some data is unavailable 
    2929        $out = wp_read_image_metadata(DIR_TESTDATA.'/images/2007-06-17DSC_4173.JPG'); 
     
    4343 
    4444    function test_exif_d70_iptc() { 
    45         if (!is_callable('wp_read_image_metadata')) 
    46             $this->markTestSkipped(); 
    47  
    4845        // exif from a Nikon D70 with IPTC data added later 
    4946        $out = wp_read_image_metadata(DIR_TESTDATA.'/images/2004-07-22-DSC_0007.jpg'); 
     
    6259 
    6360    function test_exif_fuji() { 
    64         if (!is_callable('wp_read_image_metadata')) 
    65             $this->markTestSkipped(); 
    66  
    6761        // exif from a Fuji FinePix S5600 (thanks Mark) 
    6862        $out = wp_read_image_metadata(DIR_TESTDATA.'/images/a2-small.jpg'); 
     
    8276 
    8377    function test_exif_error() { 
    84         if (!is_callable('wp_read_image_metadata')) 
    85             $this->markTestSkipped(); 
    86  
    8778        $this->knownWPBug(6571); 
    8879 
     
    9182        $out = wp_read_image_metadata(DIR_TESTDATA.'/images/waffles.jpg'); 
    9283 
     84        $this->assertFalse($out, 'Should have returned FASLE on error.'); 
    9385        $this->assertEquals(0, $out['aperture']); 
    9486        $this->assertEquals('', $out['credit']); 
     
    10496 
    10597    function test_exif_no_data() { 
    106         if (!is_callable('wp_read_image_metadata')) 
    107             $this->markTestSkipped(); 
    108  
    10998        // no exif data in this image (from burningwell.org) 
    11099        $out = wp_read_image_metadata(DIR_TESTDATA.'/images/canola.jpg'); 
    111100 
     101        $this->assertFalse($out, 'Should have returned FASLE on error.'); 
    112102        $this->assertEquals(0, $out['aperture']); 
    113103        $this->assertEquals('', $out['credit']); 
     
    127117    function test_constrain_dims_zero() { 
    128118        if (!is_callable('wp_constrain_dimensions')) 
    129             $this->markTestSkipped(); 
     119            $this->markTestSkipped('wp_constrain_dimensions() is not callable.'); 
    130120 
    131121        // no constraint - should have no effect 
     
    142132    function test_constrain_dims_smaller() { 
    143133        if (!is_callable('wp_constrain_dimensions')) 
    144             $this->markTestSkipped(); 
     134            $this->markTestSkipped('wp_constrain_dimensions() is not callable.'); 
    145135 
    146136        // image size is smaller than the constraint - no effect 
     
    157147    function test_constrain_dims_equal() { 
    158148        if (!is_callable('wp_constrain_dimensions')) 
    159             $this->markTestSkipped(); 
     149            $this->markTestSkipped('wp_constrain_dimensions() is not callable.'); 
    160150 
    161151        // image size is equal to the constraint - no effect 
     
    172162    function test_constrain_dims_larger() { 
    173163        if (!is_callable('wp_constrain_dimensions')) 
    174             $this->markTestSkipped(); 
     164            $this->markTestSkipped('wp_constrain_dimensions() is not callable.'); 
    175165 
    176166        // image size is larger than the constraint - result should be constrained 
     
    197187    function test_constrain_dims_boundary() { 
    198188        if (!is_callable('wp_constrain_dimensions')) 
    199             $this->markTestSkipped(); 
     189            $this->markTestSkipped('wp_constrain_dimensions() is not callable.'); 
    200190 
    201191        // one dimension is larger than the constraint, one smaller - result should be constrained 
Note: See TracChangeset for help on using the changeset viewer.