1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
From 3ec1c6368deef29d53b77c9431c7b592d2f200eb Mon Sep 17 00:00:00 2001
From: Jim Brandt <jbrandt@bestpractical.com>
Date: Mon, 9 Jan 2023 13:46:58 -0500
Subject: Switch to Test::MockTime::HiRes in date api test
Version 1.14 of DateTime::Format::Natural added support for
milliseconds, which involved changing DateTime calls to
DateTime::HiRes. DateTime::HiRes uses Time::HiRes::time(),
and Test::MockTime doesn't overload that time function. This
resulted in test times being returned as "now" rather than the
mocked time.
Switch to Test::MockTime::HiRes, which does overload the HiRes
time functions. This module also overloads the same time functions
as Test::MockTime, so this change should be compatible with
earlier versions of DateTime::Format::Natural.
Patch-Name: Switch-to-Test-MockTime-HiRes-in-date-api-test.diff
Forwarded: https://github.com/bestpractical/rt/pull/352
Upstream: 4.4.7, commit:8a2430fea5f565039f161c8485ac34496c2ad588
---
sbin/rt-test-dependencies.in | 1 +
t/api/date.t | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index ff1ff755..dcb1554b 100644
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -234,6 +234,7 @@ Test::Email
Test::Expect 0.31
Test::LongString
Test::MockTime
+Test::MockTime::HiRes
Test::NoWarnings
Test::Pod
Test::Warn
diff --git a/t/api/date.t b/t/api/date.t
index 19a0a015..f97484f8 100644
--- a/t/api/date.t
+++ b/t/api/date.t
@@ -1,5 +1,5 @@
-use Test::MockTime qw(set_fixed_time restore_time);
+use Test::MockTime::HiRes qw(set_fixed_time restore_time);
use DateTime;
use warnings;
|