/** * @test * @group userservice */ public function should_throw_user_not_found() { $this->setExpectedException('Bakgat\\Notos\\Domain\\Model\\Identity\\Exceptions\\UserNotFoundException'); $userId = 2; $this->userRepo->shouldReceive('userOfId')->andReturnNull(); $this->userService->userOfId($userId); }
/** * Resets the password of a given user * * @param $userId * @param Request $request * @return User */ public function resetPassword($orgId, $userId, Request $request) { $password = $request->input('password'); $user = $this->userService->userOfId($userId); if ($user) { $user = $this->userService->resetPassword($user, $password); return $this->jsonResponse($user); } else { abort(404, 'User with id [' . $user . '] not found.'); } }