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/dependencies/jquery.php

    r48325 r48937  
    3232            $this->assertInstanceOf( '_WP_Dependency', $object );
    3333            $this->assertTrue( isset( $jquery_scripts[ $dep ] ) );
    34             $this->assertEquals( $jquery_scripts[ $dep ], $o->src );
     34            $this->assertSame( $jquery_scripts[ $dep ], $o->src );
    3535        }
    3636        */
     
    4141        $noconflict = 'jQuery.noConflict();';
    4242        $end        = substr( $contents, - strlen( $noconflict ) );
    43         $this->assertEquals( $noconflict, $end );
     43        $this->assertSame( $noconflict, $end );
    4444    }
    4545
Note: See TracChangeset for help on using the changeset viewer.