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/theme/getAllowedFilters.php

    r46586 r48937  
    2222            remove_filter( 'network_allowed_themes', array( $this, 'filter_network_allowed_themes' ) );
    2323
    24             $this->assertEquals( 2, count( $this->filter_network_allowed_themes_args ) );
    25             $this->assertEquals( $blog_id, $this->filter_network_allowed_themes_args[1] );
     24            $this->assertSame( 2, count( $this->filter_network_allowed_themes_args ) );
     25            $this->assertSame( $blog_id, $this->filter_network_allowed_themes_args[1] );
    2626        }
    2727
     
    4040            $expected = $this->default_allowed + array( 'allow-on-network' => true );
    4141
    42             $this->assertEquals( $expected, $allowed );
     42            $this->assertSame( $expected, $allowed );
    4343        }
    4444
     
    5757            $expected = $this->default_allowed + array( 'network-allowed-theme' => true );
    5858
    59             $this->assertEquals( $expected, $allowed );
     59            $this->assertSame( $expected, $allowed );
    6060        }
    6161
     
    7474            $expected = $this->default_allowed + array( 'site-allowed-theme' => true );
    7575
    76             $this->assertEquals( $expected, $allowed );
     76            $this->assertSame( $expected, $allowed );
    7777        }
    7878
Note: See TracChangeset for help on using the changeset viewer.