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


PHP SharedStorageInterface::has方法代码示例

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


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

示例1: storeHasAProductPricedAt

 /**
  * @Given the store has a product :productName
  * @Given the store has a :productName product
  * @Given /^the store has a product "([^"]+)" priced at ("[^"]+")$/
  */
 public function storeHasAProductPricedAt($productName, $price = 0)
 {
     $product = $this->createProduct($productName, $price);
     $product->setDescription('Awesome ' . $productName);
     if ($this->sharedStorage->has('channel')) {
         $channel = $this->sharedStorage->get('channel');
         $product->addChannel($channel);
     }
     $this->saveProduct($product);
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:15,代码来源:ProductContext.php

示例2: createShippingMethod

 /**
  * @param string $name
  * @param string|null $code
  * @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, 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->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:remyma,项目名称:Sylius,代码行数:34,代码来源:ShippingContext.php

示例3: assertValidationMessage

 /**
  * @param string $element
  * @param string $message
  */
 private function assertValidationMessage($element, $message)
 {
     $product = $this->sharedStorage->has('product') ? $this->sharedStorage->get('product') : null;
     $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createSimpleProductPage, $this->createConfigurableProductPage, $this->updateSimpleProductPage, $this->updateConfigurableProductPage], $product);
     Assert::true($currentPage->checkValidationMessageFor($element, $message), sprintf('Product %s should be required.', $element));
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:10,代码来源:ManagingProductsContext.php


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