Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Add assertion method for 201 Created HTTP response #30368

Merged
merged 1 commit into from
Oct 21, 2019
Merged

[6.x] Add assertion method for 201 Created HTTP response #30368

merged 1 commit into from
Oct 21, 2019

Conversation

AmirrezaNasiri
Copy link
Contributor

This pull request adds a new assertCreated method to Illuminate\Foundation\Testing\TestResponse. It basically asserts that response code equals to 201 in a more elegant way than assertStatus(201).

The reason behind this assertion method is that Eloquent API Resources response with a 201 code if the model is just created and this is a case which is widely expected on CRUDs for example. In other hand, there is no similar method to isCreated on base HTTP Response thus we have to assert 201 code directly.

@taylorotwell taylorotwell merged commit f36cce6 into laravel:6.x Oct 21, 2019
@AmirrezaNasiri AmirrezaNasiri changed the title Add assertion method for 201 Created HTTP response [6.x] Add assertion method for 201 Created HTTP response Oct 21, 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.

None yet

2 participants