1
如何在phpunit中添加授權標頭?我正在測試需要api_token的json api。 laravel docs提供了一個actAs方法。但這在我的情況下不起作用,因爲api標記與用戶表不直接相關。使用api令牌認證的laravel phpunit測試
編輯:
public function test_returns_response_with_valid_request()
{
$response = $this->json('post', '/api/lookup', [
'email' => '[email protected]'
]);
$response->assertStatus(200);
$response->assertJsonStructure([
'info' => [
'name'
]
]);
}
告訴我們任何你的phpunit代碼 –