@@ -171,6 +171,27 @@ public function testExecStringCommandWithOutputWhileRunning($container)
171171 $ this ->assertEquals ('hello world ' , $ output );
172172 }
173173
174+ /**
175+ * @depends testStartRunning
176+ * @param string $container
177+ */
178+ public function testExecStreamOutputInMultipleChunksWhileRunning ($ container )
179+ {
180+ $ promise = $ this ->client ->execCreate ($ container , 'echo -n hello && sleep 0 && echo -n world ' );
181+ $ exec = Block \await ($ promise , $ this ->loop );
182+
183+ $ this ->assertTrue (is_array ($ exec ));
184+ $ this ->assertTrue (is_string ($ exec ['Id ' ]));
185+
186+ $ stream = $ this ->client ->execStartStream ($ exec ['Id ' ]);
187+ $ stream ->once ('data ' , $ this ->expectCallableOnceWith ('hello ' ));
188+ //$stream->on('end', $this->expectCallableOnce());
189+
190+ $ output = Block \await (Stream \buffer ($ stream ), $ this ->loop );
191+
192+ $ this ->assertEquals ('helloworld ' , $ output );
193+ }
194+
174195 /**
175196 * @depends testStartRunning
176197 * @param string $container
@@ -228,6 +249,29 @@ public function testExecStreamCommandWithTtyAndStderrOutputWhileRunning($contain
228249 $ this ->assertEquals ('hello world ' , $ output );
229250 }
230251
252+ /**
253+ * @depends testStartRunning
254+ * @param string $container
255+ */
256+ public function testExecStreamStderrCustomEventWhileRunning ($ container )
257+ {
258+ $ promise = $ this ->client ->execCreate ($ container , 'echo -n hello world >&2 ' );
259+ $ exec = Block \await ($ promise , $ this ->loop );
260+
261+ $ this ->assertTrue (is_array ($ exec ));
262+ $ this ->assertTrue (is_string ($ exec ['Id ' ]));
263+
264+ $ stream = $ this ->client ->execStartStream ($ exec ['Id ' ], false , 'err ' );
265+ $ stream ->on ('err ' , $ this ->expectCallableOnceWith ('hello world ' ));
266+ $ stream ->on ('data ' , $ this ->expectCallableNever ());
267+ $ stream ->on ('error ' , $ this ->expectCallableNever ());
268+ //$stream->on('end', $this->expectCallableOnce());
269+
270+ $ output = Block \await (Stream \buffer ($ stream ), $ this ->loop );
271+
272+ $ this ->assertEquals ('' , $ output );
273+ }
274+
231275 /**
232276 * @depends testStartRunning
233277 * @param string $container
0 commit comments