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/sitemaps/sitemaps-taxonomies.php

    r48474 r48937  
    115115        unregister_taxonomy_for_object_type( $taxonomy, 'post' );
    116116
    117         $this->assertEquals( $expected, $post_list, 'Custom taxonomy term links are not visible.' );
     117        $this->assertSame( $expected, $post_list, 'Custom taxonomy term links are not visible.' );
    118118    }
    119119
     
    217217        $subtypes = $taxonomies_provider->get_object_subtypes();
    218218
    219         $this->assertEquals( array(), $subtypes, 'Could not filter taxonomies subtypes.' );
     219        $this->assertSame( array(), $subtypes, 'Could not filter taxonomies subtypes.' );
    220220    }
    221221}
Note: See TracChangeset for help on using the changeset viewer.