Bugzilla – Attachment 41808 Details for
Bug 14526
MoveReserve should look at future holds too
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14526: Add some unit tests for MoveReserve
Bug-14526-Add-some-unit-tests-for-MoveReserve.patch (text/plain), 4.55 KB, created by
Marcel de Rooy
on 2015-08-24 06:42:00 UTC
(
hide
)
Description:
Bug 14526: Add some unit tests for MoveReserve
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2015-08-24 06:42:00 UTC
Size:
4.55 KB
patch
obsolete
>From 41658fceea58d2279b509278ecf927efb8b4a7f0 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 15 Jul 2015 14:17:11 +0200 >Subject: [PATCH] Bug 14526: Add some unit tests for MoveReserve >Content-Type: text/plain; charset=utf-8 > >The change in MoveReserve from the previous patch begs for a test. >Here we add some to Reserves.t. >In all six tests we place a hold, move it and check the reserves again. >Depending on the status of ConfirmFutureHolds, and the reservedate the >hold should be moved or not. > >Test plan: >Run the unit test. >Bonus: If you run Reserves.t by applying this patch but without the first >patch that changed MoveReserve, tests 60 and 61 should fail: > not ok 60 - MoveReserve filled future hold now > not ok 61 - MoveReserve filled future waiting hold now >This may further illustrate the need of the first patch. >--- > t/db_dependent/Reserves.t | 59 ++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 58 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index 3ed904c..00526cc 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 65; >+use Test::More tests => 71; > > use MARC::Record; > use DateTime::Duration; >@@ -612,6 +612,63 @@ CancelReserve({ reserve_id => $bz14464_reserve, charge_cancel_fee => 1 }); > ( undef, undef, $bz14464_fines ) = GetMemberIssuesAndFines( $borrowernumber ); > is( int( $bz14464_fines ), 42, 'Bug 14464 - Fine applied after cancelling reserve with charge desired and configured' ); > >+# tests for MoveReserve in relation to ConfirmFutureHolds (BZ 14526) >+# hold from A pos 1, today, no fut holds: MoveReserve should fill it >+$dbh->do('DELETE FROM reserves', undef, ($bibnum)); >+C4::Context->set_preference('ConfirmFutureHolds', 0); >+C4::Context->set_preference('AllowHoldDateInFuture', 1); >+AddReserve('CPL', $borrowernumber, $item_bibnum, >+ $constraint, $bibitems, 1, undef, $expdate, $notes, >+ $title, $checkitem, ''); >+MoveReserve( $itemnumber, $borrowernumber ); >+($status)=CheckReserves( $itemnumber ); >+is( $status, '', 'MoveReserve filled hold'); >+# hold from A waiting, today, no fut holds: MoveReserve should fill it >+AddReserve('CPL', $borrowernumber, $item_bibnum, >+ $constraint, $bibitems, 1, undef, $expdate, $notes, >+ $title, $checkitem, 'W'); >+MoveReserve( $itemnumber, $borrowernumber ); >+($status)=CheckReserves( $itemnumber ); >+is( $status, '', 'MoveReserve filled waiting hold'); >+# hold from A pos 1, tomorrow, no fut holds: not filled >+$resdate= dt_from_string(); >+$resdate->add_duration(DateTime::Duration->new(days => 1)); >+$resdate=output_pref($resdate); >+AddReserve('CPL', $borrowernumber, $item_bibnum, >+ $constraint, $bibitems, 1, $resdate, $expdate, $notes, >+ $title, $checkitem, ''); >+MoveReserve( $itemnumber, $borrowernumber ); >+($status)=CheckReserves( $itemnumber, undef, 1 ); >+is( $status, 'Reserved', 'MoveReserve did not fill future hold'); >+$dbh->do('DELETE FROM reserves', undef, ($bibnum)); >+# hold from A pos 1, tomorrow, fut holds=2: MoveReserve should fill it >+C4::Context->set_preference('ConfirmFutureHolds', 2); >+AddReserve('CPL', $borrowernumber, $item_bibnum, >+ $constraint, $bibitems, 1, $resdate, $expdate, $notes, >+ $title, $checkitem, ''); >+MoveReserve( $itemnumber, $borrowernumber ); >+($status)=CheckReserves( $itemnumber, undef, 2 ); >+is( $status, '', 'MoveReserve filled future hold now'); >+# hold from A waiting, tomorrow, fut holds=2: MoveReserve should fill it >+AddReserve('CPL', $borrowernumber, $item_bibnum, >+ $constraint, $bibitems, 1, $resdate, $expdate, $notes, >+ $title, $checkitem, 'W'); >+MoveReserve( $itemnumber, $borrowernumber ); >+($status)=CheckReserves( $itemnumber, undef, 2 ); >+is( $status, '', 'MoveReserve filled future waiting hold now'); >+# hold from A pos 1, today+3, fut holds=2: MoveReserve should not fill it >+$resdate= dt_from_string(); >+$resdate->add_duration(DateTime::Duration->new(days => 3)); >+$resdate=output_pref($resdate); >+AddReserve('CPL', $borrowernumber, $item_bibnum, >+ $constraint, $bibitems, 1, $resdate, $expdate, $notes, >+ $title, $checkitem, ''); >+MoveReserve( $itemnumber, $borrowernumber ); >+($status)=CheckReserves( $itemnumber, undef, 3 ); >+is( $status, 'Reserved', 'MoveReserve did not fill future hold of 3 days'); >+$dbh->do('DELETE FROM reserves', undef, ($bibnum)); >+ >+# we reached the finish > $dbh->rollback; > > sub count_hold_print_messages { >-- >1.7.10.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 14526
:
41010
|
41011
|
41241
|
41807
|
41808
|
42014
|
42100
|
42101
|
42102
|
42144
|
42150
|
42151
|
42152