File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -94,8 +94,7 @@ public function handleError(\Exception $e)
9494 public function handleEnd ()
9595 {
9696 if (!$ this ->closed ) {
97- $ this ->emit ('end ' );
98- $ this ->close ();
97+ $ this ->handleError (new \Exception ('Unexpected end event ' ));
9998 }
10099 }
101100
Original file line number Diff line number Diff line change @@ -105,4 +105,16 @@ public function testOutputStreamCanCloseInputStream()
105105
106106 $ this ->assertFalse ($ input ->isReadable ());
107107 }
108+
109+ public function testHandleUnexpectedEnd ()
110+ {
111+ $ stream = new LengthLimitedStream ($ this ->input , 5 );
112+
113+ $ stream ->on ('data ' , $ this ->expectCallableNever ());
114+ $ stream ->on ('close ' , $ this ->expectCallableOnce ());
115+ $ stream ->on ('end ' , $ this ->expectCallableNever ());
116+ $ stream ->on ('error ' , $ this ->expectCallableOnce ());
117+
118+ $ this ->input ->emit ('end ' );
119+ }
108120}
You can’t perform that action at this time.
0 commit comments