File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -156,6 +156,8 @@ public function close($callback = null)
156156 $ this ->_doCommand (new QuitCommand ($ this ))
157157 ->on ('success ' , function () use ($ callback ) {
158158 $ this ->state = self ::STATE_CLOSED ;
159+ $ this ->emit ('end ' , [$ this ]);
160+ $ this ->emit ('close ' , [$ this ]);
159161 if ($ callback ) {
160162 $ callback ($ this );
161163 }
Original file line number Diff line number Diff line change @@ -27,9 +27,21 @@ public function testConnectWithInvalidPass()
2727
2828 public function testConnectWithValidPass ()
2929 {
30+ $ this ->expectOutputString ('endclose ' );
31+
3032 $ loop = \React \EventLoop \Factory::create ();
3133 $ conn = new Connection ($ loop , $ this ->connectOptions );
3234
35+ $ conn ->on ('end ' , function ($ conn ){
36+ $ this ->assertInstanceOf ('React\MySQL\Connection ' , $ conn );
37+ echo 'end ' ;
38+ });
39+
40+ $ conn ->on ('close ' , function ($ conn ){
41+ $ this ->assertInstanceOf ('React\MySQL\Connection ' , $ conn );
42+ echo 'close ' ;
43+ });
44+
3345 $ conn ->connect (function ($ err , $ conn ) use ($ loop ) {
3446 $ this ->assertEquals (null , $ err );
3547 $ this ->assertInstanceOf ('React\MySQL\Connection ' , $ conn );
You can’t perform that action at this time.
0 commit comments