Buy your loved one the ultimate gift. Lifetime gift certificates are $100 off.




0 Best Reply Awards

  • Member Since 2 Months Ago
  • 0 Lessons Completed
  • 0 Favorites

12th October, 2017

chillcaw left a reply on How To Add Headers To Test? • 2 months ago

Cheers! I fixed it like so:

public function testCreateMethodSuccess()
    $response = $this->json('POST', 'proto/3/users', ['name' => 'Sally'], ['HTTP_Authorization' => $this->token]);
    $this->assertEquals(422, $this->response->status());

chillcaw started a new conversation How To Add Headers To Test? • 2 months ago

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

Edit Your Profile

Want to change your profile photo? We pull from