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/formatting/URLShorten.php

    r47122 r48937  
    1515        );
    1616        foreach ( $tests as $k => $v ) {
    17             $this->assertEquals( $v, url_shorten( $k ) );
     17            $this->assertSame( $v, url_shorten( $k ) );
    1818        }
    1919
    2020        // Shorten to 31 if > 34 after cleaning.
    21         $this->assertEquals( 'wordpress.org/about/philosophy/#…', url_shorten( 'http://wordpress.org/about/philosophy/#decisions' ), 31 );
     21        $this->assertSame( 'wordpress.org/about/philosophy/#…', url_shorten( 'http://wordpress.org/about/philosophy/#decisions' ), 31 );
    2222    }
    2323}
Note: See TracChangeset for help on using the changeset viewer.