Bugzilla – Attachment 27268 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.89 KB, created by
Kyle M Hall (khall)
on 2014-04-17 18:33:39 UTC
(
hide
)
Description:
Bug 8735 [QA Followup] - Add Unit Tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-04-17 18:33:39 UTC
Size:
2.89 KB
patch
obsolete
>From 0c25bc631ec3bd12b9895ca56ba138585da69138 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 > >--- > t/db_dependent/Holds.t | 38 +++++++++++++++++++++++++++++++++++++- > 1 files changed, 37 insertions(+), 1 deletions(-) > >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index d72a81d..30b03a9 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 => 29; >+use Test::More tests => 32; > use MARC::Record; > use C4::Biblio; > use C4::Items; > use C4::Members; >+use C4::Calendar; > > BEGIN { > use FindBin; >@@ -286,6 +287,41 @@ C4::Context->set_preference( 'AllowHoldsOnDamagedItems', 0 ); > ok( !CanItemBeReserved( $borrowernumbers[0], $itemnumber), "Patron cannot reserve damaged item with AllowHoldsOnDamagedItems disabled" ); > ok( !defined( ( CheckReserves($itemnumber) )[1] ), "Hold cannot be trapped for damaged item with AllowHoldsOnDamagedItems disabled" ); > >+# 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 2 DAY ) 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 { >-- >1.7.2.5
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