diff --git a/src/swoole/phpunit.xml.dist b/src/swoole/phpunit.xml.dist
index f6bbff5..de1fae4 100644
--- a/src/swoole/phpunit.xml.dist
+++ b/src/swoole/phpunit.xml.dist
@@ -15,9 +15,9 @@
./tests/Unit
-
-
+
+
src
-
-
+
+
diff --git a/src/swoole/src/SymfonyHttpBridge.php b/src/swoole/src/SymfonyHttpBridge.php
index c91ff94..ca26c2e 100644
--- a/src/swoole/src/SymfonyHttpBridge.php
+++ b/src/swoole/src/SymfonyHttpBridge.php
@@ -50,7 +50,7 @@ public static function reflectSymfonyResponse(SymfonyResponse $sfResponse, Respo
$response->write($buffer);
return '';
- });
+ }, 4096);
$sfResponse->sendContent();
ob_end_clean();
$response->end();
diff --git a/src/swoole/tests/Unit/RuntimeTest.php b/src/swoole/tests/Unit/RuntimeTest.php
index b39754d..e5c74af 100644
--- a/src/swoole/tests/Unit/RuntimeTest.php
+++ b/src/swoole/tests/Unit/RuntimeTest.php
@@ -15,7 +15,7 @@ class RuntimeTest extends TestCase
{
public function testGetRunnerCreatesARunnerForCallbacks(): void
{
- $options = [];
+ $options = ['error_handler' => false];
$runtime = new Runtime($options);
$application = static function (): void {
@@ -27,7 +27,7 @@ public function testGetRunnerCreatesARunnerForCallbacks(): void
public function testGetRunnerCreatesARunnerForSymfony(): void
{
- $options = [];
+ $options = ['error_handler' => false];
$runtime = new Runtime($options);
$application = $this->createMock(HttpKernelInterface::class);
@@ -38,7 +38,7 @@ public function testGetRunnerCreatesARunnerForSymfony(): void
public function testGetRunnerCreatesARunnerForLaravel(): void
{
- $options = [];
+ $options = ['error_handler' => false];
$runtime = new Runtime($options);
$application = $this->createMock(Kernel::class);
@@ -49,7 +49,7 @@ public function testGetRunnerCreatesARunnerForLaravel(): void
public function testGetRunnerFallbacksToClosureRunner(): void
{
- $options = [];
+ $options = ['error_handler' => false];
$runtime = new Runtime($options);
$runner = $runtime->getRunner(null);
diff --git a/src/swoole/tests/Unit/SymfonyHttpBridgeTest.php b/src/swoole/tests/Unit/SymfonyHttpBridgeTest.php
index db22147..b2ef8da 100644
--- a/src/swoole/tests/Unit/SymfonyHttpBridgeTest.php
+++ b/src/swoole/tests/Unit/SymfonyHttpBridgeTest.php
@@ -129,4 +129,23 @@ public function testThatSymfonyBinaryFileResponseWithRangeIsReflected(): void
SymfonyHttpBridge::reflectSymfonyResponse($sfResponse, $response);
}
+
+ public function testStreamedResponseWillRespondWithOneChunkAtATime(): void
+ {
+ $sfResponse = new StreamedResponse(static function () {
+ echo str_repeat('a', 4096);
+ echo str_repeat('b', 4095);
+ });
+
+ $response = $this->createMock(Response::class);
+ $response->expects(self::exactly(2))
+ ->method('write')
+ ->with(self::logicalOr(
+ str_repeat('a', 4096),
+ str_repeat('b', 4095)
+ ));
+ $response->expects(self::once())->method('end');
+
+ SymfonyHttpBridge::reflectSymfonyResponse($sfResponse, $response);
+ }
}