function it_updates_a_product_template_if_attribute_has_been_deleted($eventDispatcher, $objectManager, $optionsResolver, AttributeInterface $attribute, ProductTemplateBuilderInterface $productTemplateBuilder, ProductTemplateRepositoryInterface $productTemplateRepository, ProductTemplate $productTemplate) { $optionsResolver->resolveRemoveOptions([])->willReturn(['flush' => true]); $objectManager->remove($attribute)->shouldBeCalled(); $objectManager->flush()->shouldBeCalled(); $attribute->getCode()->willReturn('test'); $productTemplate->getValuesData()->willReturn(['test', 'test2']); $productTemplateRepository->findAll()->willReturn([$productTemplate]); $productTemplate->hasValueForAttribute($attribute)->willReturn(true); $productTemplateBuilder->removeAttribute($productTemplate, $attribute)->shouldBeCalled(); $productTemplate->getAttributeCodes()->willReturn(['test2']); $objectManager->persist($productTemplate)->shouldBeCalled(); $objectManager->flush()->shouldBeCalled(); $this->remove($attribute); }
/** * {@inheritDoc} */ public function getAttributeCodes() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getAttributeCodes', array()); return parent::getAttributeCodes(); }