File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 6
6
use React \EventLoop \Factory ;
7
7
use React \Promise \Timer ;
8
8
use Clue \React \Block ;
9
+ use React \Stream \BufferedSink ;
9
10
10
11
class UnwrapReadableTest extends TestCase
11
12
{
@@ -186,4 +187,21 @@ public function testForwardsResumeToInputStream()
186
187
187
188
$ stream ->resume ();
188
189
}
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
+ }
189
207
}
You can’t perform that action at this time.
0 commit comments