function it_normalizes_attribute_for_versioning($attribute, AttributeOptionInterface $size, AttributeOptionValueInterface $en, AttributeOptionValueInterface $fr)
 {
     $attribute->getLocaleSpecificCodes()->willReturn(['en_US', 'fr_FR']);
     $attribute->isLocalizable()->willReturn(true);
     $attribute->isScopable()->willReturn(true);
     $attribute->getOptions()->willReturn([$size]);
     $size->getCode()->willReturn('size');
     $size->getOptionValues()->willReturn([$en, $fr]);
     $en->getLocale()->willReturn('en_US');
     $en->getValue()->willReturn('big');
     $fr->getLocale()->willReturn('fr_FR');
     $fr->getValue()->willReturn('grand');
     $attribute->getSortOrder()->willReturn(1);
     $attribute->isRequired()->willReturn(false);
     $attribute->getMaxCharacters()->willReturn(null);
     $attribute->getValidationRule()->willReturn(null);
     $attribute->getValidationRegexp()->willReturn(null);
     $attribute->isWysiwygEnabled()->willReturn(false);
     $attribute->getNumberMin()->willReturn(1);
     $attribute->getNumberMax()->willReturn(10);
     $attribute->isDecimalsAllowed()->willReturn(false);
     $attribute->isNegativeAllowed()->willReturn(false);
     $attribute->getDateMin()->willReturn(null);
     $attribute->getDateMax()->willReturn(null);
     $attribute->getMaxFileSize()->willReturn(0);
     $this->normalize($attribute, null, ['versioning' => true])->shouldReturn(['type' => 'Yes/No', 'code' => 'attribute_size', 'group' => 'size', 'unique' => 1, 'useable_as_grid_filter' => 0, 'allowed_extensions' => 'csv,xml,json', 'metric_family' => 'Length', 'default_metric_unit' => 'Centimenter', 'reference_data_name' => 'color', 'available_locales' => ['en_US', 'fr_FR'], 'localizable' => true, 'scope' => 'Channel', 'options' => ['size' => ['en_US' => 'big', 'fr_FR' => 'grand']], 'sort_order' => 1, 'required' => 0, 'max_characters' => '', 'validation_rule' => '', 'validation_regexp' => '', 'wysiwyg_enabled' => '', 'number_min' => '1', 'number_max' => '10', 'decimals_allowed' => '', 'negative_allowed' => '', 'date_min' => '', 'date_max' => '', 'metric_family' => 'Length', 'default_metric_unit' => 'Centimenter', 'max_file_size' => '0']);
 }
 function it_generates_a_query_to_update_product_select_attributes($namingUtility, AttributeOptionValueInterface $bleu, AttributeOptionInterface $blue, AttributeInterface $color)
 {
     $bleu->getOption()->willReturn($blue);
     $bleu->getLocale()->willReturn('fr_FR');
     $blue->getAttribute()->willReturn($color);
     $namingUtility->getAttributeNormFields($color)->willReturn(['normalizedData.color-fr_FR', 'normalizedData.color-en_US']);
     $blue->getCode()->willReturn('blue');
     $this->generateQuery($bleu, 'value', 'Bleu', 'Bleus')->shouldReturn([[['normalizedData.color-fr_FR' => ['$elemMatch' => ['code' => 'blue']]], ['$set' => ['normalizedData.color-fr_FR.$.optionValues.fr_FR.value' => 'Bleus']], ['multiple' => true]], [['normalizedData.color-en_US' => ['$elemMatch' => ['code' => 'blue']]], ['$set' => ['normalizedData.color-en_US.$.optionValues.fr_FR.value' => 'Bleus']], ['multiple' => true]]]);
 }
 function it_normalizes_attribute_option(AttributeOptionInterface $option, AttributeOptionValueInterface $valueUs, AttributeOptionValueInterface $valueFr)
 {
     $option->getId()->willReturn(42);
     $option->getCode()->willReturn('red');
     $valueUs->getLocale()->willReturn('en_US');
     $valueUs->getValue()->willReturn('Red');
     $valueFr->getLocale()->willReturn('fr_FR');
     $valueFr->getValue()->willReturn('Rouge');
     $option->getOptionValues()->willReturn([$valueUs, $valueFr]);
     $this->normalize($option, 'mongodb_json', [])->shouldReturn(['id' => 42, 'code' => 'red', 'optionValues' => ['en_US' => ['value' => 'Red', 'locale' => 'en_US'], 'fr_FR' => ['value' => 'Rouge', 'locale' => 'fr_FR']]]);
 }
 function it_provides_all_locales_if_no_list_provided_in_context(AttributeOptionInterface $option, AttributeInterface $attribute, AttributeOptionValueInterface $valueEn, AttributeOptionValueInterface $valueFr, AttributeOptionValueInterface $valueDe)
 {
     $option->getCode()->willReturn('red');
     $option->getAttribute()->willReturn($attribute);
     $option->getSortOrder()->willReturn(1);
     $attribute->getCode()->willReturn('color');
     $option->getOptionValues()->willReturn(['en_US' => $valueEn, 'fr_FR' => $valueFr, 'de_DE' => $valueDe]);
     $valueEn->getLocale()->willReturn('en_US');
     $valueEn->getValue()->willReturn('Red');
     $valueFr->getLocale()->willReturn('fr_FR');
     $valueFr->getValue()->willReturn('Rouge');
     $valueDe->getLocale()->willReturn('de_DE');
     $valueDe->getValue()->willReturn('');
     $this->normalize($option, null, ['locales' => []])->shouldReturn(['attribute' => 'color', 'code' => 'red', 'sort_order' => 1, 'label' => ['en_US' => 'Red', 'fr_FR' => 'Rouge', 'de_DE' => '']]);
 }