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/comment/getCommentExcerpt.php

    r46586 r48937  
    2323        $excerpt = get_comment_excerpt( $comment_id );
    2424
    25         $this->assertEquals( 20, count( explode( ' ', $excerpt ) ) );
     25        $this->assertSame( 20, count( explode( ' ', $excerpt ) ) );
    2626    }
    2727
     
    3737        $excerpt = get_comment_excerpt( $comment_id );
    3838
    39         $this->assertEquals( 10, count( explode( ' ', $excerpt ) ) );
     39        $this->assertSame( 10, count( explode( ' ', $excerpt ) ) );
    4040    }
    4141
Note: See TracChangeset for help on using the changeset viewer.