File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ public function close()
5858 $ this ->writable = false ;
5959
6060 $ this ->emit ('close ' );
61+ $ this ->removeAllListeners ();
6162 }
6263
6364 public function isReadable ()
Original file line number Diff line number Diff line change @@ -53,6 +53,18 @@ public function testDoesNotEmitIfAlreadyEnded(TransformStream $stream)
5353 $ stream ->close ();
5454 }
5555
56+ public function testCloseRemovesListeners ()
57+ {
58+ $ stream = new TransformStream ();
59+ $ this ->assertCount (0 , $ stream ->listeners ('close ' ));
60+
61+ $ stream ->on ('close ' , $ this ->expectCallableOnce ());
62+ $ this ->assertCount (1 , $ stream ->listeners ('close ' ));
63+
64+ $ stream ->close ();
65+ $ this ->assertCount (0 , $ stream ->listeners ('close ' ));
66+ }
67+
5668 public function testCloseOnlyEmitsCloses ()
5769 {
5870 $ stream = new TransformStream ();
You can’t perform that action at this time.
0 commit comments