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/post/listPages.php

    r48280 r48937  
    144144</ul></li>';
    145145
    146         $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
     146        $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) );
    147147    }
    148148
     
    158158</ul></li>';
    159159
    160         $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
     160        $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) );
    161161    }
    162162
     
    174174</ul></li>';
    175175
    176         $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
     176        $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) );
    177177    }
    178178
     
    208208</ul></li>';
    209209
    210         $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
     210        $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) );
    211211    }
    212212
     
    222222</ul></li>';
    223223
    224         $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
     224        $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) );
    225225    }
    226226
     
    250250</ul></li>';
    251251
    252         $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
     252        $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) );
    253253    }
    254254
     
    265265</ul></li>';
    266266
    267         $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
     267        $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) );
    268268    }
    269269
     
    292292</ul></li>';
    293293
    294         $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
     294        $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) );
    295295    }
    296296
     
    305305</ul></li>';
    306306
    307         $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
     307        $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) );
    308308    }
    309309
     
    321321</ul></li>';
    322322
    323         $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
     323        $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) );
    324324    }
    325325
     
    353353</ul></li>';
    354354
    355         $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
     355        $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) );
    356356    }
    357357
     
    385385</ul></li>';
    386386
    387         $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
     387        $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) );
    388388    }
    389389
     
    399399</ul></li>';
    400400
    401         $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
     401        $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) );
    402402    }
    403403
     
    417417</ul></li>';
    418418
    419         $this->assertEqualsIgnoreEOL( $expected, wp_list_pages( $args ) );
     419        $this->assertSameIgnoreEOL( $expected, wp_list_pages( $args ) );
    420420    }
    421421
     
    447447        $expected = str_replace( array( "\r\n", "\n", "\t" ), '', $expected );
    448448
    449         $this->assertEquals( $expected, wp_list_pages( $args ) );
     449        $this->assertSame( $expected, wp_list_pages( $args ) );
    450450    }
    451451}
Note: See TracChangeset for help on using the changeset viewer.