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/oembed/template.php

    r47198 r48937  
    212212        $GLOBALS['wp_query'] = new WP_Query();
    213213
    214         $this->assertEquals( 'foo bar', wp_embed_excerpt_more( 'foo bar' ) );
     214        $this->assertSame( 'foo bar', wp_embed_excerpt_more( 'foo bar' ) );
    215215    }
    216216
     
    223223        );
    224224
    225         $this->assertEquals( '', wp_embed_excerpt_more( '' ) );
     225        $this->assertSame( '', wp_embed_excerpt_more( '' ) );
    226226
    227227        $this->go_to( get_post_embed_url( $post_id ) );
     
    234234        );
    235235
    236         $this->assertEquals( $expected, $actual );
     236        $this->assertSame( $expected, $actual );
    237237    }
    238238
Note: See TracChangeset for help on using the changeset viewer.