diff --git a/tests/FetchAuthTokenTest.php b/tests/FetchAuthTokenTest.php index 5b7badbe0..79c2daf95 100644 --- a/tests/FetchAuthTokenTest.php +++ b/tests/FetchAuthTokenTest.php @@ -25,6 +25,7 @@ use Google\Auth\CredentialsLoader; use Google\Auth\FetchAuthTokenInterface; use Google\Auth\OAuth2; +use Google\Auth\UpdateMetadataInterface; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; @@ -53,9 +54,19 @@ class_implements($fetcherClass) )) { $mockFetcher->getQuotaProject()->shouldBeCalledTimes(1); } - $mockFetcher->fetchAuthToken(Argument::any()) + + if (is_a($fetcherClass, UpdateMetadataInterface::class, true)) { + $mockFetcher->updateMetadata(Argument::cetera()) + ->shouldBeCalledTimes(1) + ->willReturn(['authorization' => 'Bearer xyz']); + $mockFetcher->getLastReceivedToken() + ->shouldBeCalledTimes(1) + ->will($httpHandler); + } else { + $mockFetcher->fetchAuthToken(Argument::any()) ->shouldBeCalledTimes(1) ->will($httpHandler); + } $mockFetcher->getCacheKey()->willReturn(''); $tokenCallbackCalled = false;