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/multisite/getSpaceUsed.php

    r46586 r48937  
    4545            delete_transient( 'dirsize_cache' );
    4646
    47             $this->assertEquals( $size, get_space_used() );
     47            $this->assertSame( $size, get_space_used() );
    4848            $upload_dir = wp_upload_dir();
    4949            $this->remove_added_uploads();
     
    8080            delete_transient( 'dirsize_cache' );
    8181
    82             $this->assertEquals( $space_used, get_space_used() );
     82            $this->assertSame( $space_used, get_space_used() );
    8383
    8484            // Switch back to the new site to remove the uploaded file.
     
    9393            add_filter( 'pre_get_space_used', array( $this, '_filter_space_used' ) );
    9494
    95             $this->assertEquals( 300, get_space_used() );
     95            $this->assertSame( 300, get_space_used() );
    9696
    9797            remove_filter( 'pre_get_space_used', array( $this, '_filter_space_used' ) );
Note: See TracChangeset for help on using the changeset viewer.