function it_add_attributes_to_attribute_group($groupSaver, $attributeSaver, AttributeGroupInterface $default, AttributeGroupInterface $group, AttributeInterface $sku, AttributeInterface $name)
 {
     $group->getMaxAttributeSortOrder()->willReturn(5);
     $sku->setSortOrder(6)->shouldBeCalled();
     $group->addAttribute($sku)->shouldBeCalled();
     $name->setSortOrder(7)->shouldBeCalled();
     $group->addAttribute($name)->shouldBeCalled();
     $attributeSaver->saveAll([$sku, $name])->shouldBeCalled();
     $groupSaver->save($group)->shouldBeCalled();
     $this->addAttributes($group, [$sku, $name]);
 }
 function it_add_attributes_to_attribute_group($objectManager, AttributeGroupInterface $default, AttributeGroupInterface $group, AttributeInterface $sku, AttributeInterface $name)
 {
     $group->getMaxAttributeSortOrder()->willReturn(5);
     $sku->setSortOrder(6)->shouldBeCalled();
     $group->addAttribute($sku)->shouldBeCalled();
     $objectManager->persist($sku)->shouldBeCalled();
     $name->setSortOrder(7)->shouldBeCalled();
     $group->addAttribute($name)->shouldBeCalled();
     $objectManager->persist($name)->shouldBeCalled();
     $objectManager->persist($group)->shouldBeCalled();
     $objectManager->flush()->shouldBeCalled();
     $this->addAttributes($group, [$sku, $name]);
 }
 /**
  * Add attributes to a group
  *
  * @param AttributeGroupInterface $group
  * @param AttributeInterface[]    $attributes
  */
 public function addAttributes(AttributeGroupInterface $group, $attributes)
 {
     $maxOrder = $group->getMaxAttributeSortOrder();
     foreach ($attributes as $attribute) {
         $maxOrder++;
         $attribute->setSortOrder($maxOrder);
         $group->addAttribute($attribute);
     }
     $this->attributeSaver->saveAll($attributes);
     $this->groupSaver->save($group);
 }
 /**
  * Add attributes to a group
  *
  * @param AttributeGroupInterface $group
  * @param AttributeInterface[]    $attributes
  */
 public function addAttributes(AttributeGroupInterface $group, $attributes)
 {
     $maxOrder = $group->getMaxAttributeSortOrder();
     foreach ($attributes as $attribute) {
         $maxOrder++;
         $attribute->setSortOrder($maxOrder);
         $group->addAttribute($attribute);
         $this->objectManager->persist($attribute);
     }
     $this->objectManager->persist($group);
     $this->objectManager->flush();
 }