Esempio n. 1
0
 /**
  * @Given the store has disabled locale :localeName
  */
 public function theStoreHasDisabledLocale($localeName)
 {
     $locale = $this->localeFactory->createNew();
     $locale->setCode($this->localeNameConverter->convertToCode($localeName));
     $locale->disable();
     $this->sharedStorage->set('locale', $locale);
     $this->localeRepository->add($locale);
 }
Esempio n. 2
0
 function it_throws_invalid_argument_exception_if_cannot_convert_locale_name_to_code(FactoryInterface $localeFactory, LocaleInterface $locale, LocaleNameConverterInterface $localeNameConverter, RepositoryInterface $localeRepository, SharedStorageInterface $sharedStorage)
 {
     $localeFactory->createNew()->willReturn($locale);
     $localeNameConverter->convertToCode('xyz')->willThrow(\InvalidArgumentException::class);
     $locale->setCode('no')->shouldNotBeCalled();
     $sharedStorage->set('locale', $locale)->shouldNotBeCalled();
     $localeRepository->add($locale)->shouldNotBeCalled();
     $this->shouldThrow(\InvalidArgumentException::class)->during('theStoreHasLocale', ['xyz']);
     $this->shouldThrow(\InvalidArgumentException::class)->during('theStoreHasDisabledLocale', ['xyz']);
 }
Esempio n. 3
0
 /**
  * @Transform :language
  * @Transform :localeCode
  */
 public function getLocaleCode($languageName)
 {
     return $this->localeNameConverter->convertToCode($languageName);
 }