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/query/postStatus.php

    r47181 r48937  
    335335        );
    336336
    337         $this->assertEquals( array( $p ), wp_list_pluck( $q->posts, 'ID' ) );
     337        $this->assertSame( array( $p ), wp_list_pluck( $q->posts, 'ID' ) );
    338338    }
    339339
     
    389389        );
    390390
    391         $this->assertEquals( array( $p ), wp_list_pluck( $q->posts, 'ID' ) );
     391        $this->assertSame( array( $p ), wp_list_pluck( $q->posts, 'ID' ) );
    392392    }
    393393
     
    439439        );
    440440
    441         $this->assertEquals( array( $p ), wp_list_pluck( $q->posts, 'ID' ) );
     441        $this->assertSame( array( $p ), wp_list_pluck( $q->posts, 'ID' ) );
    442442    }
    443443
Note: See TracChangeset for help on using the changeset viewer.