Laravel 11 Unit Test – Call to a member function connection() on null
I tried creating a unit test for my User service class, however when I run php artisan test
this errors are thrown, I have no idea about this since I’m a newbie in unit testing.
The code works perfectly in controllers, this errors only happens in tests: