11<?php
22
33use Clue \React \Shell \ProcessLauncher ;
4- use React \Stream \ReadableStream ;
54
65class ProcessLauncherTest extends TestCase
76{
@@ -30,9 +29,12 @@ public function testProcessWillBeStarted()
3029 public function testClosingStreamTerminatesRunningProcess ()
3130 {
3231 $ process = $ this ->getMockBuilder ('React\ChildProcess\Process ' )->disableOriginalConstructor ()->getMock ();
33- $ process ->stdout = new ReadableStream ();
32+ $ process ->stdout = $ this -> getMockBuilder ( ' React\Stream\ReadableStreamInterface ' )-> getMock ();
3433 $ process ->stdin = $ this ->getMockBuilder ('React\Stream\WritableStreamInterface ' )->getMock ();
3534
35+ $ process ->stdout ->expects ($ this ->any ())->method ('isReadable ' )->willReturn (true );
36+ $ process ->stdin ->expects ($ this ->any ())->method ('isWritable ' )->willReturn (true );
37+
3638 $ process ->expects ($ this ->once ())->method ('isRunning ' )->will ($ this ->returnValue (true ));
3739 $ process ->expects ($ this ->once ())->method ('terminate ' )->with ($ this ->equalTo (SIGKILL ));
3840
@@ -44,9 +46,12 @@ public function testClosingStreamTerminatesRunningProcess()
4446 public function testClosingStreamOfNonRunningProcessWillNotTerminate ()
4547 {
4648 $ process = $ this ->getMockBuilder ('React\ChildProcess\Process ' )->disableOriginalConstructor ()->getMock ();
47- $ process ->stdout = new ReadableStream ();
49+ $ process ->stdout = $ this -> getMockBuilder ( ' React\Stream\ReadableStreamInterface ' )-> getMock ();
4850 $ process ->stdin = $ this ->getMockBuilder ('React\Stream\WritableStreamInterface ' )->getMock ();
4951
52+ $ process ->stdout ->expects ($ this ->any ())->method ('isReadable ' )->willReturn (true );
53+ $ process ->stdin ->expects ($ this ->any ())->method ('isWritable ' )->willReturn (true );
54+
5055 $ process ->expects ($ this ->once ())->method ('isRunning ' )->will ($ this ->returnValue (false ));
5156 $ process ->expects ($ this ->never ())->method ('terminate ' );
5257
0 commit comments