/** * Test getter/setter for family property */ public function testGetSetFamily() { $this->assertEmpty($this->product->getFamily()); // Change value and assert new $newFamily = new Family(); $this->product->setFamily($newFamily); $this->assertEquals($newFamily, $this->product->getFamily()); $this->product->setFamily(null); $this->assertNull($this->product->getFamily()); }
function it_throws_an_exception_if_something_went_wrong_during_normalization($webservice, $attributeMappingMerger, $categoryMappingMerger, $productNormalizer, $mappingCollection, Product $product, Channel $channel, Family $family, MetricConverter $metricConverter, AbstractAttribute $skuAttribute, ProductValue $sku) { $categoryMappingMerger->getMapping()->willReturn($mappingCollection); $attributeMappingMerger->getMapping()->willReturn($mappingCollection); $product->getFamily()->shouldBeCalled()->willReturn($family); $family->getCode()->shouldBeCalled()->willReturn('family_code'); $webservice->getAttributeSetId('family_code')->shouldBeCalled()->willReturn('4'); $product->getIdentifier()->shouldBeCalled()->willReturn($sku); $sku->getData()->willReturn('sku-000'); $sku->getAttribute()->willReturn($skuAttribute); $skuAttribute->getCode()->willReturn('SKU'); $product->getId()->willReturn(12); $product->getLabel()->willReturn('my product'); $metricConverter->convert($product, $channel)->shouldBeCalled(); $productNormalizer->normalize(Argument::type('\\Pim\\Bundle\\CatalogBundle\\Model\\Product'), 'MagentoArray', Argument::type('array'))->shouldBeCalled()->willThrow('\\Pim\\Bundle\\MagentoConnectorBundle\\Normalizer\\Exception\\NormalizeException'); $this->shouldThrow('\\Akeneo\\Bundle\\BatchBundle\\Item\\InvalidItemException')->duringProcess($product); }
function it_throws_an_exception_if_a_soap_call_error_occured_during_normalization($groupRepository, $webservice, $group, $configurableNormalizer, Product $product, Family $family) { $groupRepository->getVariantGroupIds()->willReturn([0, 1]); $product->getGroups()->willReturn([$group]); $product->getFamily()->shouldBeCalled()->willReturn($family); $group->getCode()->willReturn('abcd'); $family->getCode()->willReturn('family_code'); $configurable = ['group' => $group, 'products' => [$product]]; $webservice->getConfigurablesStatus(['1' => $configurable])->shouldBeCalled()->willReturn([['sku' => 'conf-adcb']]); $webservice->getAttributeSetId('family_code')->shouldBeCalled()->willReturn('attrSet_code'); $configurableNormalizer->normalize($configurable, 'MagentoArray', Argument::any())->willThrow('Pim\\Bundle\\MagentoConnectorBundle\\Webservice\\SoapCallException'); $this->shouldThrow('\\Akeneo\\Bundle\\BatchBundle\\Item\\InvalidItemException')->duringProcess([$product]); }
/** * {@inheritDoc} */ public function getFamily() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getFamily', array()); return parent::getFamily(); }