/** * @param string $type * @param string $typeId * * @dataProvider getFormats */ public function testTime($type, $typeId) { $date = '22-12-2015 00:47:47'; $formattedTime = 'Dec 22, 2015'; $this->formatter->expects($this->once())->method('time')->with($date, $typeId)->willReturn($formattedTime); $result = $this->extension->time($date, $type); $this->assertSame($formattedTime, $result); }
/** * @param \DateTime $date * * @return string */ public function dateShortHover(\DateTime $date) { $fullDate = $this->formatter->date($date, SimpleDateFormatter::FULL) . ', ' . $this->formatter->time($date, SimpleDateFormatter::SHORT); return sprintf('<span title="%s">%s</span>', $fullDate, $this->dateShort($date)); }
/** * @param \DateTimeInterface|int|string $dateTime * @param int|string $type full, long, medium, short or none * * @return string */ public function time($dateTime, $type = SimpleDateFormatter::MEDIUM) { return $this->formatter->time($dateTime, $this->toType($type)); }