Skip to content

Commit

Permalink
document assertJsonFragment
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Dec 18, 2020
1 parent e5c46c9 commit 131e73f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions http-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ Laravel's `Illuminate\Testing\TestResponse` class provides a variety of custom a
[assertHeaderMissing](#assert-header-missing)
[assertJson](#assert-json)
[assertJsonCount](#assert-json-count)
[assertJsonFragment](#assert-json-fragment)
[assertJsonMissing](#assert-json-missing)
[assertJsonMissingExact](#assert-json-missing-exact)
[assertJsonMissingValidationErrors](#assert-json-missing-validation-errors)
Expand Down Expand Up @@ -571,6 +572,23 @@ Assert that the response JSON has an array with the expected number of items at

$response->assertJsonCount($count, $key = null);

<a name="assert-json-fragment"></a>
#### assertJsonFragment

Assert that the response contains the given JSON data anywhere in the response:

Route::get('/users', function () {
return [
'users' => [
[
'name' => 'Taylor Otwell',
],
],
];
});

$response->assertJsonFragment(['name' => 'Taylor Otwell']);

<a name="assert-json-missing"></a>
#### assertJsonMissing

Expand Down

0 comments on commit 131e73f

Please sign in to comment.