Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function getOnHoldQuantityFor(ProductVariantInterface $productVariant)
 {
     try {
         return (int) $this->getElement('on_hold_quantity', ['%id%' => $productVariant->getId()])->getText();
     } catch (ElementNotFoundException $exception) {
         return 0;
     }
 }
 /**
  * @When /^I delete the ("[^"]+" variant of product "[^"]+")$/
  * @When /^I try to delete the ("[^"]+" variant of product "[^"]+")$/
  */
 public function iDeleteTheVariantOfProduct(ProductVariantInterface $productVariant)
 {
     try {
         $this->sharedStorage->set('product_variant_id', $productVariant->getId());
         $this->productVariantRepository->remove($productVariant);
     } catch (DBALException $exception) {
         $this->sharedStorage->set('last_exception', $exception);
     }
 }
Beispiel #3
0
 /**
  * @When /^I delete the ("[^"]+" variant of product "[^"]+")$/
  */
 public function iDeleteTheVariantOfProduct(ProductVariantInterface $productVariant)
 {
     $this->sharedStorage->set('product_variant_id', $productVariant->getId());
     $this->productVariantRepository->remove($productVariant);
 }
 /**
  * @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);
 }
 function it_throws_an_exception_if_a_product_variant_does_not_exist(ProductVariantRepositoryInterface $productVariantRepository, ProductVariantInterface $productVariant)
 {
     $productVariant->getId()->willReturn(1);
     $productVariantRepository->find(1)->willReturn(null);
     $this->shouldThrow(FailureException::class)->during('productVariantShouldExistInTheProductCatalog', [$productVariant]);
 }