mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@55465 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1186,7 +1186,7 @@ class Tests_Date_Query extends WP_UnitTestCase {
|
||||
|
||||
$parts = mb_split( '\)\s+AND\s+\(', $sql );
|
||||
$this->assertIsArray( $parts, 'SQL query cannot be split into multiple parts using operator AND.' );
|
||||
$this->assertEquals( 2, count( $parts ), 'SQL query does not contain correct number of AND operators.' );
|
||||
$this->assertSame( 2, count( $parts ), 'SQL query does not contain correct number of AND operators.' );
|
||||
|
||||
$this->assertStringNotContainsString( 'OR', $sql, 'SQL query contains conditions joined by operator OR.' );
|
||||
}
|
||||
@@ -1233,7 +1233,7 @@ class Tests_Date_Query extends WP_UnitTestCase {
|
||||
|
||||
$parts = mb_split( '\)\s+OR\s+\(', $sql );
|
||||
$this->assertIsArray( $parts, 'SQL query cannot be split into multiple parts using operator OR.' );
|
||||
$this->assertEquals( 2, count( $parts ), 'SQL query does not contain correct number of OR operators.' );
|
||||
$this->assertSame( 2, count( $parts ), 'SQL query does not contain correct number of OR operators.' );
|
||||
|
||||
// Checking number of occurrences of AND while skipping the one at the beginning.
|
||||
$this->assertSame( 2, substr_count( substr( $sql, 5 ), 'AND' ), 'SQL query does not contain expected number conditions joined by operator AND.' );
|
||||
@@ -1279,7 +1279,7 @@ class Tests_Date_Query extends WP_UnitTestCase {
|
||||
|
||||
$parts = mb_split( '\)\s+AND\s+\(', $sql );
|
||||
$this->assertIsArray( $parts, 'SQL query cannot be split into multiple parts using operator AND.' );
|
||||
$this->assertEquals( 2, count( $parts ), 'SQL query does not contain correct number of AND operators.' );
|
||||
$this->assertSame( 2, count( $parts ), 'SQL query does not contain correct number of AND operators.' );
|
||||
|
||||
$this->assertStringNotContainsString( 'OR', $sql, 'SQL query contains conditions joined by operator OR.' );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user