/** @test */ public function it_unfollows_another_user() { $users = TestDummy::times(2)->create('Larabook\\Users\\User'); $this->repo->follow($users[1]->id, $users[0]); $this->repo->unfollow($users[1]->id, $users[0]); $this->tester->dontSeeRecord('follows', ['follower_id' => $users[0]->id, 'followed_id' => $users[1]->id]); }
/** * @test */ public function it_unfollows_another_user() { list($john, $susan) = TestDummy::times(2)->create('Larabook\Users\User'); $this->repo->follow($susan->id, $john); $this->repo->unfollow($susan->id, $john); $this->tester->dontSeeRecord('follows', [ 'follower_id' => $john->id, 'followed_id' => $susan->id ]); }
/** @test */ public function it_unfollows_another_user() { // given I have two users list($john, $susan) = TestDummy::times(2)->create('Larabook\\Users\\User'); // and one user follows another user $this->repo->follow($susan->id, $john); // when I unfollow that same user $this->repo->unfollow($susan->id, $john); // then I should NOT see that user in the list of those that $john follows... $this->tester->dontSeeRecord('follows', ['follower_id' => $john->id, 'followed_id' => $susan->id]); }
/** @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]); }
/** @tests */ public function it_unfollows_another_user() { // given I have two users // an array of using object that was created $users = TestDummy::times(2)->create('Larabook\\Users\\User'); //and one user follows another user $this->repo->follow($users[1]->id, $users[0]); //when I unfollow the same user $this->repo->unfollow($users[1]->id, $users[0]); // then I should NOT see that user in the list of those that $users[0] follows... $this->tester->dontSeeRecord('follows', ['follower_id' => $users[0]->id, 'followed_id' => $users[1]->id]); }
/** * @test * * Uses array index to access specific user */ public function it_unfollows_another_user() { // I have 2 users list($john, $susan) = TestDummy::times(2)->create('App\\User'); // User Id to unfollow (second user) $userIdToUnfollow = $susan->id; // And first User unfollows the second User $john->followedUsers()->detach($userIdToUnfollow); // You should see the list of those that user[0] follows // Method 1 (assertCount) - seeing that there is 1 user following $this->assertCount(0, $john->followedUsers()->get()); // Method 2 (assertTrue) - Does the list of followed users contain the second user $this->assertFalse($john->followedUsers->contains($susan->id)); // Method 3 (seeRecord) - Seeing if the record exists in the table $this->tester->dontSeeRecord('follows', ['follower_id' => $john->id, 'followed_id' => $susan->id]); }