From f672b5112ef707b77bce78335e582872ae000110 Mon Sep 17 00:00:00 2001 From: Richard van Baarsen Date: Wed, 10 Jul 2024 19:47:09 +0200 Subject: [PATCH 1/3] Fix expected/actual argument order for test assertion --- .../Foundation/Testing/Concerns/InteractsWithDatabase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php b/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php index 141504fda314..2378f815094d 100644 --- a/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php +++ b/src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php @@ -199,8 +199,8 @@ public function expectsDatabaseQueryCount($expected, $connection = null) $this->beforeApplicationDestroyed(function () use (&$actual, $expected, $connectionInstance) { $this->assertSame( - $actual, $expected, + $actual, "Expected {$expected} database queries on the [{$connectionInstance->getName()}] connection. {$actual} occurred." ); }); From 79ecadcefdb08cceed2c5de01c198cf466d174de Mon Sep 17 00:00:00 2001 From: Richard van Baarsen Date: Wed, 10 Jul 2024 20:04:30 +0200 Subject: [PATCH 2/3] Fix test --- tests/Foundation/FoundationInteractsWithDatabaseTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Foundation/FoundationInteractsWithDatabaseTest.php b/tests/Foundation/FoundationInteractsWithDatabaseTest.php index 8662178aaff3..98678712f85e 100644 --- a/tests/Foundation/FoundationInteractsWithDatabaseTest.php +++ b/tests/Foundation/FoundationInteractsWithDatabaseTest.php @@ -392,7 +392,7 @@ public function testExpectsDatabaseQueryCount() $case->tearDown(); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertSame("Expected 3 database queries on the [testing] connection. 0 occurred.\nFailed asserting that 3 is identical to 0.", $e->getMessage()); + $this->assertSame("Expected 3 database queries on the [testing] connection. 0 occurred.\nFailed asserting that 0 is identical to 3.", $e->getMessage()); } $case = new class('foo') extends TestingTestCase From 21d72b12b6618bbb313e1e9745748d6eb96d3926 Mon Sep 17 00:00:00 2001 From: Richard van Baarsen Date: Wed, 10 Jul 2024 20:16:15 +0200 Subject: [PATCH 3/3] Fix test --- tests/Foundation/FoundationInteractsWithDatabaseTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Foundation/FoundationInteractsWithDatabaseTest.php b/tests/Foundation/FoundationInteractsWithDatabaseTest.php index 98678712f85e..34047e1a7db7 100644 --- a/tests/Foundation/FoundationInteractsWithDatabaseTest.php +++ b/tests/Foundation/FoundationInteractsWithDatabaseTest.php @@ -419,7 +419,7 @@ public function testExpectsDatabaseQueryCount() $case->tearDown(); $this->fail(); } catch (ExpectationFailedException $e) { - $this->assertSame("Expected 3 database queries on the [testing] connection. 4 occurred.\nFailed asserting that 3 is identical to 4.", $e->getMessage()); + $this->assertSame("Expected 3 database queries on the [testing] connection. 4 occurred.\nFailed asserting that 4 is identical to 3.", $e->getMessage()); } $case = new class('foo') extends TestingTestCase