@@ -24,47 +24,52 @@ public function setUpDecoder()
2424
2525 public function testEmitDataWithoutNewlineWillNotForward ()
2626 {
27+ $ this ->decoder ->on ('headers ' , $ this ->expectCallableNever ());
2728 $ this ->decoder ->on ('data ' , $ this ->expectCallableNever ());
2829
2930 $ this ->input ->emit ('data ' , array ("hello " ));
3031 }
3132
32- public function testEmitDataOneLineWillBeSavedAsHeaderAndWillNotForward ()
33+ public function testEmitDataOneLineWillBeSavedAsHeaderAndWillOnlyForwardHeader ()
3334 {
35+ $ this ->decoder ->on ('headers ' , $ this ->expectCallableOnceWith (array ('hello ' , 'world ' )));
3436 $ this ->decoder ->on ('data ' , $ this ->expectCallableNever ());
3537
3638 $ this ->input ->emit ('data ' , array ("hello,world \n" ));
3739 }
3840
39- public function testEmitDataTwoLinesWillForwardOneRecord ()
41+ public function testEmitDataTwoLinesWillForwardHeaderAndOneRecord ()
4042 {
43+ $ this ->decoder ->on ('headers ' , $ this ->expectCallableOnceWith (array ('name ' , 'partner ' )));
4144 $ this ->decoder ->on ('data ' , $ this ->expectCallableOnceWith (array ('name ' => 'alice ' , 'partner ' => 'bob ' )));
4245
4346 $ this ->input ->emit ('data ' , array ("name,partner \nalice,bob \n" ));
4447 }
4548
46- public function testEmitDataTwoLinesWithoutTrailingNewlineWillNotForwardRecord ()
49+ public function testEmitDataTwoLinesWithoutTrailingNewlineWillOnlyForwardHeaderAndNotRecord ()
4750 {
51+ $ this ->decoder ->on ('headers ' , $ this ->expectCallableOnceWith (array ('name ' , 'partner ' )));
4852 $ this ->decoder ->on ('data ' , $ this ->expectCallableNever ());
4953
5054 $ this ->input ->emit ('data ' , array ("name,partner \nalice,bob " ));
5155 }
5256
53- public function testEmitDataTwoLinesWithCustomSemicolonWillForwardOneRecord ()
57+ public function testEmitDataTwoLinesWithCustomSemicolonWillForwardHeaderAndOneRecord ()
5458 {
5559 $ this ->decoder = new AssocDecoder ($ this ->input , '; ' );
60+ $ this ->decoder ->on ('headers ' , $ this ->expectCallableOnceWith (array ('name ' , 'partner ' )));
5661 $ this ->decoder ->on ('data ' , $ this ->expectCallableOnceWith (array ('name ' => 'alice ' , 'partner ' => 'bob ' )));
5762
5863 $ this ->input ->emit ('data ' , array ("name;partner \nalice;bob \n" ));
5964 }
6065
61- public function testEmitDataTwoLinesButWrongColumnCoundWillEmitErrorAndClose ()
66+ public function testEmitDataTwoLinesButWrongColumnCountWillForwardHeaderAndWillEmitAndErrorAndClose ()
6267 {
68+ $ this ->decoder ->on ('headers ' , $ this ->expectCallableOnceWith (array ('name ' , 'partner ' )));
6369 $ this ->decoder ->on ('data ' , $ this ->expectCallableNever ());
6470 $ this ->decoder ->on ('error ' , $ this ->expectCallableOnceWith ($ this ->isInstanceOf ('UnexpectedValueException ' )));
6571 $ this ->decoder ->on ('close ' , $ this ->expectCallableOnce ());
6672
67-
6873 $ this ->input ->emit ('data ' , array ("name,partner \nalice \n" ));
6974 }
7075
0 commit comments