From 41056cb12a3aa4b6bf1da25737c2368f765a0f76 Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 18 May 2020 09:32:58 -0700 Subject: [PATCH] Improved e_date::computerLapse() test. --- e107_tests/tests/unit/e_dateTest.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/e107_tests/tests/unit/e_dateTest.php b/e107_tests/tests/unit/e_dateTest.php index b0c274e18..152b227e1 100644 --- a/e107_tests/tests/unit/e_dateTest.php +++ b/e107_tests/tests/unit/e_dateTest.php @@ -173,16 +173,17 @@ $expected = '1 year ago'; $this->assertEquals($expected, $actual); - $newer = strtotime("+2 weeks"); - $actual = $this->dateObj->computeLapse($newer, time(), false, true, 'short'); + $time = time(); + $newer = strtotime("+2 weeks", $time); + $actual = $this->dateObj->computeLapse($newer, $time, false, true, 'short'); $expected = 'in 2 weeks'; $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); - $newer = strtotime("+10 seconds"); - $actual = $this->dateObj->computeLapse($newer, time(), false, true, 'long'); + $newer = strtotime("+10 seconds", $time); + $actual = $this->dateObj->computeLapse($newer, $time, false, true, 'long'); $this->assertEquals("Just now", $actual); // XXX Improve output