Bug 17770: Fix Sitemapper.t if date changes during test run
authorMark Tompsett <mtompset@hotmail.com>
Mon, 6 Nov 2017 19:49:27 +0000 (19:49 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 21 Dec 2017 16:07:55 +0000 (13:07 -0300)
To compensate, DateTime->now is mocked to the current date.

Signed-off-by: Jon Knight <J.P.Knight@lboro.ac.uk>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

t/db_dependent/Sitemapper.t

index 4276470..4c5e741 100755 (executable)
@@ -31,6 +31,10 @@ BEGIN {
     use_ok('Koha::Sitemapper::Writer');
 }
 
+my $now_value = DateTime->now();
+my $mocked_datetime = Test::MockModule->new('DateTime');
+$mocked_datetime->mock('now', sub { return $now_value; } );
+
 sub slurp {
     my $file = shift;
     open my $fh, '<', $file or die;