-
Notifications
You must be signed in to change notification settings - Fork 11.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AssertableJson->whereNot does not work with array. #50047
Comments
Thank you for reporting this issue! As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub. If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team. Thank you! |
Hi @FunkyOz, From what I've gathered, while the It's hard to determine the author's original intent just from observing the code though, so in the case that Hope this helps :) |
Hi @calvinli08, Thank you :) |
This looks like an obvious bug, as even non-empty array will result in an error, so I would like to fix it if no one else is handling. Thank you |
Looks like @FunkyOz found a solution so closing this one. Thanks all. |
Laravel Version
10.43.0
PHP Version
8.3.2 on Docker
Database Driver & Version
No response
Description
I came across a strange behavior of whereNot method in Illuminate\Testing\Fluent\Concern\Matching trait and I cannot understand if it's wanted or not.
I tried to test the emptiness of an array in a response and I used the whereNot method with an AssertableJson object. Therefore I passed to the function an empty array because I seen the implementation and I noticed that on line 73 of Matching trait there is a conversion of $expected var from an Arrayable to an array, so I supposed that the rational behind was to manage array too.
But on line 86 the $expected var it's not convert to string for sprintf so php throw an ErrorException: Array to string conversion.
I add an example that throw as I mentioned above in the Steps to reproduce section.
Steps To Reproduce
The text was updated successfully, but these errors were encountered: