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


PHP Context\ChannelContextInterface类代码示例

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


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

示例1:

 function it_proccess_order_channel_successfully(GenericEvent $event, OrderInterface $order, ChannelContextInterface $channelContext, ChannelInterface $channel)
 {
     $event->getSubject()->shouldBeCalled()->willReturn($order);
     $channelContext->getChannel()->shouldBeCalled()->willReturn($channel);
     $order->setChannel($channel)->shouldBeCalled();
     $this->processOrderChannel($event);
 }
开发者ID:Silwereth,项目名称:Sylius,代码行数:7,代码来源:OrderChannelListenerSpec.php

示例2:

 function it_does_not_cache_results_while_there_are_no_master_requests(ChannelContextInterface $decoratedChannelContext, RequestStack $requestStack, ChannelInterface $firstChannel, ChannelInterface $secondChannel)
 {
     $requestStack->getMasterRequest()->willReturn(null, null);
     $decoratedChannelContext->getChannel()->willReturn($firstChannel, $secondChannel)->shouldBeCalledTimes(2);
     $this->getChannel()->shouldReturn($firstChannel);
     $this->getChannel()->shouldReturn($secondChannel);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:7,代码来源:CachedPerRequestChannelContextSpec.php

示例3:

 function it_does_not_cache_channel_not_found_exceptions_for_null_master_requests(ChannelContextInterface $decoratedChannelContext, RequestStack $requestStack, ChannelInterface $channel)
 {
     $requestStack->getMasterRequest()->willReturn(null, null);
     $decoratedChannelContext->getChannel()->will(CompositePromise::it()->willThrow(ChannelNotFoundException::class)->andThenReturn($channel))->shouldBeCalledTimes(2);
     $this->shouldThrow(ChannelNotFoundException::class)->during('getChannel');
     $this->getChannel()->shouldReturn($channel);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:7,代码来源:CachedPerRequestChannelContextSpec.php

示例4:

 function it_throws_an_exception_if_currency_taken_from_storage_is_not_available(ChannelContextInterface $channelContext, CurrencyStorageInterface $currencyStorage, CurrencyProviderInterface $currencyProvider, ChannelInterface $channel)
 {
     $channelContext->getChannel()->willReturn($channel);
     $currencyStorage->get($channel)->willReturn('BTC');
     $currencyProvider->getAvailableCurrenciesCodes()->willReturn(['LTC', 'PLN']);
     $this->shouldThrow(CurrencyNotFoundException::class)->during('getCurrencyCode');
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:7,代码来源:StorageBasedCurrencyContextSpec.php

示例5: GenericEvent

 function it_throws_handle_exception_if_channel_was_not_found(LocaleStorageInterface $localeStorage, ChannelContextInterface $channelContext, EventDispatcherInterface $eventDispatcher)
 {
     $channelContext->getChannel()->willThrow(ChannelNotFoundException::class);
     $localeStorage->set(Argument::any(), Argument::any())->shouldNotBeCalled();
     $eventDispatcher->dispatch(SyliusLocaleEvents::CODE_CHANGED, new GenericEvent('en_GB'))->shouldNotBeCalled();
     $this->shouldThrow(HandleException::class)->during('handle', ['en_GB']);
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:7,代码来源:ShopLocaleChangeHandlerSpec.php

示例6:

 function it_throws_an_exception_if_locale_taken_from_storage_is_not_available(ChannelContextInterface $channelContext, LocaleStorageInterface $localeStorage, LocaleProviderInterface $localeProvider, ChannelInterface $channel)
 {
     $channelContext->getChannel()->willReturn($channel);
     $localeStorage->get($channel)->willReturn('pl_PL');
     $localeProvider->getAvailableLocalesCodes()->willReturn(['en_US', 'en_UK']);
     $this->shouldThrow(LocaleNotFoundException::class)->during('getLocaleCode');
 }
开发者ID:sylius,项目名称:core,代码行数:7,代码来源:StorageBasedLocaleContextSpec.php

示例7:

 function it_handles_shop_currency_code_change(CurrencyStorageInterface $currencyStorage, ChannelContextInterface $channelContext, EventDispatcherInterface $eventDispatcher, ChannelInterface $channel)
 {
     $channelContext->getChannel()->willReturn($channel);
     $currencyStorage->set($channel, 'USD')->shouldBeCalled();
     $eventDispatcher->dispatch(SyliusCurrencyEvents::CODE_CHANGED, Argument::type(GenericEvent::class))->shouldBeCalled();
     $this->handle('USD');
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:7,代码来源:ShopCurrencyChangeHandlerSpec.php

示例8:

 function it_clears_cart_session_after_logging_out_and_return_default_handler_response(ChannelContextInterface $channelContext, ChannelInterface $channel, HttpUtils $httpUtils, Request $request, Response $response, SessionInterface $session)
 {
     $channelContext->getChannel()->willReturn($channel);
     $channel->getCode()->willReturn('WEB_US');
     $session->remove('_sylius.cart.WEB_US')->shouldBeCalled();
     $httpUtils->createRedirectResponse($request, '/')->willReturn($response);
     $this->onLogoutSuccess($request)->shouldReturn($response);
 }
开发者ID:sylius,项目名称:sylius,代码行数:8,代码来源:ShopUserLogoutHandlerSpec.php

示例9: __construct

 /**
  * @param ChannelRepositoryInterface $channelRepository
  * @param ChannelContextInterface $channelContext
  */
 public function __construct(ChannelRepositoryInterface $channelRepository, ChannelContextInterface $channelContext)
 {
     $this->data['channels'] = $channelRepository->findAll();
     try {
         $this->data['current_channel'] = $channelContext->getChannel();
     } catch (ChannelNotFoundException $exception) {
         $this->data['current_channel'] = null;
     }
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:13,代码来源:FakeChannelCollector.php

示例10:

 function its_nested_request_resolvers_can_have_priority(ChannelContextInterface $firstChannelContext, ChannelContextInterface $secondChannelContext, ChannelContextInterface $thirdChannelContext, ChannelInterface $channel)
 {
     $firstChannelContext->getChannel()->shouldNotBeCalled();
     $secondChannelContext->getChannel()->willReturn($channel);
     $thirdChannelContext->getChannel()->willThrow(ChannelNotFoundException::class);
     $this->addContext($firstChannelContext, -5);
     $this->addContext($secondChannelContext, 0);
     $this->addContext($thirdChannelContext, 5);
     $this->getChannel()->shouldReturn($channel);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:10,代码来源:CompositeChannelContextSpec.php

示例11:

 function it_sends_an_email_registration_successfully(SenderInterface $emailSender, ChannelContextInterface $channelContext, GenericEvent $event, CustomerInterface $customer, ShopUserInterface $user, ChannelInterface $channel)
 {
     $event->getSubject()->willReturn($customer);
     $customer->getUser()->willReturn($user);
     $customer->getEmail()->willReturn('fulanito@sylius.com');
     $user->getEmail()->willReturn('fulanito@sylius.com');
     $channelContext->getChannel()->willReturn($channel);
     $emailSender->send(Emails::USER_REGISTRATION, ['fulanito@sylius.com'], ['user' => $user])->shouldBeCalled();
     $this->sendUserRegistrationEmail($event);
 }
开发者ID:sylius,项目名称:sylius,代码行数:10,代码来源:UserMailerListenerSpec.php

示例12: getAvailableCurrencies

 /**
  * {@inheritdoc}
  */
 public function getAvailableCurrencies()
 {
     $currentChannel = $this->channelContext->getChannel();
     return $currentChannel->getCurrencies()->filter(function (CurrencyInterface $currency) {
         return $currency->isEnabled();
     });
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:10,代码来源:ChannelAwareCurrencyProvider.php

示例13: collect

 /**
  * {@inheritdoc}
  */
 public function collect(Request $request, Response $response, \Exception $exception = null)
 {
     try {
         $this->data['channel'] = $this->channelContext->getChannel();
     } catch (ChannelNotFoundException $exception) {
     }
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:ChannelCollector.php

示例14: processOrderChannel

 /**
  * @param GenericEvent $event
  */
 public function processOrderChannel(GenericEvent $event)
 {
     $order = $event->getSubject();
     if (!$order instanceof OrderInterface) {
         throw new UnexpectedTypeException($order, 'Sylius\\Component\\Core\\Model\\OrderInterface');
     }
     $order->setChannel($this->channelContext->getChannel());
 }
开发者ID:Strontium-90,项目名称:Sylius,代码行数:11,代码来源:OrderChannelListener.php

示例15: processOrderChannel

 /**
  * @param GenericEvent $event
  */
 public function processOrderChannel(GenericEvent $event)
 {
     $order = $event->getSubject();
     if (!$order instanceof OrderInterface) {
         throw new UnexpectedTypeException($order, OrderInterface::class);
     }
     $order->setChannel($this->channelContext->getChannel());
 }
开发者ID:Silwereth,项目名称:Sylius,代码行数:11,代码来源:OrderChannelListener.php


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