Bugzilla – Attachment 76954 Details for
Bug 21075
AutoUnsuspendHolds should unsuspend holds <= today
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21075: Unit tests
Bug-21075-Unit-tests.patch (text/plain), 2.22 KB, created by
Nick Clemens (kidclamp)
on 2018-07-13 15:15:09 UTC
(
hide
)
Description:
Bug 21075: Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2018-07-13 15:15:09 UTC
Size:
2.22 KB
patch
obsolete
>From 25a4b0d8be303aecf8e50e6beb72317d3f623893 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 13 Jul 2018 15:13:31 +0000 >Subject: [PATCH] Bug 21075: Unit tests > >prove -v t/db_dependent/Reserves/AutoUnsuspendReserves.t >--- > t/db_dependent/Reserves/AutoUnsuspendReserves.t | 57 +++++++++++++++++++++++++ > 1 file changed, 57 insertions(+) > create mode 100644 t/db_dependent/Reserves/AutoUnsuspendReserves.t > >diff --git a/t/db_dependent/Reserves/AutoUnsuspendReserves.t b/t/db_dependent/Reserves/AutoUnsuspendReserves.t >new file mode 100644 >index 0000000..9302da6 >--- /dev/null >+++ b/t/db_dependent/Reserves/AutoUnsuspendReserves.t >@@ -0,0 +1,57 @@ >+#!/usr/bin/perl >+ >+use Modern::Perl; >+use Test::More tests => 1; >+ >+use t::lib::Mocks; >+use t::lib::TestBuilder; >+ >+use C4::Reserves; >+use Koha::Database; >+use Koha::DateUtils; >+use Koha::Holds; >+ >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+ >+subtest 'AutoUnsuspendReserves test' => sub { >+ plan tests => 2; >+ >+ my $builder = t::lib::TestBuilder->new(); >+ >+ my $today = dt_from_string(); >+ my $today_date = output_pref({ dateformat => 'sql' }); >+ my $tomorrow_date = output_pref({ dt => $today->add(days=>1), dateformat=>'sql' }); >+ >+ # Reserve not expired >+ my $reserve1 = $builder->build({ >+ source => 'Reserve', >+ value => { >+ expirationdate => undef, >+ cancellationdate => undef, >+ priority => 5, >+ found => undef, >+ suspend_until => $today_date, >+ }, >+ }); >+ # Reserve expired >+ my $reserve2 = $builder->build({ >+ source => 'Reserve', >+ value => { >+ expirationdate => undef, >+ cancellationdate => undef, >+ priority => 6, >+ found => undef, >+ suspend_until => $tomorrow_date, >+ }, >+ }); >+ >+ AutoUnsuspendReserves(); >+ my $r1 = Koha::Holds->find($reserve1->{reserve_id}); >+ my $r2 = Koha::Holds->find($reserve2->{reserve_id}); >+ ok(!defined($r1->suspend_until), 'Reserve suspended until today should be unsuspended.'); >+ ok(defined($r2->suspend_until), 'Reserve suspended after today should be suspended.'); >+ >+}; >+ >+$schema->storage->txn_rollback; >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21075
:
76953
|
76954
|
76960
|
77423
|
77424