Bugzilla – Attachment 40828 Details for
Bug 14464
Add ability to cancel waiting holds from checkin screen
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14464 - (QA followup) add unit tests
Bug-14464---QA-followup-add-unit-tests.patch (text/plain), 3.50 KB, created by
Jesse Weaver
on 2015-07-07 19:03:52 UTC
(
hide
)
Description:
Bug 14464 - (QA followup) add unit tests
Filename:
MIME Type:
Creator:
Jesse Weaver
Created:
2015-07-07 19:03:52 UTC
Size:
3.50 KB
patch
obsolete
>From 7e85eefb92f65609984c74b5e69a0f2af5ce0514 Mon Sep 17 00:00:00 2001 >From: Jesse Weaver <pianohacker@gmail.com> >Date: Tue, 7 Jul 2015 13:02:18 -0600 >Subject: [PATCH] Bug 14464 - (QA followup) add unit tests > >This followup adds several tests to t/db_dependent/Reserves.t. >--- > C4/Reserves.pm | 2 +- > t/db_dependent/Reserves.t | 81 ++++++++++++++++++++++++++++++++++++++++++++++- > 2 files changed, 81 insertions(+), 2 deletions(-) > >diff --git a/C4/Reserves.pm b/C4/Reserves.pm >index 96570df..2beea87 100644 >--- a/C4/Reserves.pm >+++ b/C4/Reserves.pm >@@ -241,7 +241,7 @@ sub AddReserve { > } > > #} >- ($const eq "o" || $const eq "e") or return; # FIXME: why not have a useful return value? >+ ($const eq "o" || $const eq "e") or return $reserve_id; > $query = qq{ > INSERT INTO reserveconstraints > (borrowernumber,biblionumber,reservedate,biblioitemnumber) >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index fa0cf94..99504b8 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 56; >+use Test::More tests => 63; > > use MARC::Record; > use DateTime::Duration; >@@ -528,6 +528,85 @@ $dbh->do( > ); > ok( !C4::Reserves::OnShelfHoldsAllowed($item, $borrower), "OnShelfHoldsAllowed() disallowed" ); > >+# Tests for bug 14464 >+ >+$dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum)); >+my ( undef, undef, $bz14464_fines ) = GetMemberIssuesAndFines( $borrowernumber ); >+ok( !$bz14464_fines, 'Bug 14464 - No fines at beginning' ); >+ >+# First, test cancelling a reserve when there's no charge configured. >+t::lib::Mocks::mock_preference('ExpireReservesMaxPickUpDelayCharge', 0); >+ >+my $bz14464_reserve = AddReserve( >+ 'CPL', >+ $borrowernumber, >+ $bibnum, >+ 'a', >+ undef, >+ '1', >+ undef, >+ undef, >+ '', >+ $title, >+ $itemnumber, >+ 'W' >+); >+ >+ok( $bz14464_reserve, 'Bug 14464 - 1st reserve correctly created' ); >+ >+CancelReserve({ reserve_id => $bz14464_reserve, charge_cancel_fee => 1 }); >+ >+( undef, undef, $bz14464_fines ) = GetMemberIssuesAndFines( $borrowernumber ); >+ok( !$bz14464_fines, 'Bug 14464 - No fines after cancelling reserve with no charge configured' ); >+ >+# Then, test cancelling a reserve when there's no charge desired. >+t::lib::Mocks::mock_preference('ExpireReservesMaxPickUpDelayCharge', 42); >+ >+$bz14464_reserve = AddReserve( >+ 'CPL', >+ $borrowernumber, >+ $bibnum, >+ 'a', >+ undef, >+ '1', >+ undef, >+ undef, >+ '', >+ $title, >+ $itemnumber, >+ 'W' >+); >+ >+ok( $bz14464_reserve, 'Bug 14464 - 2nd reserve correctly created' ); >+ >+CancelReserve({ reserve_id => $bz14464_reserve }); >+ >+( undef, undef, $bz14464_fines ) = GetMemberIssuesAndFines( $borrowernumber ); >+ok( !$bz14464_fines, 'Bug 14464 - No fines after cancelling reserve with no charge desired' ); >+ >+# Finally, test cancelling a reserve when there's a charge desired and configured. >+$bz14464_reserve = AddReserve( >+ 'CPL', >+ $borrowernumber, >+ $bibnum, >+ 'a', >+ undef, >+ '1', >+ undef, >+ undef, >+ '', >+ $title, >+ $itemnumber, >+ 'W' >+); >+ >+ok( $bz14464_reserve, 'Bug 14464 - 1st reserve correctly created' ); >+ >+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' ); >+ > $dbh->rollback; > > sub count_hold_print_messages { >-- >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 14464
:
40697
|
40752
|
40828
|
40896
|
40897