Skip to content

Commit e203df1

Browse files
committed
Test piping stream
1 parent d2b185a commit e203df1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/UnwrapReadableTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use React\EventLoop\Factory;
77
use React\Promise\Timer;
88
use Clue\React\Block;
9+
use React\Stream\BufferedSink;
910

1011
class UnwrapReadableTest extends TestCase
1112
{
@@ -186,4 +187,21 @@ public function testForwardsResumeToInputStream()
186187

187188
$stream->resume();
188189
}
190+
191+
public function testPipingStreamWillForwardDataEvents()
192+
{
193+
$input = new ReadableStream();
194+
195+
$promise = Promise\resolve($input);
196+
$stream = Stream\unwrapReadable($promise);
197+
198+
$output = new BufferedSink();
199+
$stream->pipe($output);
200+
201+
$input->emit('data', array('hello'));
202+
$input->emit('data', array('world'));
203+
$input->close();
204+
205+
$output->promise()->then($this->expectCallableOnceWith('helloworld'));
206+
}
189207
}

0 commit comments

Comments
 (0)