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


PHP Factory\FactoryInterface类代码示例

本文整理汇总了PHP中Sylius\Component\Resource\Factory\FactoryInterface的典型用法代码示例。如果您正苦于以下问题:PHP FactoryInterface类的具体用法?PHP FactoryInterface怎么用?PHP FactoryInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1:

 function it_creates_a_default_united_states_channel_with_country_zone_and_usd_as_default_currency(RepositoryInterface $channelRepository, RepositoryInterface $countryRepository, RepositoryInterface $currencyRepository, RepositoryInterface $localeRepository, RepositoryInterface $zoneMemberRepository, RepositoryInterface $zoneRepository, ChannelFactoryInterface $channelFactory, FactoryInterface $countryFactory, FactoryInterface $currencyFactory, FactoryInterface $localeFactory, FactoryInterface $zoneFactory, FactoryInterface $zoneMemberFactory, ZoneMemberInterface $zoneMember, ZoneInterface $zone, ChannelInterface $channel, CountryInterface $unitedStates, CurrencyInterface $currency, LocaleInterface $locale)
 {
     $channel->getName()->willReturn('United States');
     $channelFactory->createNamed('United States')->willReturn($channel);
     $localeFactory->createNew()->willReturn($locale);
     $locale->setCode('en_US')->shouldBeCalled();
     $zoneMemberFactory->createNew()->willReturn($zoneMember);
     $zoneFactory->createNew()->willReturn($zone);
     $channel->setCode('WEB-US')->shouldBeCalled();
     $channel->setTaxCalculationStrategy('order_items_based')->shouldBeCalled();
     $zoneMember->setCode('US')->shouldBeCalled();
     $zone->setCode('US')->shouldBeCalled();
     $zone->setName('United States')->shouldBeCalled();
     $zone->setType(ZoneInterface::TYPE_COUNTRY)->shouldBeCalled();
     $zone->addMember($zoneMember)->shouldBeCalled();
     $countryFactory->createNew()->willReturn($unitedStates);
     $unitedStates->setCode('US')->shouldBeCalled();
     $currencyFactory->createNew()->willReturn($currency);
     $currency->setCode('USD')->shouldBeCalled();
     $currency->setExchangeRate(1.0)->shouldBeCalled();
     $channel->setDefaultCurrency($currency)->shouldBeCalled();
     $channel->addCurrency($currency)->shouldBeCalled();
     $channel->setDefaultLocale($locale)->shouldBeCalled();
     $channel->addLocale($locale)->shouldBeCalled();
     $currencyRepository->findOneBy(['code' => 'USD'])->willReturn(null);
     $localeRepository->findOneBy(['code' => 'en_US'])->willReturn(null);
     $currencyRepository->add($currency)->shouldBeCalled();
     $localeRepository->add($locale)->shouldBeCalled();
     $countryRepository->add($unitedStates)->shouldBeCalled();
     $channelRepository->add($channel)->shouldBeCalled();
     $zoneRepository->add($zone)->shouldBeCalled();
     $zoneMemberRepository->add($zoneMember)->shouldBeCalled();
     $this->create();
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:34,代码来源:DefaultUnitedStatesChannelFactorySpec.php

示例2:

 function it_creates_a_cart_item_and_assigns_a_product_variant(FactoryInterface $decoratedFactory, VariantResolverInterface $variantResolver, OrderItemInterface $cartItem, ProductInterface $product, ProductVariantInterface $productVariant)
 {
     $decoratedFactory->createNew()->willReturn($cartItem);
     $variantResolver->getVariant($product)->willReturn($productVariant);
     $cartItem->setVariant($productVariant)->shouldBeCalled();
     $this->createForProduct($product)->shouldReturn($cartItem);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:7,代码来源:CartItemFactorySpec.php

示例3:

 function it_calls_proper_factory_methods_based_on_configuration(RequestConfiguration $requestConfiguration, FactoryInterface $factory)
 {
     $requestConfiguration->getFactoryMethod()->willReturn('createNew');
     $requestConfiguration->getFactoryArguments()->willReturn(['00032']);
     $factory->createNew('00032')->willReturn(['foo', 'bar']);
     $this->create($requestConfiguration, $factory)->shouldReturn(['foo', 'bar']);
 }
开发者ID:gabiudrescu,项目名称:Sylius,代码行数:7,代码来源:NewResourceFactorySpec.php

示例4:

 function it_calls_proper_method_with_arguments_based_on_configuration_when_creating_resource(FactoryInterface $factory, $configuration)
 {
     $configuration->getFactoryMethod('createNew')->willReturn('createNew');
     $configuration->getFactoryArguments(array())->willReturn(array());
     $factory->createNew()->willReturn(array('foo', 'bar'));
     $this->createResource($factory, 'createNew')->shouldReturn(array('foo', 'bar'));
 }
开发者ID:aleherse,项目名称:Sylius,代码行数:7,代码来源:ResourceResolverSpec.php

示例5:

 function it_creates_a_nth_order_rule(FactoryInterface $decoratedFactory, RuleInterface $rule)
 {
     $decoratedFactory->createNew()->willReturn($rule);
     $rule->setType(NthOrderRuleChecker::TYPE)->shouldBeCalled();
     $rule->setConfiguration(['nth' => 10])->shouldBeCalled();
     $this->createNthOrder(10)->shouldReturn($rule);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:7,代码来源:RuleFactorySpec.php

示例6:

 function it_creates_a_taxon_and_assigns_a_taxonomy_to_id(FactoryInterface $factory, RepositoryInterface $taxonomyRepository, TaxonomyInterface $taxonomy, TaxonInterface $taxon)
 {
     $factory->createNew()->willReturn($taxon);
     $taxonomyRepository->find(13)->willReturn($taxonomy);
     $taxon->setTaxonomy($taxonomy)->shouldBeCalled();
     $this->createForTaxonomy(13)->shouldReturn($taxon);
 }
开发者ID:vikey89,项目名称:Sylius,代码行数:7,代码来源:TaxonFactorySpec.php

示例7:

 function it_creates_a_contains_product_rule(FactoryInterface $decoratedFactory, PromotionRuleInterface $rule)
 {
     $decoratedFactory->createNew()->willReturn($rule);
     $rule->setType(ContainsProductRuleChecker::TYPE)->shouldBeCalled();
     $rule->setConfiguration(['product_code' => 1])->shouldBeCalled();
     $this->createContainsProduct(1)->shouldReturn($rule);
 }
开发者ID:sylius,项目名称:core,代码行数:7,代码来源:PromotionRuleFactorySpec.php

示例8:

 function it_creates_a_shipping_percentage_discount_action_with_a_given_discount_rate(FactoryInterface $decoratedFactory, PromotionActionInterface $promotionAction)
 {
     $decoratedFactory->createNew()->willReturn($promotionAction);
     $promotionAction->setType(ShippingPercentageDiscountPromotionActionCommand::TYPE)->shouldBeCalled();
     $promotionAction->setConfiguration(['percentage' => 0.1])->shouldBeCalled();
     $this->createShippingPercentageDiscount(0.1)->shouldReturn($promotionAction);
 }
开发者ID:sylius,项目名称:core,代码行数:7,代码来源:PromotionActionFactorySpec.php

示例9:

 function it_creates_payment_with_currency_and_amout(FactoryInterface $paymentFactory, PaymentInterface $payment)
 {
     $paymentFactory->createNew()->willReturn($payment);
     $payment->setAmount(1234)->shouldBeCalled();
     $payment->setCurrency('EUR')->shouldBeCalled();
     $this->createWithAmountAndCurrency(1234, 'EUR');
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:7,代码来源:PaymentFactorySpec.php

示例10:

 function it_creates_a_review_with_subject_and_reviewer(FactoryInterface $factory, ReviewableInterface $subject, ReviewInterface $review, ReviewerInterface $reviewer)
 {
     $factory->createNew()->willReturn($review);
     $review->setReviewSubject($subject)->shouldBeCalled();
     $review->setAuthor($reviewer)->shouldBeCalled();
     $this->createForSubjectWithReviewer($subject, $reviewer);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:7,代码来源:ReviewFactorySpec.php

示例11:

 function it_creates_new_product_with_variant(FactoryInterface $factory, FactoryInterface $variantFactory, ProductInterface $product, ProductVariantInterface $variant)
 {
     $variantFactory->createNew()->willReturn($variant);
     $factory->createNew()->willReturn($product);
     $product->addVariant($variant)->shouldBeCalled();
     $this->createWithVariant()->shouldReturn($product);
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:7,代码来源:ProductFactorySpec.php

示例12: createCountryNamed

 /**
  * @param string $name
  */
 private function createCountryNamed($name)
 {
     /** @var CountryInterface $country */
     $country = $this->countryFactory->createNew();
     $country->setCode($this->getCountryCodeByEnglishCountryName($name));
     $this->countryRepository->add($country);
 }
开发者ID:stevedien,项目名称:Sylius,代码行数:10,代码来源:GeographicalContext.php

示例13: createTaxon

 /**
  * @param string $name
  *
  * @return TaxonInterface
  */
 private function createTaxon($name)
 {
     $taxon = $this->taxonFactory->createNew();
     $taxon->setName($name);
     $taxon->setCode($this->getCodeFromName($name));
     return $taxon;
 }
开发者ID:Mozan,项目名称:Sylius,代码行数:12,代码来源:TaxonomyContext.php

示例14: generate

 /**
  * {@inheritdoc}
  */
 public function generate(VariableInterface $variable)
 {
     if (!$variable->hasOptions()) {
         throw new \InvalidArgumentException('Cannot generate variants for an object without options.');
     }
     $optionSet = array();
     $optionMap = array();
     foreach ($variable->getOptions() as $k => $option) {
         foreach ($option->getValues() as $value) {
             $optionSet[$k][] = $value->getId();
             $optionMap[$value->getId()] = $value;
         }
     }
     $permutations = $this->setBuilder->build($optionSet);
     foreach ($permutations as $permutation) {
         $variant = $this->variantFactory->createNew();
         $variant->setObject($variable);
         $variant->setDefaults($variable->getMasterVariant());
         if (is_array($permutation)) {
             foreach ($permutation as $id) {
                 $variant->addOption($optionMap[$id]);
             }
         } else {
             $variant->addOption($optionMap[$permutation]);
         }
         $variable->addVariant($variant);
         $this->process($variable, $variant);
     }
 }
开发者ID:aleherse,项目名称:Sylius,代码行数:32,代码来源:VariantGenerator.php

示例15: createNew

 /**
  * {@inheritdoc}
  */
 public function createNew()
 {
     /** @var Route $route */
     $route = $this->decoratedFactory->createNew();
     $route->setParentDocument($this->documentManager->find(null, $this->routeParentPath));
     return $route;
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:RouteFactory.php


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