@@ -244,6 +244,11 @@ public function testOnErrorDoesTriggerForOAuthRequests()
244
244
245
245
// Setup Reauthorization Client
246
246
$ reauth_responder = new MockHandler ([
247
+ // This token is returned and used for the first request
248
+ new Psr7Response (200 , [], json_encode ([
249
+ 'access_token ' => $ mock_access_token ,
250
+ ])),
251
+ // The endpoint returned 401, so the previous token was deleted and this one is fetched:
247
252
new Psr7Response (200 , [], json_encode ([
248
253
'access_token ' => $ mock_access_token ,
249
254
])),
@@ -295,7 +300,7 @@ public function testOnErrorDoesTriggerForOAuthRequests()
295
300
296
301
$ response = $ client ->get ('/ ' );
297
302
298
- $ this ->assertCount (1 , $ reauth_container );
303
+ $ this ->assertCount (2 , $ reauth_container );
299
304
$ this ->assertCount (2 , $ container );
300
305
301
306
// This proves that the access_token received from the reauth_client was used to authenticate this response
@@ -548,7 +553,7 @@ public function testOnErrorDoesNotLoop()
548
553
// We let the ServerException (the Error 500) bubble up to PHPUnit
549
554
}
550
555
551
- $ this ->assertCount (1 , $ reauth_container );
556
+ $ this ->assertCount (2 , $ reauth_container );
552
557
$ this ->assertCount (2 , $ container );
553
558
554
559
// This proves that the access_token received from the reauth_client was used to authenticate this response
0 commit comments