I have just discovered what creates the output:
Test code or tested code did not (only) close its own output buffers
I had a controller method displaying a view and in the view I had forgotten to close my section with @endsection
I have a feature test which is giving me this error:
Test code or tested code did not (only) close its own output buffers
I understand this can be triggered by the buffer being larger/smaller than expected. But I have no idea how to begin tracing that.
I have isolated the issue to this call in my test followRedirects()
$loginCredentials = [
'email' => $this->email,
'password' => $this->password,
];
$this->fromUrl(route('dashboard'))
->post('/login', $loginCredentials)
->followRedirects()
->assertViewIs('subscription.editCard');
followRedirects()is a macro that I use across ~150 tests with no problem
TestResponse::macro('followRedirects', function ($testCase = null) use ($test) {
$response = $this;
$testCase = $testCase ?: $test;
while ($response->isRedirect()) {
$response = $testCase->get($response->headers->get('Location'));
}
return $response;
});
If I dump the contents of the HTML produced by my post I get a pretty standard redirect:
<!DOCTYPE html>\n
<html>\n
<head>\n
<meta charset="UTF-8" />\n
<meta http-equiv="refresh" content="0;url=http://domain.test/dashboard" />\n
\n
<title>Redirecting to http://domain.test/dashboard</title>\n
</head>\n
<body>\n
Redirecting to <a href="http://domain.test/dashboard">http://domain.test/dashboard</a>.\n
</body>\n
</html>
if I dump after the followRedirects() I see the HTML output of the view I'm expecting.
Does anyone know how I can trace the issue here?
I have just discovered what creates the output:
Test code or tested code did not (only) close its own output buffers
I had a controller method displaying a view and in the view I had forgotten to close my section with @endsection
Please or to participate in this conversation.