function it_updates_a_group_type(GroupTypeInterface $groupType) { $values = ['code' => 'variant', 'is_variant' => true, 'label' => ['en_US' => 'variant', 'fr_FR' => 'variantes']]; $groupType->setCode('variant')->shouldBeCalled(); $groupType->setVariant(true)->shouldBeCalled(); $groupType->setLocale('en_US')->shouldBeCalled(); $groupType->setLocale('fr_FR')->shouldBeCalled(); $groupType->setLabel('variant')->shouldBeCalled(); $groupType->setLabel('variantes')->shouldBeCalled(); $this->update($groupType, $values, []); }
/** * @param GroupTypeInterface $groupType * @param string $field * @param mixed $data */ protected function setData(GroupTypeInterface $groupType, $field, $data) { if ('code' == $field) { $groupType->setCode($data); } elseif ('is_variant' == $field) { $groupType->setVariant($data); } elseif ('label' == $field) { foreach ($data as $locale => $label) { $groupType->setLocale($locale); $groupType->setLabel($label); } } }