1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

Improved e_date::computerLapse() test.

This commit is contained in:
Cameron 2020-05-18 09:32:58 -07:00
parent cf919afa62
commit 41056cb12a

View File

@ -173,16 +173,17 @@
$expected = '1 year ago'; $expected = '1 year ago';
$this->assertEquals($expected, $actual); $this->assertEquals($expected, $actual);
$newer = strtotime("+2 weeks"); $time = time();
$actual = $this->dateObj->computeLapse($newer, time(), false, true, 'short'); $newer = strtotime("+2 weeks", $time);
$actual = $this->dateObj->computeLapse($newer, $time, false, true, 'short');
$expected = 'in 2 weeks'; $expected = 'in 2 weeks';
$this->assertEquals($expected, $actual); $this->assertEquals($expected, $actual);
$actual = $this->dateObj->computeLapse($newer, time(), true, true, 'short'); $actual = $this->dateObj->computeLapse($newer, $time, true, true, 'short');
$this->assertEquals(array(0=>'2 weeks'), $actual); $this->assertEquals(array(0=>'2 weeks'), $actual);
$newer = strtotime("+10 seconds"); $newer = strtotime("+10 seconds", $time);
$actual = $this->dateObj->computeLapse($newer, time(), false, true, 'long'); $actual = $this->dateObj->computeLapse($newer, $time, false, true, 'long');
$this->assertEquals("Just now", $actual); $this->assertEquals("Just now", $actual);
// XXX Improve output // XXX Improve output