'Laravel 9: Testing "RateLimiter" Facade and "Limit" class in RouteServiceProvider

As we know, one of the new features in Laravel 9 is Test Coverage. This is the new feature described at the official documentation.

When developing a new application, I have decided to keep the Test Coverage result at 100%. However, in the App\Providers\RouteServiceProvider class, the configureRateLimiting method calls the for method of the RateLimiter facade and the perMinute and by methods of the Limit class. When trying to "mock" the methods with Mockery, despite passing the test, the Test Coverage result does not recognize the call of these methods.

PhpStorm 2022.1:

Result

Honestly, I don't know how to work with Mockery, but I hope to learn how to use Mockery properly with this new application for one of my clients. I would like someone to help me with this test to achieve my goal. Thank you!!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source