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

    r47122 r48937  
    7777        $this->assertTrue( $dep->query( 'one', 'queue' ) );
    7878        $this->assertFalse( $dep->query( 'two', 'queue' ) );
    79         $this->assertEquals( 'arg', $dep->args['one'] );
     79        $this->assertSame( 'arg', $dep->args['one'] );
    8080
    8181        $dep->enqueue( 'two?arg' );
    8282        $this->assertTrue( $dep->query( 'one', 'queue' ) );
    8383        $this->assertTrue( $dep->query( 'two', 'queue' ) );
    84         $this->assertEquals( 'arg', $dep->args['two'] );
     84        $this->assertSame( 'arg', $dep->args['two'] );
    8585    }
    8686
     
    9595        $this->assertTrue( $dep->query( 'one', 'queue' ) );
    9696        $this->assertTrue( $dep->query( 'two', 'queue' ) );
    97         $this->assertEquals( 'arg', $dep->args['one'] );
    98         $this->assertEquals( 'arg', $dep->args['two'] );
     97        $this->assertSame( 'arg', $dep->args['one'] );
     98        $this->assertSame( 'arg', $dep->args['two'] );
    9999
    100100        $dep->dequeue( 'one' );
Note: See TracChangeset for help on using the changeset viewer.