Bugzilla – Attachment 31321 Details for
Bug 12205
It should be possible for Holds charges to count towards blocking checkout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12205: (regression tests) HoldsInNoissuesCharge controls GetMemberAccountBalance behaviour regarding hold charges
Bug-12205-regression-tests-HoldsInNoissuesCharge-c.patch (text/plain), 2.51 KB, created by
Tomás Cohen Arazi (tcohen)
on 2014-09-02 13:41:25 UTC
(
hide
)
Description:
Bug 12205: (regression tests) HoldsInNoissuesCharge controls GetMemberAccountBalance behaviour regarding hold charges
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2014-09-02 13:41:25 UTC
Size:
2.51 KB
patch
obsolete
>From 5faef12f68671a0e6460e219c98c86ff86e478be Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Tue, 2 Sep 2014 10:40:32 -0300 >Subject: [PATCH] Bug 12205: (regression tests) HoldsInNoissuesCharge controls > GetMemberAccountBalance behaviour regarding hold charges > >Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com> >--- > t/db_dependent/Members.t | 35 ++++++++++++++++++++++++++++++++++- > 1 file changed, 34 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Members.t b/t/db_dependent/Members.t >index 36f7ccc..592c463 100755 >--- a/t/db_dependent/Members.t >+++ b/t/db_dependent/Members.t >@@ -17,7 +17,8 @@ > > use Modern::Perl; > >-use Test::More tests => 55; >+use Test::More tests => 56; >+use Test::MockModule; > use Data::Dumper; > use C4::Context; > >@@ -290,6 +291,38 @@ is( Check_Userid( 'tomasito', $new_borrowernumber ), 0, > is( Check_Userid( C4::Context->config('user'), '' ), 0, > 'Check_Userid should return 0 for the DB user (Bug 12226)'); > >+subtest 'GetMemberAccountBalance' => sub { >+ >+ plan tests => 6; >+ >+ my $members_mock = new Test::MockModule('C4::Members'); >+ $members_mock->mock( 'GetMemberAccountRecords', sub { >+ my @accountlines = ( >+ { amountoutstanding => '7', accounttype => 'Rent' }, >+ { amountoutstanding => '5', accounttype => 'Res' }, >+ { amountoutstanding => '3', accounttype => 'Pay' } ); >+ return ( 15, \@accountlines ); >+ }); >+ >+ # do not count holds charges >+ C4::Context->set_preference( 'HoldsInNoissuesCharge', '1' ); >+ C4::Context->set_preference( 'ManInvInNoissuesCharge', '0' ); >+ my ($total, $total_minus_charges, >+ $other_charges) = C4::Members::GetMemberAccountBalance(123); >+ is( $total, 15 , "Total calculated correctly"); >+ is( $total_minus_charges, 15, "Holds charges are not count if HoldsInNoissuesCharge=1"); >+ is( $other_charges, 0, "Holds charges are not considered if HoldsInNoissuesCharge=1"); >+ >+ C4::Context->set_preference( 'HoldsInNoissuesCharge', '0' ); >+ ($total, $total_minus_charges, >+ $other_charges) = C4::Members::GetMemberAccountBalance(123); >+ is( $total, 15 , "Total calculated correctly"); >+ is( $total_minus_charges, 10, "Holds charges are count if HoldsInNoissuesCharge=0"); >+ is( $other_charges, 5, "Holds charges are considered if HoldsInNoissuesCharge=1"); >+ >+ $dbh->rollback(); >+}; >+ > sub _find_member { > my ($resultset) = @_; > my $found = $resultset && grep( { $_->{cardnumber} && $_->{cardnumber} eq $CARDNUMBER } @$resultset ); >-- >1.9.1
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 12205
:
28001
|
28762
|
28772
| 31321