-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Give Http Code assertion more priority in response assertion, use Lar…
…avel built-in assertion
- Loading branch information
1 parent
9d7f4c1
commit 042e637
Showing
3 changed files
with
29 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,6 +136,26 @@ public function test_validates_invalid_empty_response(): void | |
->assertValidationMessage('Response body is expected to be empty.'); | ||
} | ||
|
||
public function test_validates_status_code(): void | ||
{ | ||
$this->expectException(ErrorException::class); | ||
$this->expectExceptionMessage('Expected response status code [200] but received 201.'); | ||
|
||
Route::get('/users', static function () { | ||
return response([ | ||
[ | ||
'id' => 1, | ||
'name' => 'Jim', | ||
'email' => '[email protected]', | ||
], | ||
], 201); | ||
})->middleware(Middleware::class); | ||
|
||
$this->getJson('/users') | ||
->assertValidRequest() | ||
->assertValidResponse(200); | ||
} | ||
|
||
public function test_validates_valid_problem_json_response() | ||
{ | ||
Route::get('/users', function () { | ||
|