Make WordPress Core

Changeset 50251 for branches/3.7/tests


Ignore:
Timestamp:
02/08/2021 08:58:53 PM (5 years ago)
Author:
desrosj
Message:

Build/Test Tools: Backport the local Docker environment to the 3.7 branch.

This commit introduces the Docker-based local WordPress development environment to the 3.7 branch.

Merges [44176,45445,45745,45762,45783-45784,45800,45819,45885,46320,46999,47225,47912,48121,49267,49335,49358,49360,49362] to the 3.7 branch.
See #47767.
Fixes #48301.

Location:
branches/3.7
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/3.7

  • branches/3.7/tests/phpunit/tests/image/base.php

    r47343 r50251  
    3838
    3939    /**
    40      * Helper assertion for testing alpha on images
     40     * Helper assertion for testing alpha on images using GD library
    4141     *
    4242     * @param  string $image_path
     
    4444     * @param  int $alpha
    4545     */
    46     protected function assertImageAlphaAtPoint( $image_path, $point, $alpha ) {
     46    protected function assertImageAlphaAtPointGD( $image_path, $point, $alpha ) {
    4747
    4848        $im = imagecreatefrompng( $image_path );
     
    5353        $this->assertEquals( $alpha, $colors['alpha'] );
    5454    }
     55
     56    /**
     57     * Helper assertion for testing alpha on images using Imagick
     58     *
     59     * @param string $image_path
     60     * @param array $point      array(x,y)
     61     * @param int $expected
     62     */
     63    protected function assertImageAlphaAtPointImagick( $image_path, $point, $expected ) {
     64        $im = new Imagick( $image_path );
     65        $pixel = $im->getImagePixelColor( $point[0], $point[1] );
     66        $color = $pixel->getColorValue( imagick::COLOR_ALPHA );
     67        $this->assertEquals( $expected, $color );
     68    }
    5569}
  • branches/3.7/tests/phpunit/tests/image/editor_gd.php

    r47343 r50251  
    3333    /**
    3434     * Check support for GD compatible mime types.
    35      * 
     35     *
    3636     */
    3737    public function test_supports_mime_type() {
     
    4545    /**
    4646     * Test resizing an image, not using crop
    47      * 
     47     *
    4848     */
    4949    public function test_resize() {
     
    6161    /**
    6262     * Test resizing an image including cropping
    63      * 
     63     *
    6464     */
    6565    public function test_resize_and_crop() {
     
    133133    /**
    134134     * Test the image created with WP_Image_Edior_GD preserves alpha when resizing
    135      * 
     135     *
    136136     * @ticket 23039
    137137     */
     
    144144        $editor->resize(5,5);
    145145        $save_to_file = tempnam( get_temp_dir(), '' ) . '.png';
    146        
     146
    147147        $editor->save( $save_to_file );
    148148
    149         $this->assertImageAlphaAtPoint( $save_to_file, array( 0,0 ), 127 );
     149        $this->assertImageAlphaAtPointGD( $save_to_file, array( 0,0 ), 127 );
    150150
    151151        unlink( $save_to_file );
    152152    }
    153    
     153
    154154    /**
    155155     * Test the image created with WP_Image_Edior_GD preserves alpha with no resizing etc
    156      * 
     156     *
    157157     * @ticket 23039
    158158     */
     
    165165
    166166        $save_to_file = tempnam( get_temp_dir(), '' ) . '.png';
    167        
     167
    168168        $editor->save( $save_to_file );
    169169
    170         $this->assertImageAlphaAtPoint( $save_to_file, array( 0,0 ), 127 );
     170        $this->assertImageAlphaAtPointGD( $save_to_file, array( 0,0 ), 127 );
    171171
    172172        unlink( $save_to_file );
  • branches/3.7/tests/phpunit/tests/image/editor_imagick.php

    r47343 r50251  
    3939    /**
    4040     * Check support for Image Magick compatible mime types.
    41      * 
     41     *
    4242     */
    4343    public function test_supports_mime_type() {
     
    5252    /**
    5353     * Test resizing an image, not using crop
    54      * 
     54     *
    5555     */
    5656    public function test_resize() {
     
    6868    /**
    6969     * Test resizing an image including cropping
    70      * 
     70     *
    7171     */
    7272    public function test_resize_and_crop() {
     
    151151        $editor->resize(5,5);
    152152        $save_to_file = tempnam( get_temp_dir(), '' ) . '.png';
    153        
     153
    154154        $editor->save( $save_to_file );
    155155
    156         $this->assertImageAlphaAtPoint( $save_to_file, array( 0,0 ), 127 );
     156        $im = new Imagick( $save_to_file );
     157        $pixel = $im->getImagePixelColor( 0, 0 );
     158        $expected = $pixel->getColorValue( imagick::COLOR_ALPHA );
     159
     160        $this->assertImageAlphaAtPointImagick( $save_to_file, array( 0,0 ), $expected );
    157161
    158162        unlink( $save_to_file );
    159163    }
    160    
     164
    161165    /**
    162166     * Test the image created with WP_Image_Edior_Imagick preserves alpha with no resizing etc
     
    175179        $editor->save( $save_to_file );
    176180
    177         $this->assertImageAlphaAtPoint( $save_to_file, array( 0,0 ), 127 );
     181        $im = new Imagick( $save_to_file );
     182        $pixel = $im->getImagePixelColor( 0, 0 );
     183        $expected = $pixel->getColorValue( imagick::COLOR_ALPHA );
     184
     185        $this->assertImageAlphaAtPointImagick( $save_to_file, array( 0,0 ), $expected );
    178186
    179187        unlink( $save_to_file );
Note: See TracChangeset for help on using the changeset viewer.