function it_generates_correct_hierarchy_when_product_variant_does_not_have_archetype(ProductVariantInterface $productVariant, ProductInterface $product) { $productVariant->getMetadataIdentifier()->shouldBeCalled()->willReturn('ProductVariant-42'); $product->getMetadataIdentifier()->shouldBeCalled()->willReturn('Product-42'); $product->getMetadataClassIdentifier()->shouldBeCalled()->willReturn('Product'); $productVariant->getProduct()->shouldBeCalled()->willReturn($product); $product->getArchetype()->shouldBeCalled()->willReturn(null); $this->getHierarchyByMetadataSubject($productVariant)->shouldReturn(['ProductVariant-42', 'Product-42', 'Product', 'DefaultPage']); }
/** * @When /^I want to modify the ("[^"]+" product variant)$/ * @When /^I want to modify (this product variant)$/ */ public function iWantToModifyAProduct(ProductVariantInterface $productVariant) { $this->updatePage->open(['id' => $productVariant->getId(), 'productId' => $productVariant->getProduct()->getId()]); }
/** * @Then /^(variant with code "[^"]+") for ("[^"]+" currency) and ("[^"]+" channel) should be priced at "(?:€|£|\$)([^"]+)"$/ */ public function theProductForCurrencyAndChannelShouldBePricedAt(ProductVariantInterface $productVariant, CurrencyInterface $currency, ChannelInterface $channel, $price) { $this->updatePage->open(['id' => $productVariant->getId(), 'productId' => $productVariant->getProduct()->getId()]); Assert::same($this->updatePage->getPricingConfigurationForChannelAndCurrencyCalculator($channel, $currency), $price); }
/** * {@inheritdoc} */ public function getProduct() { return $this->variant->getProduct(); }
/** * @Then /^(this variant) should still exist in the product catalog$/ */ public function productShouldExistInTheProductCatalog(ProductVariantInterface $productVariant) { $this->theProductVariantShouldAppearInTheShop($productVariant->getCode(), $productVariant->getProduct()); }