Summer Sale! All accounts are 50% off this week.

aodamuz's avatar

Testing the RouteServiceProvider

Hello! I want to test the configureRateLimiting method of the RouteServiceProvider class. I have tried to test the method with Mockery but it doesn't work. I want to verify that the method is called correctly and that the RateLimiter class makes a call to the for method. In short, what I want is to fully test this method with PHPUnit TestCase without using the application. Can someone help me with this? Thank you!!

0 likes
1 reply
Braunson's avatar

From another post here

$response = $this->call('GET', '/api/foo');
$this->assertEquals(200, $response->status());
$header_value = $response->headers->get('X-Ratelimit-Limit');
$this->assertEquals(50, $header_value);

Please or to participate in this conversation.