Http::response([ 'access_token' => 'token', 'expires_in' => 3600, 'token_type' => 'Bearer', ]), 'https://graph.microsoft.com/*' => Http::response(['value' => []]), ]); $client = new MicrosoftGraphClient(app(GraphLogger::class)); $client->getOrganization(); Http::assertSent(function (Request $request): bool { if (! str_contains($request->url(), '/oauth2/v2.0/token')) { return false; } return $request['scope'] === 'https://graph.microsoft.com/.default' && $request['client_id'] === 'client-id' && $request['grant_type'] === 'client_credentials'; }); });