CodeExplorer OidcUserInfoTokenHandler example
$responseMock =
$this->
createMock(ResponseInterface::
class);
$responseMock->
expects($this->
once()) ->
method('toArray'
) ->
willReturn($claims);
$clientMock =
$this->
createMock(HttpClientInterface::
class);
$clientMock->
expects($this->
once()) ->
method('request'
)->
with('GET', '',
['auth_bearer' =>
$accessToken]) ->
willReturn($responseMock);
$userBadge =
(new OidcUserInfoTokenHandler($clientMock, null,
$claim))->
getUserBadgeFrom($accessToken);
$actualUser =
$userBadge->
getUserLoader()();
$this->
assertEquals(new UserBadge($expected,
new FallbackUserLoader(fn () =>
$expectedUser),
$claims),
$userBadge);
$this->
assertInstanceOf(OidcUser::
class,
$actualUser);
$this->
assertEquals($expectedUser,
$actualUser);
$this->
assertEquals($claims,
$userBadge->
getAttributes());
$this->
assertEquals($claims['sub'
],
$actualUser->
getUserIdentifier());
} public static function getClaims(): iterable
{