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/wpOembed.php

    r45663 r48937  
    3838
    3939        $this->assertNotFalse( $this->pre_oembed_result_filtered );
    40         $this->assertEquals( $this->pre_oembed_result_filtered, $actual );
     40        $this->assertSame( $this->pre_oembed_result_filtered, $actual );
    4141    }
    4242
     
    5353
    5454        $this->assertNotFalse( $this->pre_oembed_result_filtered );
    55         $this->assertEquals( $this->pre_oembed_result_filtered, $actual );
     55        $this->assertSame( $this->pre_oembed_result_filtered, $actual );
    5656    }
    5757
     
    8585
    8686        $this->assertNotNull( $this->pre_oembed_result_filtered );
    87         $this->assertEquals( $this->pre_oembed_result_filtered, $actual );
     87        $this->assertSame( $this->pre_oembed_result_filtered, $actual );
    8888    }
    8989
     
    114114
    115115        $this->assertNotNull( $this->pre_oembed_result_filtered );
    116         $this->assertEquals( $this->pre_oembed_result_filtered, $actual );
     116        $this->assertSame( $this->pre_oembed_result_filtered, $actual );
    117117    }
    118118
     
    151151
    152152        $this->assertNotNull( $this->pre_oembed_result_filtered );
    153         $this->assertEquals( $this->pre_oembed_result_filtered, $actual );
     153        $this->assertSame( $this->pre_oembed_result_filtered, $actual );
    154154    }
    155155
     
    178178
    179179        $this->assertNotNull( $this->pre_oembed_result_filtered );
    180         $this->assertEquals( $this->pre_oembed_result_filtered, $actual );
     180        $this->assertSame( $this->pre_oembed_result_filtered, $actual );
    181181    }
    182182
     
    206206
    207207        $this->assertNotNull( $this->pre_oembed_result_filtered );
    208         $this->assertEquals( $this->pre_oembed_result_filtered, $actual );
     208        $this->assertSame( $this->pre_oembed_result_filtered, $actual );
    209209        $this->assertSame( $expected_stack, $actual_stack );
    210210    }
Note: See TracChangeset for help on using the changeset viewer.