public function testFormatDate() { $value = new \DateTime('2013-12-31 00:00:00'); $dateType = 'short'; $locale = 'en_US'; $timeZone = 'America/Los_Angeles'; $options = ['dateType' => $dateType, 'locale' => $locale, 'timeZone' => $timeZone]; $expectedResult = '12/31/13'; $this->formatter->expects($this->once())->method('formatDate')->with($value, $dateType, $locale, $timeZone)->will($this->returnValue($expectedResult)); $this->assertEquals($expectedResult, $this->extension->formatDate($value, $options)); }
/** * @param \DateTime $value * @param string $dateType * @param string $locale * @param string $timeZone * @param string $expected * @dataProvider formatDateDataProvider */ public function testFormatDate($value, $expected, $dateType = null, $locale = null, $timeZone = null) { $options = ['dateType' => $dateType, 'locale' => $locale, 'timeZone' => $timeZone]; $this->formatter->expects($this->once())->method('formatDate')->with($value, $dateType, $locale, $timeZone ?: 'UTC')->will($this->returnValue($expected)); $this->assertEquals($expected, $this->extension->formatDate($value, $options)); }