findByName() public method

Find a group by name.
public findByName ( $name ) : mixed
$name
return mixed
Exemplo n.º 1
0
 /**
  * Find a group By name
  *
  * @param $group_name
  * @return mixed
  * @throws \Fenos\Notifynder\Exceptions\NotifynderGroupNotFoundException
  */
 public function findByName($group_name)
 {
     $group = $this->groupRepo->findByName($group_name);
     if (is_null($group)) {
         $error = "Group Not Found";
         throw new NotifynderGroupNotFoundException($error);
     }
     return $group;
 }
Exemplo n.º 2
0
 /** @test */
 function it_try_to_find_an_not_existing_group_by_name(NotifynderGroupDB $groupDB)
 {
     $group_name = 'mygroup';
     $groupDB->findByName($group_name)->shouldBeCalled()->willReturn(null);
     $this->shouldThrow(NotifynderGroupNotFoundException::class)->during('findByName', [$group_name]);
 }