So only the seeStatusCode doesn't work? The seeJsonEquals does work?
Jun 13, 2015
11
Level 3
Can't test 403 responses
Hello,
this is my test:
public function testVisitPollsOverviewWithoutToken(){
$this->visit('/api/polls')
->seeStatusCode(403)
->seeJsonEquals([
'error' => [
'message' => 'Missing or incorrect api token'
],
]);
}
Get that when i run phpunit:
A request to [http://localhost/api/polls] failed. Received status code [403].
Level 3
Got the solution in the Laravel Slack chat from 'cody'.
I should use the 'get()' method instead of 'visit()'.
4 likes
Please or to participate in this conversation.