Example #1
0
 /**
  * Add a group in the db
  *
  * @param $name
  * @throws InvalidArgumentException
  * @return \Illuminate\Database\Eloquent\Model|static
  */
 public function addGroup($name)
 {
     if ($this->isStringWithDots($name)) {
         return $this->groupRepo->create($name);
     }
     $error = "The name must be a string with dots as namespaces";
     throw new InvalidArgumentException($error);
 }
 /** @test */
 function it_add_a_group_in_the_db_respecting_convention(NotifynderGroupDB $groupDB, NotificationGroup $group)
 {
     $name = 'my.category';
     $groupDB->create($name)->shouldBeCalled()->willReturn($group);
     $this->addGroup($name)->shouldReturnAnInstanceOf(NotificationGroup::class);
 }