$this->
assertEquals($expected[$val],
date($val,
$timestamp));
} } /**
* Tests the formatTimeDiffUntil method.
*
* @covers ::formatTimeDiffUntil
*/
public function testFormatTimeDiffUntil() { $expected = '1 second';
$request_time =
$this->
createTimestamp('2013-12-11 10:09:08'
);
$timestamp =
$this->
createTimestamp('2013-12-11 10:09:09'
);
$options =
[];
// Mocks the formatDiff function of the dateformatter object.
$this->dateFormatterStub
->
expects($this->
exactly(2
)) ->
method('formatDiff'
) ->
willReturnMap([ [$timestamp,
$request_time,
$options,
$expected],
[$timestamp,
$request_time,
$options +
['return_as_object' => TRUE
],
new FormattedDateDiff('1 second', 1
)],
]);