public function addCategoryToGroupById($groupId, $categoryId) { $group = $this->notificationGroup->find($groupId); $group->categories()->attach($categoryId); return $group; }
/** @test */ function it_add_a_category_to_a_group_id() { $category = $this->createCategory(); $group = $this->createGroup(); $this->categoryGroup->addCategoryToGroupById($group->id, $category->id); $this->assertEquals($group->categories[0]->name, $category->name); }