コード例 #1
0
 function it_denormalizes_an_existing_group_with_properties($groupRepository, Group $group, GroupType $type, AttributeInterface $size, AttributeInterface $color, GroupTranslation $translationUS)
 {
     $groupRepository->findOneByIdentifier('tshirt')->willReturn(null);
     $group->getId()->willReturn(42);
     $group->setCode('tshirt')->shouldBeCalled();
     $group->setType(Argument::any())->shouldNotBeCalled();
     $group->setAttributes(Argument::any())->shouldNotBeCalled();
     $group->getTranslation('en_US')->willReturn($translationUS);
     $translationUS->setLabel('My T-shirt')->shouldBeCalled();
     $group->addTranslation($translationUS)->shouldBeCalled();
     $this->denormalize(['code' => 'tshirt', 'label-en_US' => 'My T-shirt'], self::ENTITY_CLASS, self::FORMAT_CSV, ['entity' => $group])->shouldReturn($group);
 }
 /**
  * {@inheritDoc}
  */
 public function setAttributes(array $attributes = array())
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setAttributes', array($attributes));
     return parent::setAttributes($attributes);
 }