Make WordPress Core

Changeset 55465


Ignore:
Timestamp:
03/06/2023 02:44:35 PM (19 months ago)
Author:
hellofromTonya
Message:

Build/Test Tooling: Use assertSame() in WP_Date_Query tests.

Change from assertEquals() to assertSame(). Why? To ensure both the return value and data type match the expected results.

Follow-up to [54530].

Props costdev, peterwilsoncc, mukesh27, ankitmaru.
See #56800.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/date/query.php

    r54530 r55465  
    11871187        $parts = mb_split( '\)\s+AND\s+\(', $sql );
    11881188        $this->assertIsArray( $parts, 'SQL query cannot be split into multiple parts using operator AND.' );
    1189         $this->assertEquals( 2, count( $parts ), 'SQL query does not contain correct number of AND operators.' );
     1189        $this->assertSame( 2, count( $parts ), 'SQL query does not contain correct number of AND operators.' );
    11901190
    11911191        $this->assertStringNotContainsString( 'OR', $sql, 'SQL query contains conditions joined by operator OR.' );
     
    12341234        $parts = mb_split( '\)\s+OR\s+\(', $sql );
    12351235        $this->assertIsArray( $parts, 'SQL query cannot be split into multiple parts using operator OR.' );
    1236         $this->assertEquals( 2, count( $parts ), 'SQL query does not contain correct number of OR operators.' );
     1236        $this->assertSame( 2, count( $parts ), 'SQL query does not contain correct number of OR operators.' );
    12371237
    12381238        // Checking number of occurrences of AND while skipping the one at the beginning.
     
    12801280        $parts = mb_split( '\)\s+AND\s+\(', $sql );
    12811281        $this->assertIsArray( $parts, 'SQL query cannot be split into multiple parts using operator AND.' );
    1282         $this->assertEquals( 2, count( $parts ), 'SQL query does not contain correct number of AND operators.' );
     1282        $this->assertSame( 2, count( $parts ), 'SQL query does not contain correct number of AND operators.' );
    12831283
    12841284        $this->assertStringNotContainsString( 'OR', $sql, 'SQL query contains conditions joined by operator OR.' );
Note: See TracChangeset for help on using the changeset viewer.