Skip to content

[5.8] Add assert method for unauthorized response - #28851

Merged
taylorotwell merged 2 commits into
laravel:5.8from
ramytamer:5.8
Jun 15, 2019
Merged

[5.8] Add assert method for unauthorized response#28851
taylorotwell merged 2 commits into
laravel:5.8from
ramytamer:5.8

Conversation

@ramytamer

Copy link
Copy Markdown
Contributor

This PR adds a new assertion method on test response like assertNotFound and assertForbidden; this will help asserting that an endpoint is limited only to authorized users instead of doing it as assertStatus(401).

There is no isUnauthorized method defined in Symfony/http-foundation Response class like isForbidden, isNotFound yet so that's why I compare it with the 401 HTTP code directly.

@ramytamer ramytamer changed the title Add assert method for unauthorized response. (#1) Add assert method for unauthorized response. Jun 15, 2019
@taylorotwell
taylorotwell merged commit 67ad2c3 into laravel:5.8 Jun 15, 2019
@GrahamCampbell GrahamCampbell changed the title Add assert method for unauthorized response. [5.8] Add assert method for unauthorized response Jun 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants