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

[5.8] Prevent TestRespone dump methods from ending execution of the script #28960

Merged
merged 1 commit into from Jun 26, 2019

Conversation

Projects
None yet
2 participants
@d3jn
Copy link
Contributor

commented Jun 26, 2019

Greetings!

This is something that has been bothering me for quite some time so I propose a change. TestResponse::dump() and TestResponse::dumpHeaders() methods actually use dd() helper (instead of dump()) thus killing the execution of the script.

Not only is this counter-intuitive, but also should be classified as a bug because it goes against the examples official documentation provides:

    public function testBasicTest()
    {
        $response = $this->get('/');

        $response->dumpHeaders();

        $response->dump();
    }

The way it's currently implemented this example from the docs won't even work properly, because only headers will be dumped and then the execution of the script will be halted. Making TestResponse dump methods to actually dump things like dump() does would drastically improve tests' debugging experience out of the box (for now I've been registering realDump macro for TestResponse in my projects which is inconvenient).

For those, who want previous behavior we can also discuss introducing dd() and ddHeaders() methods to TestResponse class.

@taylorotwell taylorotwell merged commit 6d4d15f into laravel:5.8 Jun 26, 2019

2 checks passed

continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.