Hello @m-thalmann
If I'm correctly the constructor of your class will not be executed if you create a partial mock. That results that cache is never set for the partial mock of your RateLimiter. That is the reason for this error.
To be honest my advice is only to mock if really needed and if you need create the full mock and not a partial to prevent problems like this.
Hi @tvbeek , thanks for your reply!
Yeah that seems to be the case here, but I do really need to create a partial mock for this test. The RateLimiter used here is the default facade included in Laravel, so I would have assumed it should work, but it seems like it doesn't.
In my opinion this is a bug which should be fixed, since I think there could be more people wanting to test something similar.
Do you think my opinion on this is valid or should I just let it go?
Thanks and have a good one!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community