WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/02/2020 12:35:36 AM (17 months ago)
Author:
SergeyBiryukov
Message:

Tests: First pass at using assertSame() instead of assertEquals() in most of the unit tests.

This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using assertSame() should generally be preferred to assertEquals() where appropriate, to make the tests more reliable.

Props johnbillion, jrf, SergeyBiryukov.
See #38266.

File:
1 edited

Legend:

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

    r46586 r48937  
    4949        $colors = imagecolorsforindex( $im, $rgb );
    5050
    51         $this->assertEquals( $alpha, $colors['alpha'] );
     51        $this->assertSame( $alpha, $colors['alpha'] );
    5252    }
    5353
     
    6363        $pixel = $im->getImagePixelColor( $point[0], $point[1] );
    6464        $color = $pixel->getColorValue( imagick::COLOR_ALPHA );
    65         $this->assertEquals( $expected, $color );
     65        $this->assertSame( $expected, $color );
    6666    }
    6767
     
    8686        }
    8787
    88         $this->assertEquals( $width, $detected_width );
    89         $this->assertEquals( $height, $detected_height );
     88        $this->assertSame( $width, $detected_width );
     89        $this->assertSame( $height, $detected_height );
    9090    }
    9191}
Note: See TracChangeset for help on using the changeset viewer.