Try to fix tests on Travis

This commit is contained in:
SilverFire - Dmitry Naumenko
2017-08-16 08:04:35 +03:00
parent 3e253d0d9d
commit b9f582dbf3
2 changed files with 30 additions and 9 deletions

View File

@ -1539,14 +1539,18 @@ class Formatter extends Component
}
if ($this->_resourceBundle === null) {
$this->_resourceBundle = new \ResourceBundle($this->locale, 'ICUDATA-unit');
try {
$this->_resourceBundle = new \ResourceBundle($this->locale, 'ICUDATA-unit');
} catch (\IntlException $e) {
throw new InvalidConfigException('Current ICU data does not contain information about measure units. Check system requirements.');
}
}
$unitNames = array_keys($this->measureUnits[$unitType][$system]);
$bundleKey = 'units' . ($unitFormat === self::FORMAT_WIDTH_SHORT ? 'Short' : '');
$unitBundle = $this->_resourceBundle[$bundleKey][$unitType][$unitNames[$position]];
if ($unitBundle === null) {
throw new InvalidConfigException('Current version of ICU data does not contain information about unit type "' . $unitType . '" and unit measure "' . $unitNames[$position] . '. Check system requirements.');
throw new InvalidConfigException('Current ICU data version does not contain information about unit type "' . $unitType . '" and unit measure "' . $unitNames[$position] . '". Check system requirements.');
}
$message = [];