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

    r47198 r48937  
    117117        );
    118118
    119         $this->assertEquals( $expected, $updates );
    120 
    121         $this->assertEquals(
     119        $this->assertSame( $expected, $updates );
     120
     121        $this->assertSame(
    122122            "{$wpdb->prefix}dbdelta_create_test",
    123123            $wpdb->get_var(
     
    151151        );
    152152
    153         $this->assertEquals( array(), $updates );
     153        $this->assertSame( array(), $updates );
    154154    }
    155155
     
    174174        );
    175175
    176         $this->assertEquals(
     176        $this->assertSame(
    177177            array(
    178178                "{$wpdb->prefix}dbdelta_test.id"
     
    203203        );
    204204
    205         $this->assertEquals(
     205        $this->assertSame(
    206206            array(
    207207                "{$wpdb->prefix}dbdelta_test.extra_col"
     
    236236        );
    237237
    238         $this->assertEquals( array(), $updates );
     238        $this->assertSame( array(), $updates );
    239239
    240240        $this->assertTableHasColumn( 'column_1', $wpdb->prefix . 'dbdelta_test' );
     
    263263        );
    264264
    265         $this->assertEquals(
     265        $this->assertSame(
    266266            array(
    267267                "{$wpdb->prefix}dbdelta_test.extra_col"
     
    284284        );
    285285
    286         $this->assertEquals(
     286        $this->assertSame(
    287287            array(),
    288288            $insert
Note: See TracChangeset for help on using the changeset viewer.