Bugzilla – Attachment 30401 Details for
Bug 8735
Expire holds waiting only on days the library is open
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8735 [QA Followup] - Add Unit Tests
Bug-8735-QA-Followup---Add-Unit-Tests.patch (text/plain), 2.81 KB, created by
Marcel de Rooy
on 2014-07-31 13:37:05 UTC
(
hide
)
Description:
Bug 8735 [QA Followup] - Add Unit Tests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2014-07-31 13:37:05 UTC
Size:
2.81 KB
patch
obsolete
>From aa83c423a7e8ddbf1a5f8f58387ed5400cce9e97 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 17 Apr 2014 14:33:16 -0400 >Subject: [PATCH] Bug 8735 [QA Followup] - Add Unit Tests >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/Holds.t | 39 ++++++++++++++++++++++++++++++++++++++- > 1 files changed, 38 insertions(+), 1 deletions(-) > >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index d51dfdb..84f246f 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -6,11 +6,12 @@ use t::lib::Mocks; > use C4::Context; > use C4::Branch; > >-use Test::More tests => 32; >+use Test::More tests => 35; > use MARC::Record; > use C4::Biblio; > use C4::Items; > use C4::Members; >+use C4::Calendar; > > BEGIN { > use FindBin; >@@ -324,6 +325,42 @@ ok( > "cannot request item if policy that matches on bib-level item type forbids it (bug 9532)" > ); > >+# Test CancelExpiredReserves >+C4::Context->set_preference('ExpireReservesMaxPickUpDelay', 1); >+C4::Context->set_preference('ReservesMaxPickUpDelay', 1); >+ >+my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = localtime(time); >+$year += 1900; >+$mon += 1; >+$reserves = $dbh->selectall_arrayref('SELECT * FROM reserves', { Slice => {} }); >+$reserve = $reserves->[0]; >+my $calendar = C4::Calendar->new(branchcode => $reserve->{branchcode}); >+$calendar->insert_single_holiday( >+ day => $mday, >+ month => $mon, >+ year => $year, >+ title => 'Test', >+ description => 'Test', >+); >+$reserve_id = $reserve->{reserve_id}; >+$dbh->do("UPDATE reserves SET waitingdate = DATE_SUB( NOW(), INTERVAL 5 DAY ), found = 'W', priority = 0 WHERE reserve_id = ?", undef, $reserve_id ); >+C4::Context->set_preference('ExpireReservesOnHolidays', 0); >+CancelExpiredReserves(); >+my $count = $dbh->selectrow_array("SELECT COUNT(*) FROM reserves WHERE reserve_id = ?", undef, $reserve_id ); >+is( $count, 1, "Waiting reserve beyond max pickup delay *not* canceled on holiday" ); >+C4::Context->set_preference('ExpireReservesOnHolidays', 1); >+CancelExpiredReserves(); >+$count = $dbh->selectrow_array("SELECT COUNT(*) FROM reserves WHERE reserve_id = ?", undef, $reserve_id ); >+is( $count, 0, "Waiting reserve beyond max pickup delay canceled on holiday" ); >+ >+# Test expirationdate >+$reserve = $reserves->[1]; >+$reserve_id = $reserve->{reserve_id}; >+$dbh->do("UPDATE reserves SET expirationdate = DATE_SUB( NOW(), INTERVAL 1 DAY ) WHERE reserve_id = ?", undef, $reserve_id ); >+CancelExpiredReserves(); >+$count = $dbh->selectrow_array("SELECT COUNT(*) FROM reserves WHERE reserve_id = ?", undef, $reserve_id ); >+is( $count, 0, "Reserve with manual expiration date canceled correctly" ); >+ > # Helper method to set up a Biblio. > sub create_helper_biblio { > my $itemtype = shift; >-- >1.7.7.6
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 8735
:
12019
|
12020
|
13364
|
13365
|
15074
|
15075
|
15096
|
15097
|
15098
|
16508
|
17625
|
17892
|
17893
|
24598
|
24599
|
24898
|
24899
|
27268
|
28660
|
28661
|
28662
|
28663
|
30395
|
30396
|
30397
|
30398
|
30399
|
30400
| 30401 |
30402