From 4b44695f508f72d1289e77bd10c54edafd7d469b Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Thu, 16 Feb 2023 01:02:32 -0600 Subject: [PATCH] fix `Expression` string casting The `Expression` class no longer provides a `__toString()` method, so we cannot cast it to a string here. We'll now use the `->getValue()` method and pass the current database connection's query grammar. #44784 --- src/Illuminate/Testing/Constraints/HasInDatabase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Testing/Constraints/HasInDatabase.php b/src/Illuminate/Testing/Constraints/HasInDatabase.php index 54aa1cd53751..f17ce8c51afe 100644 --- a/src/Illuminate/Testing/Constraints/HasInDatabase.php +++ b/src/Illuminate/Testing/Constraints/HasInDatabase.php @@ -113,7 +113,7 @@ protected function getAdditionalInfo($table) public function toString($options = 0): string { foreach ($this->data as $key => $data) { - $output[$key] = $data instanceof Expression ? (string) $data : $data; + $output[$key] = $data instanceof Expression ? $data->getValue($this->database->getQueryGrammar()) : $data; } return json_encode($output ?? [], $options);