Skip to content

[5.8] Make TestResponse tappable - #29033

Merged
taylorotwell merged 1 commit into
laravel:5.8from
SjorsO:5.8
Jul 3, 2019
Merged

[5.8] Make TestResponse tappable#29033
taylorotwell merged 1 commit into
laravel:5.8from
SjorsO:5.8

Conversation

@SjorsO

@SjorsO SjorsO commented Jul 2, 2019

Copy link
Copy Markdown
Contributor

This PR adds the new tappable trait to the TestResponse. This way you can do stuff like this:

$this->getJson('/api/users/index')
    ->assertStatus(200)
    ->tap(function (TestResponse $response) {
        $this->assertMatchesJsonSnapshot($response);
    });

Instead of having to do:

$response = $this->getJson('/api/users/index')
    ->assertStatus(200);

$this->assertMatchesJsonSnapshot($response);

@taylorotwell
taylorotwell merged commit 48ab29c into laravel:5.8 Jul 3, 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.

2 participants