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/user/getActiveBlogForUser.php

    r47013 r48937  
    5555            wp_delete_site( $site_id_two );
    5656
    57             $this->assertEquals( $primary_site_id, $result->id );
     57            $this->assertSame( $primary_site_id, $result->id );
    5858        }
    5959
     
    7272            wp_delete_site( $primary_site_id );
    7373
    74             $this->assertEquals( $primary_site_id, $result->id );
     74            $this->assertSame( $primary_site_id, $result->id );
    7575        }
    7676
     
    9595            wp_delete_site( $site_id );
    9696
    97             $this->assertEquals( $current_site_id, $result->id );
     97            $this->assertSame( $current_site_id, $result->id );
    9898        }
    9999    }
Note: See TracChangeset for help on using the changeset viewer.