Bug 19705: Try to fix random failures from DecreaseLoanHighHolds.t
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 23 Jan 2018 20:00:16 +0000 (17:00 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 23 Jan 2018 20:01:29 +0000 (17:01 -0300)
No idea if it will do the trick, wait and see...

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

index c970d91..b35dbfd 100755 (executable)
@@ -16,6 +16,7 @@
 # along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 use Modern::Perl;
+use DateTime;
 
 use C4::Circulation;
 use Koha::Database;
@@ -42,6 +43,10 @@ $dbh->do('DELETE FROM issuingrules');
 $dbh->do('DELETE FROM borrowers');
 $dbh->do('DELETE FROM items');
 
+my $now_value       = DateTime->now();
+my $mocked_datetime = Test::MockModule->new('DateTime');
+$mocked_datetime->mock( 'now', sub { return $now_value; } );
+
 my $library  = $builder->build( { source => 'Branch' } );
 my $category = $builder->build( { source => 'Category' } );
 my $itemtype = $builder->build( { source => 'Itemtype' } )->{itemtype};