4 use Test::More tests => 1;
7 use t::lib::TestBuilder;
14 my $schema = Koha::Database->new->schema;
15 $schema->storage->txn_begin;
17 subtest 'AutoUnsuspendReserves test' => sub {
20 my $builder = t::lib::TestBuilder->new();
22 my $today = dt_from_string();
23 my $today_date = output_pref({ dateformat => 'sql' });
24 my $tomorrow_date = output_pref({ dt => $today->add(days=>1), dateformat=>'sql' });
27 my $reserve1 = $builder->build({
30 expirationdate => undef,
31 cancellationdate => undef,
34 suspend_until => $today_date,
38 my $reserve2 = $builder->build({
41 expirationdate => undef,
42 cancellationdate => undef,
45 suspend_until => $tomorrow_date,
49 AutoUnsuspendReserves();
50 my $r1 = Koha::Holds->find($reserve1->{reserve_id});
51 my $r2 = Koha::Holds->find($reserve2->{reserve_id});
52 ok(!defined($r1->suspend_until), 'Reserve suspended until today should be unsuspended.');
53 ok(defined($r2->suspend_until), 'Reserve suspended after today should be suspended.');
57 $schema->storage->txn_rollback;