Example #1
0
 /**
  * {@inheritdoc}
  */
 public function get(ChannelInterface $channel)
 {
     $currencyCode = $this->storage->getData($this->provideKey($channel));
     if (null === $currencyCode) {
         throw new CurrencyNotFoundException('No currency is set for current channel!');
     }
     return $currencyCode;
 }
 /**
  * {@inheritdoc}
  */
 public function getStoredToken($clear = false)
 {
     if ($this->storage->hasData(self::STORE_KEY)) {
         $token = $this->storage->getData(self::STORE_KEY);
         if ($clear) {
             $this->storage->removeData(self::STORE_KEY);
         }
         return $token;
     }
     return;
 }
Example #3
0
 function it_throws_a_locale_not_found_exception_if_storage_does_not_have_locale_code_for_given_channel(StorageInterface $storage, ChannelInterface $channel)
 {
     $channel->getCode()->willReturn('web');
     $storage->getData('_locale_web')->willReturn(null);
     $this->shouldThrow(LocaleNotFoundException::class)->during('get', [$channel]);
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 public function setCurrencyCode($currencyCode)
 {
     return $this->storage->setData(self::STORAGE_KEY, $currencyCode);
 }
Example #5
0
 function its_current_locale_is_default_locale_by_default(StorageInterface $storage)
 {
     $storage->getData(Argument::cetera())->shouldBeCalled()->willReturn('pl_PL');
     $this->getCurrentLocale()->shouldReturn('pl_PL');
 }
Example #6
0
 /**
  * {@inheritdoc}
  */
 public function setLocale($locale)
 {
     return $this->storage->setData(self::STORAGE_KEY, $locale);
 }
Example #7
0
 /**
  * {@inheritdoc}
  */
 public function resetCurrentCartIdentifier()
 {
     $this->storage->removeData(self::STORAGE_KEY);
 }