File tree Expand file tree Collapse file tree 2 files changed +28
-4
lines changed
Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -184,9 +184,30 @@ function (Throwable $rejectionReason) use ($sessionOpeningDeferred) {
184184 */
185185 public function removeSession (string $ sessionIdentifier ): PromiseInterface
186186 {
187- // todo: implementation
187+ $ requestUri = sprintf (
188+ 'http://%s:%d/wd/hub/session/%s ' ,
189+ $ this ->_options ['server ' ]['host ' ],
190+ $ this ->_options ['server ' ]['port ' ],
191+ $ sessionIdentifier
192+ );
188193
189- return reject (new RuntimeException ('Not implemented. ' ));
194+ $ requestHeaders = [
195+ 'Content-Type ' => 'application/json; charset=UTF-8 ' ,
196+ ];
197+
198+ $ responsePromise = $ this ->httpClient ->delete ($ requestUri , $ requestHeaders );
199+
200+ $ quitConfirmationPromise = $ responsePromise
201+ ->then (fn (ResponseInterface $ response ) => $ this ->onCommandConfirmation ($ response ))
202+ ->then (
203+ null ,
204+ function (Throwable $ rejectionReason ) {
205+ throw new RuntimeException ('Unable to close a session. ' , 0 , $ rejectionReason );
206+ }
207+ )
208+ ;
209+
210+ return $ quitConfirmationPromise ;
190211 }
191212
192213 /**
Original file line number Diff line number Diff line change @@ -114,9 +114,12 @@ public function getSessionIdentifiers(): PromiseInterface
114114 */
115115 public function removeSession (string $ sessionIdentifier ): PromiseInterface
116116 {
117- // todo: implementation
117+ $ quitConfirmationPromise = $ this -> hubClient -> removeSession ( $ sessionIdentifier );
118118
119- return reject (new RuntimeException ('Not implemented. ' ));
119+ return $ this ->timeoutInterceptor ->applyTimeout (
120+ $ quitConfirmationPromise ,
121+ 'Unable to complete a session remove command. '
122+ );
120123 }
121124
122125 /**
You can’t perform that action at this time.
0 commit comments