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); }
/** * Pass me an email/username combo and I'll start the user session * * @param $email * @param $pass * * @return User * @throws \CirclicalUser\Exception\BadPasswordException * @throws \CirclicalUser\Exception\NoSuchUserException */ public function authenticate($email, $pass) { return $this->authenticationService->authenticate($email, $pass); }