/** * Test related method */ public function testNullAttributeLabel() { $attribute = $this->getAttributeMock(); $family = $this->getFamilyMock(null); $value = $this->getValueMock($attribute, 'bar'); $sku = $this->getValueMock($this->getAttributeMock(null, 'pim_catalog_identifier'), 'foo-bar'); $this->product->addValue($sku); $this->product->setFamily($family); $this->product->addValue($value); $this->assertEquals('foo-bar', $this->product->getLabel()); }
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); }
/** * {@inheritDoc} */ public function getLabel($locale = NULL) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getLabel', array($locale)); return parent::getLabel($locale); }