function it_copies_multi_select_value_to_a_product_value($builder, $attrValidatorHelper, AttributeInterface $fromAttribute, AttributeInterface $toAttribute, ProductInterface $product1, ProductInterface $product2, ProductInterface $product3, ProductInterface $product4, ProductValue $fromProductValue, ProductValue $toProductValue, AttributeOptionInterface $attributeOption)
 {
     $fromLocale = 'fr_FR';
     $toLocale = 'fr_FR';
     $toScope = 'mobile';
     $fromScope = 'mobile';
     $fromAttribute->getCode()->willReturn('fromAttributeCode');
     $toAttribute->getCode()->willReturn('toAttributeCode');
     $attrValidatorHelper->validateLocale(Argument::cetera())->shouldBeCalled();
     $attrValidatorHelper->validateScope(Argument::cetera())->shouldBeCalled();
     $fromProductValue->getOptions()->willReturn([$attributeOption])->shouldBeCalled(3);
     $toProductValue->getOptions()->willReturn([$attributeOption]);
     $toProductValue->removeOption($attributeOption)->shouldBeCalled();
     $toProductValue->addOption($attributeOption)->shouldBeCalled();
     $product1->getValue('fromAttributeCode', $fromLocale, $fromScope)->willReturn($fromProductValue);
     $product1->getValue('toAttributeCode', $toLocale, $toScope)->willReturn($toProductValue);
     $product2->getValue('fromAttributeCode', $fromLocale, $fromScope)->willReturn(null);
     $product2->getValue('toAttributeCode', $toLocale, $toScope)->willReturn($toProductValue);
     $product3->getValue('fromAttributeCode', $fromLocale, $fromScope)->willReturn($fromProductValue);
     $product3->getValue('toAttributeCode', $toLocale, $toScope)->willReturn(null);
     $product4->getValue('fromAttributeCode', $fromLocale, $fromScope)->willReturn($fromProductValue);
     $product4->getValue('toAttributeCode', $toLocale, $toScope)->willReturn($toProductValue);
     $builder->addProductValue($product3, $toAttribute, $toLocale, $toScope)->shouldBeCalledTimes(1)->willReturn($toProductValue);
     $products = [$product1, $product2, $product3, $product4];
     foreach ($products as $product) {
         $this->copyAttributeData($product, $product, $fromAttribute, $toAttribute, ['from_locale' => $fromLocale, 'to_locale' => $toLocale, 'from_scope' => $fromScope, 'to_scope' => $toScope]);
     }
 }
 /**
  * @param array        $drupalProduct
  * @param ProductValue $productValue
  * @param string       $field
  * @param array        $context
  */
 public function normalize(array &$drupalProduct, $productValue, $field, array $context = array())
 {
     $options = $productValue->getOptions();
     /** @var \Pim\Bundle\CatalogBundle\Entity\Option $subValue */
     foreach ($options->getValues() as $subValue) {
         $drupalProduct['values'][$field][$context['locale']][] = ['type' => 'pim_catalog_simpleselect', 'code' => $subValue->getCode()];
     }
 }
 /**
  * @param array        $drupalProduct
  * @param ProductValue $productValue
  * @param string       $field
  * @param array        $context
  */
 public function normalize(array &$drupalProduct, $productValue, $field, array $context = array())
 {
     $options = $productValue->getOptions();
     if (is_array($options) && count($options) > 0) {
         /** @var \Pim\Bundle\CatalogBundle\Entity\AttributeOption $subValue */
         foreach ($options->getValues() as $subValue) {
             $drupalProduct['values'][$field][$context['locale']][] = ['type' => 'pim_catalog_simpleselect', 'code' => $subValue->getCode()];
         }
     } else {
         $option = $productValue->getOption();
         if (is_object($option)) {
             $drupalProduct['values'][$field][$context['locale']][] = ['type' => 'pim_catalog_simpleselect', 'code' => $option->getCode()];
         }
     }
 }
 /**
  * {@inheritDoc}
  */
 public function getOptions()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getOptions', array());
     return parent::getOptions();
 }