/**
* @covers React\Stream\Stream::__construct
* @covers React\Stream\Stream::handleData
*/
public function testDataEventDoesEmitOneChunkUntilStreamEndsWhenBufferSizeIsInfinite()
{
$stream = fopen('php://temp', 'r+');
$loop = $this->createLoopMock();
$capturedData = null;
$conn = new Stream($stream, $loop);
$conn->bufferSize = null;
$conn->on('data', function ($data) use(&$capturedData) {
$capturedData = $data;
});
fwrite($stream, str_repeat("a", 100000));
rewind($stream);
$conn->handleData($stream);
$this->assertFalse($conn->isReadable());
$this->assertEquals(100000, strlen($capturedData));
}