/** * Formats date according to locale settings. * * Options format: * array( * 'locale' => <locale>, * 'timeZone' => <timeZone>, * ) * * @param \DateTime|string|int $date * @param array $options * @return string */ public function formatDay($date, array $options = []) { $dateType = $this->getOption($options, 'dateType'); $locale = $this->getOption($options, 'locale'); $timeZone = $this->getOption($options, 'timeZone', 'UTC'); return $this->formatter->formatDay($date, $dateType, $locale, $timeZone); }
/** * @param \DateTime $date * @param int $dateType * @param string $locale * @param string $timeZone * @param string $language * @param string $year * @param string $defaultLocale * @param string $defaultTimeZone * * @dataProvider formatDayDataProvider */ public function testFormatDay(\DateTime $date, $dateType, $locale, $timeZone, $language, $year, $defaultLocale = null, $defaultTimeZone = null) { $this->localeSettings->expects($this->any())->method('getLanguage')->will($this->returnValue($language)); if ($defaultLocale) { $this->localeSettings->expects($this->any())->method('getLocale')->will($this->returnValue($defaultLocale)); } if ($defaultTimeZone) { $this->localeSettings->expects($this->any())->method('getTimeZone')->will($this->returnValue($defaultTimeZone)); } $actual = $this->formatter->formatDay($date, $dateType, $locale, $timeZone); $this->assertNotContains("'", $actual); $this->assertNotContains(',', $actual); $this->assertNotContains($year, $actual); }