Ejemplo n.º 1
0
 function it_sets_currency_to_customer(CustomerInterface $customer, $customerContext, ChannelInterface $channel, $channelContext)
 {
     $customerContext->getCustomer()->willReturn($customer);
     $customer->setCurrency('PLN')->shouldBeCalled();
     $channel->getCode()->willReturn('WEB');
     $channelContext->getChannel()->willReturn($channel);
     $this->setCurrency('PLN');
 }
Ejemplo n.º 2
0
 public function getProductIdsFromChannel(ChannelInterface $channel)
 {
     $productClassName = $this->productRepository->getClassName();
     // Gets the taxon ids
     $queryBuilder = $this->em->createQueryBuilder();
     $queryBuilder->select('product.id')->from($productClassName, 'product')->leftJoin('product.channels', 'channel')->where('channel.id = :channel')->setParameter('channel', $channel->getId());
     $filteredIds = [];
     foreach ($queryBuilder->getQuery()->getArrayResult() as $product) {
         $filteredIds[$productClassName][] = $product['id'];
     }
     return $filteredIds;
 }
 function it_throws_a_locale_not_found_exception_if_storage_does_not_have_locale_code_for_given_channel(SessionInterface $session, ChannelInterface $channel)
 {
     $channel->getCode()->willReturn('web');
     $session->get('_locale_web')->willReturn(null);
     $this->shouldThrow(LocaleNotFoundException::class)->during('get', [$channel]);
 }
 /**
  * @Then I should be notified that amount for :channel channel should not be blank
  */
 public function iShouldBeNotifiedThatAmountForChannelShouldNotBeBlank(ChannelInterface $channel)
 {
     /** @var CreatePageInterface|UpdatePageInterface $currentPage */
     $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]);
     Assert::same($currentPage->getValidationMessageForAmount($channel->getCode()), 'This value should not be blank.');
 }
Ejemplo n.º 5
0
 function it_throws_a_currency_not_found_exception_if_storage_does_not_have_currency_code_for_given_channel(StorageInterface $storage, ChannelInterface $channel)
 {
     $channel->getCode()->willReturn('web');
     $storage->getData('_currency_web')->willReturn(null);
     $this->shouldThrow(CurrencyNotFoundException::class)->during('get', [$channel]);
 }
Ejemplo n.º 6
0
 function it_sets_channel_as_current(CookieSetterInterface $cookieSetter, ChannelInterface $channel)
 {
     $channel->getCode()->willReturn('CHANNEL_CODE');
     $cookieSetter->setCookie('_channel_code', 'CHANNEL_CODE')->shouldBeCalled();
     $this->setChannel($channel);
 }
Ejemplo n.º 7
0
 /**
  * {@inheritdoc}
  */
 private function provideKey(ChannelInterface $channel)
 {
     return '_currency_' . $channel->getCode();
 }
Ejemplo n.º 8
0
 /**
  * {@inheritdoc}
  */
 public function setChannel(ChannelInterface $channel)
 {
     $this->cookieSetter->setCookie('_channel_code', $channel->getCode());
 }
Ejemplo n.º 9
0
 /**
  * {@inheritdoc}
  */
 private function provideKey(ChannelInterface $channel)
 {
     return '_locale_' . $channel->getCode();
 }