Make WordPress Core


Ignore:
Timestamp:
04/29/2016 05:51:54 PM (10 years ago)
Author:
wonderboymusic
Message:

Media/Unit Tests: ensure that image sizes are indeed removed when errors are raised before assertions in Tests_Media.

See #36588.

File:
1 edited

Legend:

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

    r35348 r37328  
    88        function tearDown() {
    99                $this->remove_added_uploads();
     10
     11                remove_image_size( 'test-size' );
     12                remove_image_size( 'false-height' );
     13                remove_image_size( 'false-width' );
     14                remove_image_size( 'off-by-one' );
    1015                parent::tearDown();
    1116        }
     
    7075                $image = image_get_intermediate_size( $id, 'test-size' );
    7176
    72                 // test for the expected string because the array will by definition
    73                 // return with the correct height and width attributes
    74                 $this->assertTrue( strpos( $image['file'], '330x220' ) > 0 );
    75 
    7677                // cleanup
    7778                remove_image_size( 'test-size' );
     79
     80                // test for the expected string because the array will by definition
     81                // return with the correct height and width attributes
     82                $this->assertTrue( strpos( $image['file'], '330x220' ) > 0 );
    7883        }
    7984
     
    97102                // return with the correct height and width attributes
    98103                $this->assertTrue( strpos( $image['file'], '330x220' ) > 0 );
    99 
    100                 // cleanup
    101                 remove_image_size( 'test-size' );
    102                 remove_image_size( 'false-height' );
    103                 remove_image_size( 'false-width' );
    104104        }
    105105
     
    124124                // return with the correct height and width attributes
    125125                $this->assertTrue( strpos( $image['file'], '450x300' ) > 0 );
    126 
    127                 // cleanup
    128                 remove_image_size( 'test-size' );
    129                 remove_image_size( 'false-height' );
    130                 remove_image_size( 'false-width' );
    131126        }
    132127
     
    150145                // return with the correct height and width attributes
    151146                $this->assertFalse( $image );
    152 
    153                 // cleanup
    154                 remove_image_size( 'false-height' );
    155                 remove_image_size( 'false-width' );
    156147        }
    157148
     
    181172                // return with the correct height and width attributes
    182173                $this->assertTrue( strpos( $image['file'], $image_w . 'x' . $image_h ) > 0 );
    183 
    184                 // cleanup
    185                 remove_image_size( 'test-size' );
    186                 remove_image_size( 'false-height' );
    187174        }
    188175
     
    213200                // return with the correct height and width attributes
    214201                $this->assertTrue( strpos( $image['file'], $image_w . 'x' . $image_h ) > 0 );
    215 
    216                 // cleanup
    217                 remove_image_size( 'test-size' );
    218                 remove_image_size( 'false-height' );
    219202        }
    220203
     
    241224
    242225                $this->assertTrue( strpos( $image['file'], $width . 'x' . $height ) > 0 );
    243 
    244                 // cleanup
    245                 remove_image_size( 'off-by-one' );
    246226        }
    247227}
Note: See TracChangeset for help on using the changeset viewer.