/** * @test * @dataProvider sampleDataForSpecificFormattingMethods */ public function specificFormattingMethodsWork(array $parsedFormat, $expectedResult, $formatType) { $formatLength = I18n\Cldr\Reader\DatesReader::FORMAT_LENGTH_FULL; $mockDatesReader = $this->createMock(I18n\Cldr\Reader\DatesReader::class); $mockDatesReader->expects($this->once())->method('parseFormatFromCldr')->with($this->sampleLocale, $formatType, $formatLength)->will($this->returnValue($parsedFormat)); $mockDatesReader->expects($this->once())->method('getLocalizedLiteralsForLocale')->with($this->sampleLocale)->will($this->returnValue($this->sampleLocalizedLiterals)); $formatter = new I18n\Formatter\DatetimeFormatter(); $formatter->injectDatesReader($mockDatesReader); $methodName = 'format' . ucfirst($formatType); $result = $formatter->{$methodName}($this->sampleDateTime, $this->sampleLocale, $formatLength); $this->assertEquals($expectedResult, $result); }