File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -191,6 +191,27 @@ public function testMovingCursorWithoutEchoDoesNotNeedToRedraw()
191191 $ this ->assertSame ($ this ->readline , $ this ->readline ->moveCursorBy (2 ));
192192 }
193193
194+ public function testDataEventWillBeEmittedForCompleteLine ()
195+ {
196+ $ this ->readline ->on ('data ' , $ this ->expectCallableOnceWith ('hello ' ));
197+
198+ $ this ->pushInputBytes ($ this ->readline , "hello \n" );
199+ }
200+
201+ public function testDataEventWillNotBeEmittedForIncompleteLine ()
202+ {
203+ $ this ->readline ->on ('data ' , $ this ->expectCallableNever ());
204+
205+ $ this ->pushInputBytes ($ this ->readline , "hello " );
206+ }
207+
208+ public function testDataEventWillBeEmittedForEmptyLine ()
209+ {
210+ $ this ->readline ->on ('data ' , $ this ->expectCallableOnceWith ('' ));
211+
212+ $ this ->pushInputBytes ($ this ->readline , "\n" );
213+ }
214+
194215 public function testWriteSimpleCharWritesOnce ()
195216 {
196217 $ this ->output ->expects ($ this ->once ())->method ('write ' )->with ($ this ->equalTo ("\r\033[K " . "k " ));
You can’t perform that action at this time.
0 commit comments