My livewire component expects to receive a collection or null, when receiving null and running the test, using the @forelse directive, it reports an error in the test saying that "Illuminate\View\ViewException: foreach() argument must be of type array|object, null given", adding an if around foreach works normally, follow images for better viewing.
What Happened
My livewire component expects to receive a collection or null, when receiving null and running the test, using the @forelse directive, it reports an error in the test saying that "Illuminate\View\ViewException: foreach() argument must be of type array|object, null given", adding an if around foreach works normally, follow images for better viewing.
public ?Collection $comments = null;
How to Reproduce
Sample Repository
No response
Pest Version
v2.34.7
PHP Version
8.3
Operation System
Windows
Notes
No response