@@ -213,7 +213,7 @@ public function testTokenInvalidate():void{
213
213
214
214
$ token = $ this ->getTestToken ();
215
215
216
- $ this ->provider ->storeAccessToken ($ this -> getTestToken () );
216
+ $ this ->provider ->storeAccessToken ($ token );
217
217
218
218
$ this ::assertTrue ($ this ->storage ->hasAccessToken ($ this ->provider ->getName ()));
219
219
$ this ::assertTrue ($ this ->provider ->invalidateAccessToken ());
@@ -231,6 +231,44 @@ public function testTokenInvalidate():void{
231
231
$ this ::assertSame ('still here ' , $ this ->provider ->getStorage ()->getAccessToken ($ this ->provider ->getName ())->accessToken );
232
232
}
233
233
234
+ public function testTokenInvalidateFailed ():void {
235
+
236
+ if (!$ this ->provider instanceof TokenInvalidate){
237
+ $ this ::markTestSkipped ('TokenInvalidate N/A ' );
238
+ }
239
+
240
+ $ token = $ this ->getTestToken ();
241
+
242
+ $ this ->provider ->storeAccessToken ($ token );
243
+
244
+ $ this ->setMockResponse ($ this ->responseFactory ->createResponse (404 ));
245
+
246
+ $ this ::assertFalse ($ this ->provider ->invalidateAccessToken ());
247
+ }
248
+
249
+ public function testTokenInvalidateFailedWithException ():void {
250
+
251
+ if (!$ this ->provider instanceof TokenInvalidate){
252
+ $ this ::markTestSkipped ('TokenInvalidate N/A ' );
253
+ }
254
+
255
+ $ this ->expectException (ProviderException::class);
256
+ $ this ->expectExceptionMessage ('whatever ' );
257
+
258
+ $ token = $ this ->getTestToken ();
259
+
260
+ $ this ->provider ->storeAccessToken ($ token );
261
+
262
+ $ response = $ this ->responseFactory
263
+ ->createResponse (404 )
264
+ ->withHeader ('Content-Type ' , 'application/json ' )
265
+ ->withBody ($ this ->streamFactory ->createStream ('{"error":"whatever"} ' ));
266
+
267
+ $ this ->setMockResponse ($ response );
268
+
269
+ $ this ->provider ->invalidateAccessToken ();
270
+ }
271
+
234
272
public function testTokenInvalidateNoTokenException ():void {
235
273
236
274
if (!$ this ->provider instanceof TokenInvalidate){
0 commit comments