2048, 'private_key_type' => OPENSSL_KEYTYPE_RSA, ]); openssl_pkey_export($res, $pem); return $pem; } it('sends the Pixelfed User-Agent on pooled delete deliveries', function () { Http::fake([ '*' => Http::response('', 202), ]); $privateKey = generatePrivateKeyPem(); $keyId = 'https://local.test/users/alice#main-key'; $payload = '{"type":"Delete"}'; $digest = base64_encode(hash('sha256', $payload, true)); $urls = collect(['https://remote.example/f/inbox']); $command = app(UserAccountDelete::class); $ref = new ReflectionMethod($command, 'sendBatch'); $ref->setAccessible(true); // sendBatch(PendingRequest $client, string $privateKey, string $keyId, // string $digest, Collection $urls, string $payload, int $payloadLen, // int $concurrency, bool $verboseErrors) $client = (new ReflectionMethod($command, 'makeHttpClient')); $client->setAccessible(true); $pendingClient = $client->invoke($command); $ref->invoke( $command, $pendingClient, $privateKey, $keyId, $digest, $urls, $payload, strlen($payload), 5, false ); Http::assertSent(function ($request) { return $request->url() === 'https://remote.example/f/inbox' && $request->hasHeader('User-Agent') && str_contains($request->header('User-Agent')[0], 'Pixelfed'); }); });