Provide tests for future timestamp formatting

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
Morris Jobke 2017-10-23 14:20:21 +02:00
parent 58f900f380
commit 9b41236d4a
No known key found for this signature in database
GPG Key ID: FE03C3A163FEDE68
1 changed files with 9 additions and 0 deletions

View File

@ -46,10 +46,13 @@ class DateTimeFormatterTest extends TestCase {
$deL10N = \OC::$server->getL10N('lib', 'de'); $deL10N = \OC::$server->getL10N('lib', 'de');
return array( return array(
array('seconds ago', $time, $time), array('seconds ago', $time, $time),
array('in a few seconds', $time + 5 , $time),
array('1 minute ago', $this->getTimestampAgo($time, 30, 1), $time), array('1 minute ago', $this->getTimestampAgo($time, 30, 1), $time),
array('15 minutes ago', $this->getTimestampAgo($time, 30, 15), $time), array('15 minutes ago', $this->getTimestampAgo($time, 30, 15), $time),
array('in 15 minutes', $time, $this->getTimestampAgo($time, 30, 15)),
array('1 hour ago', $this->getTimestampAgo($time, 30, 15, 1), $time), array('1 hour ago', $this->getTimestampAgo($time, 30, 15, 1), $time),
array('3 hours ago', $this->getTimestampAgo($time, 30, 15, 3), $time), array('3 hours ago', $this->getTimestampAgo($time, 30, 15, 3), $time),
array('in 3 hours', $time, $this->getTimestampAgo($time, 30, 15, 3)),
array('4 days ago', $this->getTimestampAgo($time, 30, 15, 3, 4), $time), array('4 days ago', $this->getTimestampAgo($time, 30, 15, 3, 4), $time),
array('seconds ago', new \DateTime('Wed, 02 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')), array('seconds ago', new \DateTime('Wed, 02 Oct 2013 23:59:58 +0000'), new \DateTime('Wed, 02 Oct 2013 23:59:59 +0000')),
@ -86,9 +89,15 @@ class DateTimeFormatterTest extends TestCase {
// Normal testing // Normal testing
array('today', $this->getTimestampAgo($time, 30, 15), $time), array('today', $this->getTimestampAgo($time, 30, 15), $time),
array('yesterday', $this->getTimestampAgo($time, 0, 0, 0, 1), $time), array('yesterday', $this->getTimestampAgo($time, 0, 0, 0, 1), $time),
array('tomorrow', $time, $this->getTimestampAgo($time, 0, 0, 0, 1)),
array('4 days ago', $this->getTimestampAgo($time, 0, 0, 0, 4), $time), array('4 days ago', $this->getTimestampAgo($time, 0, 0, 0, 4), $time),
array('in 4 days', $time, $this->getTimestampAgo($time, 0, 0, 0, 4)),
array('5 months ago', $this->getTimestampAgo($time, 0, 0, 0, 155), $time), array('5 months ago', $this->getTimestampAgo($time, 0, 0, 0, 155), $time),
array('next month', $time, $this->getTimestampAgo($time, 0, 0, 0, 32)),
array('in 5 months', $time, $this->getTimestampAgo($time, 0, 0, 0, 155)),
array('2 years ago', $this->getTimestampAgo($time, 0, 0, 0, 0, 2), $time), array('2 years ago', $this->getTimestampAgo($time, 0, 0, 0, 0, 2), $time),
array('next year', $time, $this->getTimestampAgo($time, 0, 0, 0, 0, 1)),
array('in 2 years', $time, $this->getTimestampAgo($time, 0, 0, 0, 0, 2)),
// Test with compare timestamp // Test with compare timestamp
array('today', $this->getTimestampAgo($time, 0, 0, 0, 0, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)), array('today', $this->getTimestampAgo($time, 0, 0, 0, 0, 1), $this->getTimestampAgo($time, 0, 0, 0, 0, 1)),