function it_marks_a_variant_group_as_updated_when_its_attributes_are_removed_or_updated($registry, EntityManager $em, ProductTemplateInterface $productTemplate, GroupInterface $group, GroupRepositoryInterface $groupRepo) { $productTemplate->getId()->willReturn(956); $registry->getRepository(Argument::type('string'))->willReturn($groupRepo); $groupRepo->getVariantGroupByProductTemplate($productTemplate)->willReturn($group); $this->guessUpdates($em, $productTemplate, UpdateGuesserInterface::ACTION_UPDATE_ENTITY)->shouldReturn([$group]); }
/** * {@inheritdoc} */ public function getVariantGroupByProductTemplate(ProductTemplateInterface $productTemplate) { $qb = $this->createQueryBuilder('g'); $qb->innerJoin('g.productTemplate', 'pt')->where($qb->expr()->eq('pt', ':productTemplate'))->setParameter(':productTemplate', $productTemplate->getId()); return $qb->getQuery()->getOneOrNullResult(); }