How to pass bearer token to test API using phpunit and Liip
$client->request('GET', '/api/my_endpoint', [], [], [ 'HTTP_AUTHORIZATION' => "{$token}", 'CONTENT_TYPE' => 'application/ld+json', 'HTTP_ACCEPT' => 'application/ld+json' ]);
You should use the HTTP_AUTHORIZATION
header for that. Try above code. Also you don't need a nested array for headers.
Also since we don't see the format of your token keep in mind that the bearer format is:
Bearer (space) the rest of the token.
$client->request('GET', '/api/my_endpoint', [], [], [ 'headers' => [ 'Authorization' => 'bearer '.$token ] ]);