Пример #1
0
 /** @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]);
 }
Пример #2
0
 /**
  * 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;
 }