public function formatIsCorrectlyReadFromCldr()
{
$mockModel = $this->createMock(I18n\Cldr\CldrModel::class, [], [[]]);
$mockModel->expects($this->once())->method('getElement')->with('numbers/decimalFormats/decimalFormatLength/decimalFormat/pattern')->will($this->returnValue('mockFormatString'));
$mockRepository = $this->createMock(I18n\Cldr\CldrRepository::class);
$mockRepository->expects($this->once())->method('getModelForLocale')->with($this->sampleLocale)->will($this->returnValue($mockModel));
$mockCache = $this->getMockBuilder(VariableFrontend::class)->disableOriginalConstructor()->getMock();
$mockCache->expects($this->at(0))->method('has')->with('parsedFormats')->will($this->returnValue(true));
$mockCache->expects($this->at(1))->method('has')->with('parsedFormatsIndices')->will($this->returnValue(true));
$mockCache->expects($this->at(2))->method('has')->with('localizedSymbols')->will($this->returnValue(true));
$mockCache->expects($this->at(3))->method('get')->with('parsedFormats')->will($this->returnValue([]));
$mockCache->expects($this->at(4))->method('get')->with('parsedFormatsIndices')->will($this->returnValue([]));
$mockCache->expects($this->at(5))->method('get')->with('localizedSymbols')->will($this->returnValue([]));
$mockCache->expects($this->at(6))->method('set')->with('parsedFormats');
$mockCache->expects($this->at(7))->method('set')->with('parsedFormatsIndices');
$mockCache->expects($this->at(8))->method('set')->with('localizedSymbols');
$reader = $this->getAccessibleMock(I18n\Cldr\Reader\NumbersReader::class, ['parseFormat']);
$reader->expects($this->once())->method('parseFormat')->with('mockFormatString')->will($this->returnValue('mockParsedFormat'));
$reader->injectCldrRepository($mockRepository);
$reader->injectCache($mockCache);
$reader->initializeObject();
$result = $reader->parseFormatFromCldr($this->sampleLocale, I18n\Cldr\Reader\NumbersReader::FORMAT_TYPE_DECIMAL);
$this->assertEquals('mockParsedFormat', $result);
$reader->shutdownObject();
}