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); }
/** * @param Product $product * * @Given /^I should be on the (product "([^"]*)") edit page$/ */ public function iShouldBeOnTheProductEditPage(Product $product) { $this->spin(function () use($product) { $expectedAddress = $this->getPage('Product edit')->getUrl(['id' => $product->getId()]); $this->assertAddress($expectedAddress); return true; }); $this->getMainContext()->spin(function () { return $this->getCurrentPage()->find('css', '.product-label'); }); }
/** * @param Product $product * * @Given /^I should be on the (product "([^"]*)") edit page$/ */ public function iShouldBeOnTheProductEditPage(Product $product) { $expectedAddress = $this->getPage('Product edit')->getUrl(array('id' => $product->getId())); $this->assertAddress($expectedAddress); }
/** * {@inheritDoc} */ public function getId() { if ($this->__isInitialized__ === false) { return (int) parent::getId(); } $this->__initializer__ && $this->__initializer__->__invoke($this, 'getId', array()); return parent::getId(); }