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); }
/** * Give me a user and password, and I'll create authentication records for you * * @param User $user * @param string $username Can be an email address or username, should be validated prior * @param string $password */ public function create(User $user, $username, $password) { $this->authenticationService->create($user, $username, $password); }