@@ -242,6 +242,25 @@ public function testContainerLogsStreamReturnStreamWhenInspectingContainerResolv
242242 $ response ->write ('output ' );
243243 }
244244
245+ public function testContainerLogsStreamWithCustomStderrEventReturnStreamThatEmitsCustomStderrEventWhenInspectingContainerResolvesWithoutTtyAndContainerLogsRequestResolves ()
246+ {
247+ $ this ->browser ->expects ($ this ->once ())->method ('get ' )->with ('containers/123/json ' )->willReturn (\React \Promise \resolve (new Response (200 , array (), '{"Config":{"Tty":false}} ' )));
248+ $ this ->browser ->expects ($ this ->once ())->method ('requestStreaming ' )->with ('GET ' , 'containers/123/logs?stdout=1&stderr=1 ' )->willReturn (\React \Promise \resolve (new Response (200 , array (), '' )));
249+
250+ $ response = new ThroughStream ();
251+ $ demultiplexed = new ThroughStream ();
252+ $ this ->parser ->expects ($ this ->once ())->method ('expectJson ' )->willReturn (array ('Config ' => array ('Tty ' => false )));
253+ $ this ->streamingParser ->expects ($ this ->once ())->method ('parsePlainStream ' )->willReturn ($ response );
254+ $ this ->streamingParser ->expects ($ this ->once ())->method ('demultiplexStream ' )->with ($ response , 'stderr ' )->willReturn ($ demultiplexed );
255+
256+ $ stream = $ this ->client ->containerLogsStream ('123 ' , false , true , true , 0 , false , null , 'stderr ' );
257+
258+ $ stream ->on ('data ' , $ this ->expectCallableOnceWith ('output ' ));
259+ $ stream ->on ('stderr ' , $ this ->expectCallableOnceWith ('error ' ));
260+ $ demultiplexed ->write ('output ' );
261+ $ demultiplexed ->emit ('stderr ' , array ('error ' ));
262+ }
263+
245264 public function testContainerExport ()
246265 {
247266 $ data = 'tar stream ' ;
@@ -437,6 +456,25 @@ public function testContainerAttachStreamReturnStreamWhenInspectingContainerReso
437456 $ response ->write ('output ' );
438457 }
439458
459+ public function testContainerAttachStreamWithCustomStderrEventReturnStreamThatEmitsCustomStderrEventWhenInspectingContainerResolvesWithoutTtyAndContainerAttachRequestResolves ()
460+ {
461+ $ this ->browser ->expects ($ this ->once ())->method ('get ' )->with ('containers/123/json ' )->willReturn (\React \Promise \resolve (new Response (200 , array (), '{"Config":{"Tty":false}} ' )));
462+ $ this ->browser ->expects ($ this ->once ())->method ('requestStreaming ' )->with ('POST ' , 'containers/123/attach?logs=1&stream=1&stdout=1&stderr=1 ' )->willReturn (\React \Promise \resolve (new Response (200 , array (), '' )));
463+
464+ $ response = new ThroughStream ();
465+ $ demultiplexed = new ThroughStream ();
466+ $ this ->parser ->expects ($ this ->once ())->method ('expectJson ' )->willReturn (array ('Config ' => array ('Tty ' => false )));
467+ $ this ->streamingParser ->expects ($ this ->once ())->method ('parsePlainStream ' )->willReturn ($ response );
468+ $ this ->streamingParser ->expects ($ this ->once ())->method ('demultiplexStream ' )->with ($ response , 'stderr ' )->willReturn ($ demultiplexed );
469+
470+ $ stream = $ this ->client ->containerAttachStream ('123 ' , true , true , true , true , 'stderr ' );
471+
472+ $ stream ->on ('data ' , $ this ->expectCallableOnceWith ('output ' ));
473+ $ stream ->on ('stderr ' , $ this ->expectCallableOnceWith ('error ' ));
474+ $ demultiplexed ->write ('output ' );
475+ $ demultiplexed ->emit ('stderr ' , array ('error ' ));
476+ }
477+
440478 public function testContainerRemove ()
441479 {
442480 $ this ->expectRequestFlow ('delete ' , 'containers/123 ' , $ this ->createResponse (), 'expectEmpty ' );
0 commit comments