public function testSave() { $user = new User(new Email('*****@*****.**')); $user->setPassword('savedPassword')->setName('Saved John'); try { $toDelete = $this->userRepository->findByEmail($user->getEmail()); $this->userRepository->delete($toDelete); } catch (OutOfBoundsException $e) { } $savedUser = $this->userRepository->save($user); $this->assertNotNull($savedUser->getId()); $toDelete = $this->userRepository->findByEmail($user->getEmail()); $this->userRepository->delete($toDelete); }
/** * Remove the specified resource from storage. * * @param int $id * * @return \Illuminate\Http\Response */ public function destroy($id) { $user = $this->userRepository->findById($id); return response()->json($this->userRepository->delete($user)); }