From 4fafdd94ee110cf9df132a7c73370d253e503090 Mon Sep 17 00:00:00 2001 From: Richard van Baarsen Date: Wed, 10 Jul 2024 20:53:41 +0200 Subject: [PATCH] [11.x] Fix expected/actual argument order for test assertion (#52084) * Fix expected/actual argument order for test assertion * Fix test * Fix test --- .../Foundation/Testing/Concerns/InteractsWithDatabase.php | 2 +- tests/Foundation/FoundationInteractsWithDatabaseTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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." ); }); diff --git a/tests/Foundation/FoundationInteractsWithDatabaseTest.php b/tests/Foundation/FoundationInteractsWithDatabaseTest.php index 8662178aaff3..34047e1a7db7 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 @@ -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