Пример #1
0
 /**
  * @Then I should see the thank you page
  */
 public function iShouldSeeTheThankYouPage()
 {
     $user = $this->sharedStorage->getCurrentResource('user');
     $customer = $user->getCustomer();
     $thankYouPage = $this->getPage('Checkout\\CheckoutThankYouPage');
     $thankYouPage->assertRoute();
     $this->assertSession()->elementTextContains('css', '#thanks', sprintf('Thank you %s', $customer->getFullName()));
 }
Пример #2
0
 /**
  * @Given default currency is :currencyCode
  */
 public function defaultCurrencyIs($currencyCode)
 {
     $currency = $this->currencyFactory->createNew();
     $currency->setCode($currencyCode);
     $currency->setExchangeRate(1.0);
     $channel = $this->sharedStorage->getCurrentResource('channel');
     $channel->setDefaultCurrency($currency);
     $this->currencyRepository->add($currency);
 }
Пример #3
0
 /**
  * @Given catalog has a product :productName priced at $:price
  */
 public function catalogHasAProductPricedAt($productName, $price)
 {
     $product = $this->productFactory->createNew();
     $product->setName($productName);
     $product->setPrice((int) $price);
     $product->setDescription('Awesome star wars mug');
     $channel = $this->sharedStorage->getCurrentResource('channel');
     $product->addChannel($channel);
     $this->productRepository->add($product);
 }
Пример #4
0
 /**
  * @Given store allows paying offline
  */
 public function storeAllowsPayingOffline()
 {
     $paymentMethod = $this->paymentMethodFactory->createNew();
     $paymentMethod->setCode('PM1');
     $paymentMethod->setGateway('dummy');
     $paymentMethod->setName('Offline');
     $paymentMethod->setDescription('Offline payment method');
     $channel = $this->sharedStorage->getCurrentResource('channel');
     $channel->addPaymentMethod($paymentMethod);
     $this->paymentMethodRepository->add($paymentMethod);
 }
Пример #5
0
 /**
  * @Given store has free shipping method
  */
 public function storeHasFreeShippingMethod()
 {
     $zone = $this->sharedStorage->getCurrentResource('zone');
     $shippingMethod = $this->shippingMethodFactory->createNew();
     $shippingMethod->setCode('SM1');
     $shippingMethod->setName('Free');
     $shippingMethod->setCurrentLocale('FR');
     $shippingMethod->setConfiguration(array('amount' => 0));
     $shippingMethod->setCalculator(DefaultCalculators::PER_ITEM_RATE);
     $shippingMethod->setZone($zone);
     $this->shippingMethodRepository->add($shippingMethod);
 }
Пример #6
0
 /**
  * @param string $name
  * @param string $locale
  * @param array $configuration
  * @param string $calculator
  * @param ZoneInterface|null $zone
  */
 private function createShippingMethod($name, $locale = 'en', $configuration = ['amount' => 0], $calculator = DefaultCalculators::FLAT_RATE, $zone = null)
 {
     if (null === $zone) {
         $zone = $this->sharedStorage->getCurrentResource('zone');
     }
     $shippingMethod = $this->shippingMethodFactory->createNew();
     $shippingMethod->setCode($this->getCodeFromName($name));
     $shippingMethod->setName($name);
     $shippingMethod->setCurrentLocale($locale);
     $shippingMethod->setConfiguration($configuration);
     $shippingMethod->setCalculator($calculator);
     $shippingMethod->setZone($zone);
     $this->shippingMethodRepository->add($shippingMethod);
 }
Пример #7
0
 /**
  * @Then I should see the thank you page
  */
 public function iShouldSeeTheThankYouPage()
 {
     /** @var UserInterface $user */
     $user = $this->sharedStorage->getCurrentResource('user');
     $customer = $user->getCustomer();
     expect($this->checkoutThankYouPage->hasThankYouMessageFor($customer->getFullName()))->toBe(true);
 }
Пример #8
0
 /**
  * @Given /^it comes in the following variations:$/
  */
 public function itComesInTheFollowingVariations(TableNode $table)
 {
     $currentProduct = $this->sharedStorage->getCurrentResource('product');
     foreach ($table->getHash() as $variantHash) {
         $variant = $this->productVariantFactory->createNew();
         $variant->setPresentation($variantHash['name']);
         $variant->setPrice($this->getPriceFromString(str_replace(['$', '€', '£'], '', $variantHash['price'])));
         $variant->setProduct($currentProduct);
         $this->productRepository->add($variant);
     }
     $this->objectManager->flush();
 }
Пример #9
0
 /**
  * @Transform /(?:this|that|the) channel/
  */
 public function getLatestChannel()
 {
     return $this->sharedStorage->getCurrentResource('channel');
 }