How to test http macro retry counts on Connection failure?
AppServiceProvider:
Http::macro('host', function () {
return Http::acceptJson()
->retry(5, 600, function (\Exception $exception, PendingRequest $request) {
return $exception instanceof ConnectionException;
});
});
Feature test:
public function test_connection_exception(): void
{
Http::preventStrayRequests();
Http::fake([
'*' => // I need something here...
]);
Http::assertSentCount(5);
}