@@ -24,47 +24,52 @@ public function setUpDecoder()
24
24
25
25
public function testEmitDataWithoutNewlineWillNotForward ()
26
26
{
27
+ $ this ->decoder ->on ('headers ' , $ this ->expectCallableNever ());
27
28
$ this ->decoder ->on ('data ' , $ this ->expectCallableNever ());
28
29
29
30
$ this ->input ->emit ('data ' , array ("hello " ));
30
31
}
31
32
32
- public function testEmitDataOneLineWillBeSavedAsHeaderAndWillNotForward ()
33
+ public function testEmitDataOneLineWillBeSavedAsHeaderAndWillOnlyForwardHeader ()
33
34
{
35
+ $ this ->decoder ->on ('headers ' , $ this ->expectCallableOnceWith (array ('hello ' , 'world ' )));
34
36
$ this ->decoder ->on ('data ' , $ this ->expectCallableNever ());
35
37
36
38
$ this ->input ->emit ('data ' , array ("hello,world \n" ));
37
39
}
38
40
39
- public function testEmitDataTwoLinesWillForwardOneRecord ()
41
+ public function testEmitDataTwoLinesWillForwardHeaderAndOneRecord ()
40
42
{
43
+ $ this ->decoder ->on ('headers ' , $ this ->expectCallableOnceWith (array ('name ' , 'partner ' )));
41
44
$ this ->decoder ->on ('data ' , $ this ->expectCallableOnceWith (array ('name ' => 'alice ' , 'partner ' => 'bob ' )));
42
45
43
46
$ this ->input ->emit ('data ' , array ("name,partner \nalice,bob \n" ));
44
47
}
45
48
46
- public function testEmitDataTwoLinesWithoutTrailingNewlineWillNotForwardRecord ()
49
+ public function testEmitDataTwoLinesWithoutTrailingNewlineWillOnlyForwardHeaderAndNotRecord ()
47
50
{
51
+ $ this ->decoder ->on ('headers ' , $ this ->expectCallableOnceWith (array ('name ' , 'partner ' )));
48
52
$ this ->decoder ->on ('data ' , $ this ->expectCallableNever ());
49
53
50
54
$ this ->input ->emit ('data ' , array ("name,partner \nalice,bob " ));
51
55
}
52
56
53
- public function testEmitDataTwoLinesWithCustomSemicolonWillForwardOneRecord ()
57
+ public function testEmitDataTwoLinesWithCustomSemicolonWillForwardHeaderAndOneRecord ()
54
58
{
55
59
$ this ->decoder = new AssocDecoder ($ this ->input , '; ' );
60
+ $ this ->decoder ->on ('headers ' , $ this ->expectCallableOnceWith (array ('name ' , 'partner ' )));
56
61
$ this ->decoder ->on ('data ' , $ this ->expectCallableOnceWith (array ('name ' => 'alice ' , 'partner ' => 'bob ' )));
57
62
58
63
$ this ->input ->emit ('data ' , array ("name;partner \nalice;bob \n" ));
59
64
}
60
65
61
- public function testEmitDataTwoLinesButWrongColumnCoundWillEmitErrorAndClose ()
66
+ public function testEmitDataTwoLinesButWrongColumnCountWillForwardHeaderAndWillEmitAndErrorAndClose ()
62
67
{
68
+ $ this ->decoder ->on ('headers ' , $ this ->expectCallableOnceWith (array ('name ' , 'partner ' )));
63
69
$ this ->decoder ->on ('data ' , $ this ->expectCallableNever ());
64
70
$ this ->decoder ->on ('error ' , $ this ->expectCallableOnceWith ($ this ->isInstanceOf ('UnexpectedValueException ' )));
65
71
$ this ->decoder ->on ('close ' , $ this ->expectCallableOnce ());
66
72
67
-
68
73
$ this ->input ->emit ('data ' , array ("name,partner \nalice \n" ));
69
74
}
70
75
0 commit comments