function let(SerializerInterface $serializer, AttributeInterface $simpleAttribute) { $serializer->implement('Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface'); $this->setSerializer($serializer); $simpleAttribute->isLocalizable()->willReturn(false); $simpleAttribute->isScopable()->willReturn(false); $simpleAttribute->getCode()->willReturn('simple'); }
function let(SerializerInterface $serializer, AttributeInterface $simpleAttribute, LocalizerRegistryInterface $localizerRegistry) { $this->beConstructedWith($localizerRegistry, 4); $serializer->implement('Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface'); $this->setSerializer($serializer); $simpleAttribute->isLocalizable()->willReturn(false); $simpleAttribute->isScopable()->willReturn(false); $simpleAttribute->getCode()->willReturn('simple'); }
function it_normalizes_product(SerializerInterface $serializer, ProductInterface $product, FamilyInterface $family, Completeness $completeness) { $serializer->implement('Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface'); $this->setSerializer($serializer); $product->getFamily()->willReturn($family); $product->getGroups()->willReturn([]); $product->getValues()->willReturn([]); $product->getCompletenesses()->willReturn([$completeness]); $product->getCreated()->willReturn(null); $product->getUpdated()->willReturn(null); $product->isEnabled()->willReturn(true); $serializer->normalize($family, 'mongodb_json', [])->willReturn('family normalization'); $serializer->normalize($completeness, 'mongodb_json', [])->willReturn(['completenessCode' => 'completeness normalization']); $this->normalize($product, 'mongodb_json', [])->shouldReturn([ProductNormalizer::FAMILY_FIELD => 'family normalization', ProductNormalizer::COMPLETENESSES_FIELD => array('completenessCode' => 'completeness normalization'), ProductNormalizer::ENABLED_FIELD => true]); }
function it_normalizes_value_with_collection_data(SerializerInterface $serializer, ProductValueInterface $value, AbstractAttribute $attribute) { $serializer->implement('Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface'); $this->setSerializer($serializer); $attribute->getCode()->willReturn('code'); $attribute->isLocalizable()->willReturn(false); $attribute->isScopable()->willReturn(false); $price = new ProductPrice(); $price->setData(42); $price->setCurrency('EUR'); $collection = new ArrayCollection([$price]); $value->getData()->willReturn($collection); $value->getAttribute()->willReturn($attribute); $serializer->normalize($price, 'mongodb_json', [])->willReturn(['data' => 42, 'currency' => 'EUR']); $this->normalize($value, 'mongodb_json', [])->shouldReturn(['code' => ['EUR' => ['data' => 42, 'currency' => 'EUR']]]); }
function let(SerializerInterface $serializer, CollectionFilterInterface $filter) { $serializer->implement('Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface'); $this->beConstructedWith($filter); $this->setSerializer($serializer); }
function let(SerializerInterface $serializer) { $serializer->implement('Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface'); $this->setSerializer($serializer); }
function let(SerializerInterface $serializer) { $this->beConstructedWith(['pim_catalog_multiselect']); $serializer->implement('Symfony\\Component\\Serializer\\Normalizer\\DenormalizerInterface'); $this->setSerializer($serializer); }
function let(MongoObjectsFactory $mongoFactory, SerializerInterface $serializer) { $this->beConstructedWith($mongoFactory); $serializer->implement('Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface'); $this->setSerializer($serializer); }
function let(SerializerInterface $serializer) { $this->beConstructedWith('Pim\\Bundle\\CatalogBundle\\Model\\ProductValue'); $serializer->implement('Symfony\\Component\\Serializer\\Normalizer\\DenormalizerInterface'); $this->setSerializer($serializer); }
function let(SerializerInterface $serializer, NormalizerFilterInterface $filter) { $serializer->implement('Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface'); $this->setSerializer($serializer); $this->setFilters(array($filter)); }
function let(SerializerInterface $serializer, TranslatorInterface $translator) { $this->beConstructedWith($translator); $serializer->implement('Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface'); $this->setSerializer($serializer); }