From c39d384d333b4bfa193082d6164c5abd1d70d36c Mon Sep 17 00:00:00 2001 From: Tonya Mork Date: Mon, 6 Mar 2023 14:44:35 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/date/query.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/tests/date/query.php b/tests/phpunit/tests/date/query.php index 613d74957b..32ac0ed018 100644 --- a/tests/phpunit/tests/date/query.php +++ b/tests/phpunit/tests/date/query.php @@ -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.' ); }