本文整理汇总了PHP中Sylius\Component\User\Model\UserInterface::addOAuthAccount方法的典型用法代码示例。如果您正苦于以下问题:PHP UserInterface::addOAuthAccount方法的具体用法?PHP UserInterface::addOAuthAccount怎么用?PHP UserInterface::addOAuthAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sylius\Component\User\Model\UserInterface
的用法示例。
在下文中一共展示了UserInterface::addOAuthAccount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function it_should_connect_oauth_account_with_given_user(
$userManager,
$oauthRepository,
UserInterface $user,
UserResponseInterface $response,
ResourceOwnerInterface $resourceOwner,
UserOAuthInterface $oauth
) {
$resourceOwner->getName()->willReturn('google');
$response->getEmail()->willReturn(null);
$response->getUsername()->willReturn('username');
$response->getResourceOwner()->willReturn($resourceOwner);
$response->getAccessToken()->willReturn('access_token');
$oauthRepository->createNew()->willReturn($oauth);
$oauth->setIdentifier('username');
$oauth->setProvider('google');
$oauth->setAccessToken('access_token');
$user->addOAuthAccount($oauth)->shouldBeCalled();
$userManager->persist($user)->shouldBeCalled();
$userManager->flush()->shouldBeCalled();
$this->connect($user, $response);
}