Make WordPress Core


Ignore:
Timestamp:
10/07/2022 01:02:07 AM (2 years ago)
Author:
desrosj
Message:

Tests: Replace some occurrences of assertEquals() with assertSame().

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

Props costdev, desrosj.
See #55654.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/functions.php

    r53934 r54402  
    20572057     */
    20582058    public function test_wp_get_default_extension_for_mime_type() {
    2059         $this->assertEquals( 'jpg', wp_get_default_extension_for_mime_type( 'image/jpeg' ), 'jpg not returned as default extension for "image/jpeg"' );
     2059        $this->assertSame( 'jpg', wp_get_default_extension_for_mime_type( 'image/jpeg' ), 'jpg not returned as default extension for "image/jpeg"' );
    20602060        $this->assertNotEquals( 'jpeg', wp_get_default_extension_for_mime_type( 'image/jpeg' ), 'jpeg should not be returned as default extension for "image/jpeg"' );
    2061         $this->assertEquals( 'png', wp_get_default_extension_for_mime_type( 'image/png' ), 'png not returned as default extension for "image/png"' );
     2061        $this->assertSame( 'png', wp_get_default_extension_for_mime_type( 'image/png' ), 'png not returned as default extension for "image/png"' );
    20622062        $this->assertFalse( wp_get_default_extension_for_mime_type( 'wibble/wobble' ), 'false not returned for unrecognized mime type' );
    20632063        $this->assertFalse( wp_get_default_extension_for_mime_type( '' ), 'false not returned when empty string as mime type supplied' );
     
    20732073    function test_wp_filesize_with_nonexistent_file() {
    20742074        $file = 'nonexistent/file.jpg';
    2075         $this->assertEquals( 0, wp_filesize( $file ) );
     2075        $this->assertSame( 0, wp_filesize( $file ) );
    20762076    }
    20772077
     
    20832083        $file = DIR_TESTDATA . '/images/test-image-upside-down.jpg';
    20842084
    2085         $this->assertEquals( filesize( $file ), wp_filesize( $file ) );
     2085        $this->assertSame( filesize( $file ), wp_filesize( $file ) );
    20862086
    20872087        $filter = function() {
     
    20912091        add_filter( 'wp_filesize', $filter );
    20922092
    2093         $this->assertEquals( 999, wp_filesize( $file ) );
     2093        $this->assertSame( 999, wp_filesize( $file ) );
    20942094
    20952095        $pre_filter = function() {
     
    20992099        add_filter( 'pre_wp_filesize', $pre_filter );
    21002100
    2101         $this->assertEquals( 111, wp_filesize( $file ) );
     2101        $this->assertSame( 111, wp_filesize( $file ) );
    21022102    }
    21032103
     
    21852185            'version'  => 1,
    21862186        );
    2187         $this->assertEquals( $theme_json, $expected_theme_json );
     2187        $this->assertSameSetsWithIndex( $theme_json, $expected_theme_json );
    21882188    }
    21892189
Note: See TracChangeset for help on using the changeset viewer.