Find a group by ID.
public find ( $groupId ) : Illuminate\Database\Eloquent\Collection | |
||
$groupId | ||
return | Illuminate\Database\Eloquent\Collection | |
/** * Find a group by id * * @param $group_id * @return \Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model|static * @throws \Fenos\Notifynder\Exceptions\NotifynderGroupNotFoundException */ public function findById($group_id) { $group = $this->groupRepo->find($group_id); if (is_null($group)) { $error = "Group Not Found"; throw new NotifynderGroupNotFoundException($error); } return $group; }
/** @test */ function it_try_to_find_an_not_existing_group_by_id(NotifynderGroupDB $groupDB) { $group_id = 1; $groupDB->find($group_id)->shouldBeCalled()->willReturn(null); $this->shouldThrow(NotifynderGroupNotFoundException::class)->during('findById', [$group_id]); }