Skip to content

Commit 76e0d60

Browse files
authored
[8.x] Add flush handler to output buffer for streamed test response (bugfix) (#42481)
* Add handler to catch ob_flush * Make formatter happy.
1 parent ec942b1 commit 76e0d60

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Illuminate/Testing/TestResponse.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,11 +1491,17 @@ public function streamedContent()
14911491
PHPUnit::fail('The response is not a streamed response.');
14921492
}
14931493

1494-
ob_start();
1494+
ob_start(function (string $buffer): string {
1495+
$this->streamedContent .= $buffer;
1496+
1497+
return '';
1498+
});
14951499

14961500
$this->sendContent();
14971501

1498-
return $this->streamedContent = ob_get_clean();
1502+
ob_end_clean();
1503+
1504+
return $this->streamedContent;
14991505
}
15001506

15011507
/**

0 commit comments

Comments
 (0)