Make WordPress Core


Ignore:
Timestamp:
09/02/2020 12:35:36 AM (4 years 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/SanitizeTitle.php

    r46586 r48937  
    88        $input    = 'Captain <strong>Awesome</strong>';
    99        $expected = 'captain-awesome';
    10         $this->assertEquals( $expected, sanitize_title( $input ) );
     10        $this->assertSame( $expected, sanitize_title( $input ) );
    1111    }
    1212
     
    1414        $input    = '<strong></strong>';
    1515        $fallback = 'Captain Awesome';
    16         $this->assertEquals( $fallback, sanitize_title( $input, $fallback ) );
     16        $this->assertSame( $fallback, sanitize_title( $input, $fallback ) );
    1717    }
    1818}
Note: See TracChangeset for help on using the changeset viewer.