Skip to content

[11.x] json assertions on streamed content#54565

Merged
taylorotwell merged 2 commits intolaravel:11.xfrom
gdebrauwer:json-assertions-on-streamed-json
Feb 11, 2025
Merged

[11.x] json assertions on streamed content#54565
taylorotwell merged 2 commits intolaravel:11.xfrom
gdebrauwer:json-assertions-on-streamed-json

Conversation

@gdebrauwer
Copy link
Copy Markdown
Contributor

Currently it is not possible to use all json assertions on a streamed json response. This PR fixes that.

Route::get('/users', function () {
    return response()->streamJson([
        'data' => User::cursor(),
    ]);
});
$this->getJson('/users')
    ->assertJsonCount(10, 'data')
    ->assertJsonPath('data.*.id', $users->pluck('id')->all());

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