function let(ManagerRegistry $registry, ProductRepositoryInterface $repository, EntityManager $em, AttributeInterface $attribute, AttributeOptionInterface $option, AttributeOptionValueInterface $optionValue) { $registry->getRepository('product')->willReturn($repository); $repository->findAllWithAttributeOption($option)->willReturn([]); $option->getAttribute()->willReturn($attribute); $optionValue->getOption()->willReturn($option); }
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.code' => 'blue'], ['$set' => ['normalizedData.color-fr_FR.optionValues.fr_FR.value' => 'bleus']], ['multiple' => true]], [['normalizedData.color-en_US.code' => 'blue'], ['$set' => ['normalizedData.color-en_US.optionValues.fr_FR.value' => 'bleus']], ['multiple' => true]]]); }