@@ -53,6 +53,51 @@ public function testCtorReadlineArgWillBeReturnedBygetReadline()
5353 $ this ->assertSame ($ readline , $ stdio ->getReadline ());
5454 }
5555
56+ public function testCtorThrowsExceptionForInvalidLoop ()
57+ {
58+ $ input = $ this ->getMockBuilder ('React\Stream\ReadableStreamInterface ' )->getMock ();
59+ $ output = $ this ->getMockBuilder ('React\Stream\WritableStreamInterface ' )->getMock ();
60+
61+ //$readline = $this->getMockBuilder('Clue\React\Stdio\Readline')->disableOriginalConstructor()->getMock();
62+ $ readline = new Readline ($ input , $ output );
63+
64+ $ this ->setExpectedException ('InvalidArgumentException ' , 'Argument #1 ($loop) expected null|React\EventLoop\LoopInterface ' );
65+ new Stdio ('invalid ' , $ input , $ output , $ readline );
66+ }
67+
68+ public function testCtorThrowsExceptionForInvalidInput ()
69+ {
70+ $ input = $ this ->getMockBuilder ('React\Stream\ReadableStreamInterface ' )->getMock ();
71+ $ output = $ this ->getMockBuilder ('React\Stream\WritableStreamInterface ' )->getMock ();
72+
73+ //$readline = $this->getMockBuilder('Clue\React\Stdio\Readline')->disableOriginalConstructor()->getMock();
74+ $ readline = new Readline ($ input , $ output );
75+
76+ $ this ->setExpectedException ('InvalidArgumentException ' , 'Argument #2 ($input) expected null|React\Stream\ReadableStreamInterface ' );
77+ new Stdio ($ this ->loop , 'invalid ' , $ output , $ readline );
78+ }
79+
80+ public function testCtorThrowsExceptionForInvalidOutput ()
81+ {
82+ $ input = $ input = $ this ->getMockBuilder ('React\Stream\ReadableStreamInterface ' )->getMock ();
83+ $ output = $ this ->getMockBuilder ('React\Stream\WritableStreamInterface ' )->getMock ();
84+
85+ //$readline = $this->getMockBuilder('Clue\React\Stdio\Readline')->disableOriginalConstructor()->getMock();
86+ $ readline = new Readline ($ input , $ output );
87+
88+ $ this ->setExpectedException ('InvalidArgumentException ' , 'Argument #3 ($output) expected null|React\Stream\WritableStreamInterface ' );
89+ new Stdio ($ this ->loop , $ input , 'invalid ' , $ readline );
90+ }
91+
92+ public function testCtorThrowsExceptionForInvalidReadline ()
93+ {
94+ $ input = $ input = $ this ->getMockBuilder ('React\Stream\ReadableStreamInterface ' )->getMock ();
95+ $ output = $ this ->getMockBuilder ('React\Stream\WritableStreamInterface ' )->getMock ();
96+
97+ $ this ->setExpectedException ('InvalidArgumentException ' , 'Argument #4 ($readline) expected null|Clue\React\Stdio\Readline ' );
98+ new Stdio ($ this ->loop , $ input , $ output , 'invalid ' );
99+ }
100+
56101 public function testWriteEmptyStringWillNotWriteToOutput ()
57102 {
58103 $ input = $ this ->getMockBuilder ('React\Stream\ReadableStreamInterface ' )->getMock ();
0 commit comments