/** @test **/ public function it_can_tell_how_many_groups_a_user_is_member_of() { $users = $this->createUsers(4); $group = Groups::create($this->user->id, $this->data); $group1 = Groups::create($this->user->id, $this->data); $group->request($users[1]->id); $group->acceptRequest($users[1]->id); $group1->request($users[1]->id); $group1->acceptRequest($users[1]->id); $u = Musonza\Groups\Models\User::find($users[1]->id); $this->assertEquals(2, $u->groups->count()); }
/** @test **/ public function it_can_count_user_posts() { $this->post2 = Groups::createPost($this->data); $user = Musonza\Groups\Models\User::find(1); $this->assertEquals(2, $user->posts->count()); }