How to add headers to test?

Posted 1 year ago by chillcaw

I'm using Lumen, but there is no information in the Lumen documentation on how to do this. So I followed the Laravel docs:

public function testUpdateMethodSuccess()
        $response = $this->withHeaders([
          'HTTP_Authorization', $this->token
        ])->json('POST', 'users/3', ['name' => 'Sally']);


Whether I use ->header or ->withHeaders I get a 'call to undefined method error' from phpunit

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.