/**
  * @param string $locale
  */
 public function __construct(string $locale)
 {
     $this->locale = $locale;
     $this->formatFunctions = ['language' => function ($value) use($locale) {
         $language = Locale::getDisplayLanguage($value, $locale);
         if ($value === $language) {
             throw InvalidValueException::invalidLocale($value);
         }
         return $language;
     }, 'region' => function ($value) use($locale) {
         $region = Locale::getDisplayRegion($value, $locale);
         if ('' === $region) {
             throw InvalidValueException::invalidLocale($value);
         }
         return $region;
     }];
 }
 /**
  * @expectedException \Budgegeria\IntlFormat\Exception\InvalidValueException
  * @expectedExceptionMessage "foo" is not a valid locale.
  */
 public function testInvalidLocale()
 {
     throw InvalidValueException::invalidLocale('foo');
 }