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' => '']]);
 }
 function it_normalizes_a_value_with_ordered_options_with_a_option_collection_data(ProductValueInterface $value, AttributeInterface $multiColorAttribute, SerializerInterface $serializer, AttributeOptionInterface $redOption, AttributeOptionInterface $blueOption, ArrayCollection $collection)
 {
     $collection->toArray()->willReturn([$redOption, $blueOption]);
     $collection->isEmpty()->willReturn(false);
     $value->getData()->willReturn($collection);
     $value->getAttribute()->willReturn($multiColorAttribute);
     $value->getLocale()->willReturn('en_US');
     $multiColorAttribute->getCode()->willReturn('colors');
     $multiColorAttribute->isLocaleSpecific()->willReturn(false);
     $multiColorAttribute->isLocalizable()->willReturn(false);
     $multiColorAttribute->isScopable()->willReturn(false);
     $multiColorAttribute->getBackendType()->willReturn('options');
     $redOption->getSortOrder()->willReturn(10)->shouldBeCalled();
     $blueOption->getSortOrder()->willReturn(11)->shouldBeCalled();
     // phpspec raises this php bug https://bugs.php.net/bug.php?id=50688,
     // warning: usort(): Array was modified by the user comparison function in ProductValueNormalizer.php line 178
     $previousReporting = error_reporting();
     error_reporting(0);
     $serializer->normalize(Argument::type('Doctrine\\Common\\Collections\\ArrayCollection'), 'flat', ['field_name' => 'colors'])->shouldBeCalled()->willReturn(['colors' => 'red, blue']);
     $this->normalize($value, 'flat', [])->shouldReturn(['colors' => 'red, blue']);
     error_reporting($previousReporting);
 }