public function let(AuthenticationService $authenticationService, AccessService $accessService, User $user, User $newUser)
 {
     $authenticationService->authenticate(Argument::any(), Argument::any())->willReturn(null);
     $authenticationService->authenticate('user', 'pass')->willReturn($user);
     $authenticationService->getIdentity()->willReturn($user);
     $authenticationService->create(Argument::type(User::class), Argument::any(), Argument::any())->willReturn($newUser);
     $this->beConstructedWith($authenticationService, $accessService);
 }
 function it_should_not_panic_when_guards_are_not_defined(ServiceManager $serviceManager, RoleMapper $roleMapper, GroupPermissionProviderInterface $ruleMapper, UserPermissionProviderInterface $userActionRuleMapper, AuthenticationService $authenticationService, User $user, UserMapper $userMapper)
 {
     $config = ['circlical' => ['user' => ['providers' => ['role' => RoleMapper::class, 'rule' => ['group' => GroupPermissionProviderInterface::class, 'user' => UserPermissionProviderInterface::class]]]]];
     $user->getId()->willReturn(1);
     $authenticationService->getIdentity()->willReturn($user);
     $serviceManager->get('config')->willReturn($config);
     $serviceManager->get(RoleMapper::class)->willReturn($roleMapper);
     $serviceManager->get(GroupPermissionProviderInterface::class)->willReturn($ruleMapper);
     $serviceManager->get(UserPermissionProviderInterface::class)->willReturn($userActionRuleMapper);
     $serviceManager->get(AuthenticationService::class)->willReturn($authenticationService);
     $serviceManager->get(UserMapper::class)->willReturn($userMapper);
     $this->shouldThrow(\Exception::class)->during('__invoke', [$serviceManager, AccessService::class]);
 }
 public function getIdentity()
 {
     return $this->authenticationService->getIdentity();
 }