function it_provide_product_completeness_if_a_family_is_defined($familyRepository, $productValueCompleteChecker, QueryBuilder $qb, AbstractQuery $query, AttributeRequirementInterface $requirement, ProductInterface $product, ChannelInterface $mobile, LocaleInterface $en, FamilyInterface $shirt, CompletenessInterface $completeness, ProductValueInterface $nameValue, AttributeInterface $name)
 {
     $product->getFamily()->willReturn($shirt);
     $product->getCompletenesses()->willReturn([$completeness]);
     $en->getCode()->willReturn('en_US');
     $mobile->getCode()->willReturn('mobile');
     $completeness->getLocale()->willReturn($en);
     $completeness->getChannel()->willReturn($mobile);
     $completeness->getMissingCount()->willReturn(1);
     $familyRepository->getFullRequirementsQB($shirt, 'en_US')->willReturn($qb);
     $qb->getQuery()->willReturn($query);
     $query->getResult()->willReturn([$requirement]);
     $requirement->getChannel()->willReturn($mobile);
     $requirement->getAttribute()->willReturn($name);
     $requirement->isRequired()->willReturn(true);
     $name->getCode()->willReturn('name');
     $name->isLocalizable()->willreturn(true);
     $name->isScopable()->willReturn(false);
     $name->isLocaleSpecific()->willReturn(true);
     $name->hasLocaleSpecific($en)->willReturn(false);
     $product->getValues()->willReturn(new ArrayCollection());
     $productValueCompleteChecker->supportsValue($nameValue);
     $productValueCompleteChecker->isComplete($nameValue, $mobile, $en);
     $this->getProductCompleteness($product, [$mobile], [$en], 'en_US')->shouldReturn([['channels' => [['completeness' => $completeness, 'missing' => []]], 'stats' => ['total' => 1, 'complete' => 0], 'locale' => 'en_US']]);
 }
 function it_normalize_completness(CompletenessInterface $completeness, LocaleInterface $en, ChannelInterface $mobile)
 {
     $completeness->getRequiredCount()->willReturn(10);
     $completeness->getMissingCount()->willReturn(2);
     $completeness->getRatio()->willReturn(20);
     $completeness->getLocale()->willReturn($en);
     $completeness->getChannel()->willReturn($mobile);
     $en->getCode()->willReturn('en_US');
     $mobile->getCode()->willReturn('mobile');
     $this->normalize($completeness, 'internal_api', [])->shouldReturn(['required' => 10, 'missing' => 2, 'ratio' => 20, 'locale' => 'en_US', 'channel' => 'mobile']);
 }
 function it_normalizes_completenesses_and_indexes_them($normalizer, AttributeInterface $attribute, AttributeTranslation $attributeTranslationFr, AttributeTranslation $attributeTranslationEn, CompletenessInterface $completeness, ChannelInterface $channel)
 {
     $normalizer->normalize(Argument::any(), 'internal_api', ['a_context_key' => 'context_value'])->willReturn(['missing' => [], 'completeness' => 'normalized_completeness']);
     $completeness->getChannel()->willReturn($channel);
     $channel->getCode()->willReturn('mobile', 'print', 'tablet', 'mobile', 'print', 'tablet');
     $attribute->getCode()->willReturn('name');
     $attribute->getTranslation('en_US')->willReturn($attributeTranslationEn);
     $attribute->getTranslation('fr_FR')->willReturn($attributeTranslationFr);
     $attributeTranslationEn->getLabel()->willReturn('labelEn');
     $attributeTranslationFr->getLabel()->willReturn('labelFr');
     $this->normalize(['en_US' => ['locale' => 'en_US', 'stats' => [], 'channels' => ['mobile' => ['missing' => [$attribute], 'completeness' => $completeness], 'print' => ['missing' => [$attribute], 'completeness' => $completeness], 'tablet' => ['missing' => [$attribute], 'completeness' => $completeness]]], 'fr_FR' => ['locale' => 'fr_FR', 'stats' => [], 'channels' => ['mobile' => ['missing' => [$attribute], 'completeness' => $completeness], 'print' => ['missing' => [$attribute], 'completeness' => $completeness], 'tablet' => ['missing' => [$attribute], 'completeness' => $completeness]]]], 'internal_api', ['a_context_key' => 'context_value'])->shouldReturn([['locale' => 'en_US', 'stats' => [], 'channels' => ['mobile' => ['missing' => [['code' => 'name', 'labels' => ['en_US' => 'labelEn', 'fr_FR' => 'labelFr']]], 'completeness' => 'normalized_completeness'], 'print' => ['missing' => [['code' => 'name', 'labels' => ['en_US' => 'labelEn', 'fr_FR' => 'labelFr']]], 'completeness' => 'normalized_completeness'], 'tablet' => ['missing' => [['code' => 'name', 'labels' => ['en_US' => 'labelEn', 'fr_FR' => 'labelFr']]], 'completeness' => 'normalized_completeness']]], ['locale' => 'fr_FR', 'stats' => [], 'channels' => ['mobile' => ['missing' => [['code' => 'name', 'labels' => ['en_US' => 'labelEn', 'fr_FR' => 'labelFr']]], 'completeness' => 'normalized_completeness'], 'print' => ['missing' => [['code' => 'name', 'labels' => ['en_US' => 'labelEn', 'fr_FR' => 'labelFr']]], 'completeness' => 'normalized_completeness'], 'tablet' => ['missing' => [['code' => 'name', 'labels' => ['en_US' => 'labelEn', 'fr_FR' => 'labelFr']]], 'completeness' => 'normalized_completeness']]]]);
 }