From c9b3317512633456f7eec1bf14fa57bfe60f4621 Mon Sep 17 00:00:00 2001 From: Mason James Date: Sat, 17 Jan 2015 19:00:12 +1300 Subject: [PATCH] Revert "Bug 12868: Improving t/db_dependent/Member.t" This reverts commit b8ef9e288548ea5247c120df4c8012f0df7a7be4. --- t/db_dependent/Members.t | 52 ---------------------------------------- 1 file changed, 52 deletions(-) diff --git a/t/db_dependent/Members.t b/t/db_dependent/Members.t index 22391f54e7..dafa91ceac 100755 --- a/t/db_dependent/Members.t +++ b/t/db_dependent/Members.t @@ -247,58 +247,6 @@ 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 => 10; - - my $members_mock = new Test::MockModule('C4::Members'); - $members_mock->mock( 'GetMemberAccountRecords', sub { - my ($borrowernumber) = @_; - if ($borrowernumber) { - my @accountlines = ( - { amountoutstanding => '7', accounttype => 'Rent' }, - { amountoutstanding => '5', accounttype => 'Res' }, - { amountoutstanding => '3', accounttype => 'Pay' } ); - return ( 15, \@accountlines ); - } - else { - my @accountlines; - return ( 0, \@accountlines ); - } - }); - - my $person = GetMemberDetails(undef,undef); - ok( !$person , 'Expected no member details from undef,undef' ); - $person = GetMemberDetails(undef,'987654321'); - is( $person->{amountoutstanding}, 15, - 'Expected 15 outstanding for cardnumber.'); - $borrowernumber = $person->{borrowernumber}; - $person = GetMemberDetails($borrowernumber,undef); - is( $person->{amountoutstanding}, 15, - 'Expected 15 outstanding for borrowernumber.'); - $person = GetMemberDetails($borrowernumber,'987654321'); - is( $person->{amountoutstanding}, 15, - 'Expected 15 outstanding for both borrowernumber and cardnumber.'); - - # 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 ); -- 2.39.5