@@ -195,36 +195,36 @@ public function testDataEventWillBeEmittedForCompleteLine()
195195 {
196196 $ this ->readline ->on ('data ' , $ this ->expectCallableOnceWith ('hello ' ));
197197
198- $ this ->pushInputBytes ( $ this -> readline , "hello \n" );
198+ $ this ->input -> emit ( ' data ' , array ( "hello \n" ) );
199199 }
200200
201201 public function testDataEventWillNotBeEmittedForIncompleteLine ()
202202 {
203203 $ this ->readline ->on ('data ' , $ this ->expectCallableNever ());
204204
205- $ this ->pushInputBytes ( $ this -> readline , "hello " );
205+ $ this ->input -> emit ( ' data ' , array ( "hello " ) );
206206 }
207207
208208 public function testDataEventWillBeEmittedForEmptyLine ()
209209 {
210210 $ this ->readline ->on ('data ' , $ this ->expectCallableOnceWith ('' ));
211211
212- $ this ->pushInputBytes ( $ this -> readline , "\n" );
212+ $ this ->input -> emit ( ' data ' , array ( "\n" ) );
213213 }
214214
215215 public function testWriteSimpleCharWritesOnce ()
216216 {
217217 $ this ->output ->expects ($ this ->once ())->method ('write ' )->with ($ this ->equalTo ("\r\033[K " . "k " ));
218218
219- $ this ->pushInputBytes ( $ this -> readline , 'k ' );
219+ $ this ->input -> emit ( ' data ' , array ( 'k ' ) );
220220 }
221221
222222 public function testWriteMultiByteCharWritesOnce ()
223223 {
224224 $ this ->output ->expects ($ this ->once ())->method ('write ' )->with ($ this ->equalTo ("\r\033[K " . "\xF0\x9D\x84\x9E" ));
225225
226226 // "𝄞" – U+1D11E MUSICAL SYMBOL G CLEF
227- $ this ->pushInputBytes ( $ this -> readline , "\xF0\x9D\x84\x9E" );
227+ $ this ->input -> emit ( ' data ' , array ( "\xF0\x9D\x84\x9E" ) );
228228 }
229229
230230 public function testKeysHomeMovesToFront ()
@@ -276,7 +276,7 @@ public function testKeysRightMovesToRight(Readline $readline)
276276
277277 public function testKeysSimpleChars ()
278278 {
279- $ this ->pushInputBytes ( $ this -> readline , 'hi! ' );
279+ $ this ->input -> emit ( ' data ' , array ( 'hi! ' ) );
280280
281281 $ this ->assertEquals ('hi! ' , $ this ->readline ->getInput ());
282282 $ this ->assertEquals (3 , $ this ->readline ->getCursorPosition ());
@@ -300,7 +300,7 @@ public function testKeysBackspaceDeletesLastCharacter(Readline $readline)
300300
301301 public function testKeysMultiByteInput ()
302302 {
303- $ this ->pushInputBytes ( $ this -> readline , 'hä ' );
303+ $ this ->input -> emit ( ' data ' , array ( 'hä ' ) );
304304
305305 $ this ->assertEquals ('hä ' , $ this ->readline ->getInput ());
306306 $ this ->assertEquals (2 , $ this ->readline ->getCursorPosition ());
@@ -372,7 +372,7 @@ public function testKeysPrependCharacterInFrontOfMultiByte()
372372 $ this ->readline ->setInput ('ü ' );
373373 $ this ->readline ->moveCursorTo (0 );
374374
375- $ this ->pushInputBytes ( $ this -> readline , 'h ' );
375+ $ this ->input -> emit ( ' data ' , array ( 'h ' ) );
376376
377377 $ this ->assertEquals ('hü ' , $ this ->readline ->getInput ());
378378 $ this ->assertEquals (1 , $ this ->readline ->getCursorPosition ());
@@ -383,7 +383,7 @@ public function testKeysWriteMultiByteAfterMultiByte()
383383 {
384384 $ this ->readline ->setInput ('ü ' );
385385
386- $ this ->pushInputBytes ( $ this -> readline , 'ä ' );
386+ $ this ->input -> emit ( ' data ' , array ( 'ä ' ) );
387387
388388 $ this ->assertEquals ('üä ' , $ this ->readline ->getInput ());
389389 $ this ->assertEquals (2 , $ this ->readline ->getCursorPosition ());
@@ -395,7 +395,7 @@ public function testKeysPrependMultiByteInFrontOfMultiByte()
395395 $ this ->readline ->setInput ('ü ' );
396396 $ this ->readline ->moveCursorTo (0 );
397397
398- $ this ->pushInputBytes ( $ this -> readline , 'ä ' );
398+ $ this ->input -> emit ( ' data ' , array ( 'ä ' ) );
399399
400400 $ this ->assertEquals ('äü ' , $ this ->readline ->getInput ());
401401 $ this ->assertEquals (1 , $ this ->readline ->getCursorPosition ());
@@ -579,11 +579,4 @@ public function testPipeWillReturnDest()
579579
580580 $ this ->assertEquals ($ dest , $ ret );
581581 }
582-
583- private function pushInputBytes (Readline $ readline , $ bytes )
584- {
585- foreach (str_split ($ bytes , 1 ) as $ byte ) {
586- $ this ->input ->emit ('data ' , array ($ byte ));
587- }
588- }
589582}
0 commit comments