<?php

declare(strict_types=1);

namespace Tests\Support;

use Closure;
use Illuminate\Support\Facades\Http;

final class AssertsNoOutboundHttp
{
    /**
     * @template TReturn
     *
     * @param  Closure(): TReturn  $callback
     * @return TReturn
     */
    public static function run(Closure $callback): mixed
    {
        Http::fake();

        try {
            return $callback();
        } finally {
            Http::assertNothingSent();
        }
    }
}
