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 1 commit into from Oct 21, 2019


Copy link

AmirrezaNasiri commented Oct 21, 2019

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
1 of 2 checks passed
1 of 2 checks passed
continuous-integration/travis-ci/pr The Travis CI build is in progress
continuous-integration/styleci/pr The analysis has passed
@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
kennith added a commit to kennith/docs that referenced this pull request Oct 25, 2019
This pull request documents assertCreated()

Reference: laravel/framework#30368
ginnerpeace added a commit to ginnerpeace/framework that referenced this pull request Oct 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.