當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。