/** @test */ public function it_unfallows_the_user() { # Given I have 2 users list($john, $susan) = Factory::times(2)->create(User::class); # And one user fallows another user $this->repo->fallow($susan, $john); # then I unfallow that same user $this->repo->unfallow($susan, $john); # Then I should NOT see the user in a list of those that $john fallows... $this->tester->dontSeeRecord('fallows', ['fallower_id' => $john->id, 'fallowed_id' => $susan->id]); }
/** * Execute the job. * * @param UserRepository $userRepository */ public function handle(UserRepository $userRepository) { $fallower = $userRepository->findById($this->userId); $userToFallow = $userRepository->findById($this->userIdToFallow); $userRepository->fallow($userToFallow, $fallower); return $fallower; }