当前位置: 首页>>代码示例>>PHP>>正文


PHP SharedStorageInterface::get方法代码示例

本文整理汇总了PHP中Sylius\Behat\Service\SharedStorageInterface::get方法的典型用法代码示例。如果您正苦于以下问题:PHP SharedStorageInterface::get方法的具体用法?PHP SharedStorageInterface::get怎么用?PHP SharedStorageInterface::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sylius\Behat\Service\SharedStorageInterface的用法示例。


在下文中一共展示了SharedStorageInterface::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: anEmailWithShipmentDetailsOfOrderShouldBeSentTo

 /**
  * @Then /^an email with shipment's details of (this order) should be sent to "([^"]+)"$/
  */
 public function anEmailWithShipmentDetailsOfOrderShouldBeSentTo(OrderInterface $order, $recipient)
 {
     $this->assertEmailContainsMessageTo($order->getNumber(), $recipient);
     $this->assertEmailContainsMessageTo($order->getLastShipment()->getMethod()->getName(), $recipient);
     $tracking = $this->sharedStorage->get('tracking_code');
     $this->assertEmailContainsMessageTo($tracking, $recipient);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:EmailContext.php

示例2: defaultTaxZoneIs

 /**
  * @Given default tax zone is :zone
  */
 public function defaultTaxZoneIs(ZoneInterface $zone)
 {
     /** @var ChannelInterface $channel */
     $channel = $this->sharedStorage->get('channel');
     $channel->setDefaultTaxZone($zone);
     $this->objectManager->flush();
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:ZoneContext.php

示例3: storeAllowsPaying

 /**
  * @Given the store allows paying :paymentMethodName
  * @Given the store allows paying with :paymentMethodName
  */
 public function storeAllowsPaying($paymentMethodName)
 {
     $paymentMethod = $this->paymentMethodFactory->createNew();
     $paymentMethod->setCode('PM_' . $paymentMethodName);
     $paymentMethod->setName(ucfirst($paymentMethodName));
     $paymentMethod->setGateway($this->paymentMethodNameToGatewayConverter->convert($paymentMethodName));
     $paymentMethod->setDescription('Payment method');
     $channel = $this->sharedStorage->get('channel');
     $channel->addPaymentMethod($paymentMethod);
     $this->sharedStorage->set('payment_method', $paymentMethod);
     $this->paymentMethodRepository->add($paymentMethod);
 }
开发者ID:TeamNovatek,项目名称:Sylius,代码行数:16,代码来源:PaymentContext.php

示例4: createShippingMethod

 /**
  * @param string $name
  * @param string|null $code
  * @param int|null $position
  * @param ZoneInterface|null $zone
  * @param string $locale
  * @param array $configuration
  * @param string $calculator
  * @param bool $enabled
  * @param bool $addForCurrentChannel
  */
 private function createShippingMethod($name, $code = null, $position = null, ZoneInterface $zone = null, $locale = 'en', $configuration = ['amount' => 0], $calculator = DefaultCalculators::FLAT_RATE, $enabled = true, $addForCurrentChannel = true)
 {
     if (null === $zone) {
         $zone = $this->sharedStorage->get('zone');
     }
     if (null === $code) {
         $code = $this->generateCodeFromNameAndZone($name, $zone->getCode());
     }
     /** @var ShippingMethodInterface $shippingMethod */
     $shippingMethod = $this->shippingMethodFactory->createNew();
     $shippingMethod->setCode($code);
     $shippingMethod->setName($name);
     $shippingMethod->setPosition($position);
     $shippingMethod->setCurrentLocale($locale);
     $shippingMethod->setConfiguration($configuration);
     $shippingMethod->setCalculator($calculator);
     $shippingMethod->setZone($zone);
     $shippingMethod->setEnabled($enabled);
     if ($addForCurrentChannel && $this->sharedStorage->has('channel')) {
         $channel = $this->sharedStorage->get('channel');
         $channel->addShippingMethod($shippingMethod);
     }
     $this->shippingMethodRepository->add($shippingMethod);
     $this->sharedStorage->set('shipping_method', $shippingMethod);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:36,代码来源:ShippingContext.php

示例5: assertValidationMessage

 /**
  * @param string $element
  * @param string $message
  */
 private function assertValidationMessage($element, $message)
 {
     $product = $this->sharedStorage->has('product') ? $this->sharedStorage->get('product') : null;
     /** @var CreatePageInterface|UpdatePageInterface $currentPage */
     $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createSimpleProductPage, $this->createConfigurableProductPage, $this->updateSimpleProductPage, $this->updateConfigurableProductPage], $product);
     Assert::same($currentPage->getValidationMessage($element), $message);
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:11,代码来源:ManagingProductsContext.php

示例6: createShippingMethod

 /**
  * @param string $name
  * @param string|null $code
  * @param int|null $position
  * @param ZoneInterface|null $zone
  * @param string $locale
  * @param array $configuration
  * @param string $calculator
  * @param bool $enabled
  * @param bool $addForCurrentChannel
  * @param array $channels
  *
  * @return ShippingMethodInterface
  */
 private function createShippingMethod($name, $code = null, $position = null, ZoneInterface $zone = null, $locale = 'en', array $configuration = [], $calculator = DefaultCalculators::FLAT_RATE, $enabled = true, $addForCurrentChannel = true, array $channels = [])
 {
     $channel = $this->sharedStorage->get('channel');
     if (null === $zone) {
         $zone = $this->sharedStorage->get('zone');
     }
     if (null === $code) {
         $code = $this->generateCodeFromNameAndZone($name, $zone->getCode());
     }
     if (empty($configuration)) {
         $configuration = $this->getConfigurationByChannels([$channel]);
     }
     /** @var ShippingMethodInterface $shippingMethod */
     $shippingMethod = $this->shippingMethodFactory->createNew();
     $shippingMethod->setCode($code);
     $shippingMethod->setName($name);
     $shippingMethod->setPosition($position);
     $shippingMethod->setCurrentLocale($locale);
     $shippingMethod->setConfiguration($configuration);
     $shippingMethod->setCalculator($calculator);
     $shippingMethod->setZone($zone);
     $shippingMethod->setEnabled($enabled);
     if ($addForCurrentChannel && $channel) {
         $shippingMethod->addChannel($channel);
     }
     if (!$addForCurrentChannel) {
         foreach ($channels as $channel) {
             $shippingMethod->addChannel($channel);
         }
     }
     $this->shippingMethodRepository->add($shippingMethod);
     $this->sharedStorage->set('shipping_method', $shippingMethod);
     return $shippingMethod;
 }
开发者ID:Niiko,项目名称:Sylius,代码行数:48,代码来源:ShippingContext.php

示例7: thisProductIsAvailableInSize

 /**
  * @Given /^(this product) is available in "([^"]+)" size priced at ("[^"]+")$/
  */
 public function thisProductIsAvailableInSize(ProductInterface $product, $optionValueName, $price)
 {
     /** @var ProductVariantInterface $variant */
     $variant = $this->productVariantFactory->createNew();
     $optionValue = $this->sharedStorage->get(sprintf('%s_option_value', $optionValueName));
     $variant->addOption($optionValue);
     $variant->setPrice($price);
     $variant->setCode(sprintf("%s_%s", $product->getCode(), $optionValueName));
     $product->addVariant($variant);
     $this->objectManager->flush();
 }
开发者ID:origammi,项目名称:Sylius,代码行数:14,代码来源:ProductContext.php

示例8: thereIsPromotionWithCoupon

 /**
  * @Given the store has promotion :promotionName with coupon :couponCode
  * @Given the store has also promotion :promotionName with coupon :couponCode
  */
 public function thereIsPromotionWithCoupon($promotionName, $couponCode)
 {
     /** @var CouponInterface $coupon */
     $coupon = $this->couponFactory->createNew();
     $coupon->setCode($couponCode);
     $promotion = $this->testPromotionFactory->createForChannel($promotionName, $this->sharedStorage->get('channel'));
     $promotion->addCoupon($coupon);
     $promotion->setCouponBased(true);
     $this->promotionRepository->add($promotion);
     $this->sharedStorage->set('promotion', $promotion);
     $this->sharedStorage->set('coupon', $coupon);
 }
开发者ID:TeamNovatek,项目名称:Sylius,代码行数:16,代码来源:PromotionContext.php

示例9: createOrder

 /**
  * @param CustomerInterface $customer
  * @param string $number
  * @param ChannelInterface|null $channel
  * @param string|null $currencyCode
  *
  * @return OrderInterface
  */
 private function createOrder(CustomerInterface $customer, $number = null, ChannelInterface $channel = null, $currencyCode = null)
 {
     $order = $this->orderFactory->createNew();
     $order->setCustomer($customer);
     if (null !== $number) {
         $order->setNumber($number);
     }
     $order->setChannel(null !== $channel ? $channel : $this->sharedStorage->get('channel'));
     $order->setCurrencyCode(null !== $currencyCode ? $currencyCode : $this->sharedStorage->get('currency')->getCode());
     $order->complete();
     return $order;
 }
开发者ID:TeamNovatek,项目名称:Sylius,代码行数:20,代码来源:OrderContext.php

示例10: createCart

 /**
  * @param CustomerInterface $customer
  * @param ChannelInterface|null $channel
  * @param string|null $currencyCode
  * @param string|null $localeCode
  *
  * @return OrderInterface
  */
 private function createCart(CustomerInterface $customer, ChannelInterface $channel = null, $currencyCode = null, $localeCode = null)
 {
     /** @var OrderInterface $order */
     $order = $this->orderFactory->createNew();
     $order->setCustomer($customer);
     $order->setChannel(null !== $channel ? $channel : $this->sharedStorage->get('channel'));
     $order->setLocaleCode(null !== $localeCode ? $localeCode : $this->sharedStorage->get('locale')->getCode());
     $currencyCode = $currencyCode ? $currencyCode : $order->getChannel()->getBaseCurrency()->getCode();
     $currency = $this->currencyRepository->findOneBy(['code' => $currencyCode]);
     $order->setCurrencyCode($currency->getCode());
     return $order;
 }
开发者ID:NeverResponse,项目名称:Sylius,代码行数:20,代码来源:OrderContext.php

示例11: createPaymentMethodFromNameAndCode

 /**
  * @param string $name
  * @param string $code
  * @param bool $addForCurrentChannel
  * @param string $description
  */
 private function createPaymentMethodFromNameAndCode($name, $code, $description = '', $addForCurrentChannel = true)
 {
     /** @var PaymentMethodInterface $paymentMethod */
     $paymentMethod = $this->paymentMethodFactory->createNew();
     $paymentMethod->setName(ucfirst($name));
     $paymentMethod->setCode($code);
     $paymentMethod->setGateway($this->paymentMethodNameToGatewayConverter->convert($name));
     $paymentMethod->setDescription($description);
     if ($addForCurrentChannel && $this->sharedStorage->has('channel')) {
         $channel = $this->sharedStorage->get('channel');
         $channel->addPaymentMethod($paymentMethod);
     }
     $this->sharedStorage->set('payment_method', $paymentMethod);
     $this->paymentMethodRepository->add($paymentMethod);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:21,代码来源:PaymentContext.php

示例12: createOrder

 /**
  * @param CustomerInterface $customer
  * @param string $number
  * @param ChannelInterface|null $channel
  * @param string|null $currencyCode
  * @param string|null $localeCode
  *
  * @return OrderInterface
  */
 private function createOrder(CustomerInterface $customer, $number = null, ChannelInterface $channel = null, $currencyCode = null, $localeCode = null)
 {
     $order = $this->orderFactory->createNew();
     $order->setCustomer($customer);
     if (null !== $number) {
         $order->setNumber($number);
     }
     $order->setChannel(null !== $channel ? $channel : $this->sharedStorage->get('channel'));
     $order->setCurrencyCode(null !== $currencyCode ? $currencyCode : $this->sharedStorage->get('currency')->getCode());
     $order->setLocaleCode(null !== $localeCode ? $localeCode : $this->sharedStorage->get('locale')->getCode());
     $currencyCode = $currencyCode ? $currencyCode : $this->sharedStorage->get('currency')->getCode();
     $currency = $this->currencyRepository->findOneBy(['code' => $currencyCode]);
     $order->setCurrencyCode($currency->getCode());
     $order->setExchangeRate($currency->getExchangeRate());
     $order->complete();
     return $order;
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:26,代码来源:OrderContext.php

示例13: createProduct

 /**
  * @param string $productName
  * @param int $price
  * @param string|null $date
  * @param ChannelInterface|null $channel
  *
  * @return ProductInterface
  */
 private function createProduct($productName, $price = 100, $date = null, ChannelInterface $channel = null)
 {
     /** @var ProductInterface $product */
     $product = $this->productFactory->createWithVariant();
     $product->setName($productName);
     $product->setCode(StringInflector::nameToUppercaseCode($productName));
     $product->setSlug($this->slugGenerator->generate($productName));
     $product->setCreatedAt(new \DateTime($date));
     /** @var ProductVariantInterface $productVariant */
     $productVariant = $this->defaultVariantResolver->getVariant($product);
     if (null === $channel && $this->sharedStorage->has('channel')) {
         $channel = $this->sharedStorage->get('channel');
     }
     if (null !== $channel) {
         $productVariant->addChannelPricing($this->createChannelPricingForChannel($price, $channel));
     }
     $productVariant->setCode($product->getCode());
     return $product;
 }
开发者ID:sylius,项目名称:sylius,代码行数:27,代码来源:ProductContext.php

示例14: productShouldExistInTheProductCatalog

 /**
  * @Then this product should still exist in the product catalog
  */
 public function productShouldExistInTheProductCatalog()
 {
     $productId = $this->sharedStorage->get('product_id');
     $product = $this->productRepository->find($productId);
     Assert::notNull($product);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:9,代码来源:ManagingProductsContext.php

示例15: productVariantShouldNotExistInTheProductCatalog

 /**
  * @Then /^this variant should not exist in the product catalog$/
  */
 public function productVariantShouldNotExistInTheProductCatalog()
 {
     $productVariantId = $this->sharedStorage->get('product_variant_id');
     $productVariant = $this->productVariantRepository->find($productVariantId);
     Assert::null($productVariant);
 }
开发者ID:TeamNovatek,项目名称:Sylius,代码行数:9,代码来源:ProductContext.php


注:本文中的Sylius\Behat\Service\SharedStorageInterface::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。