Bug 12001: Move GetMemberAccountBalance to Koha::Account->non_issues_charges
[srvgit] / t / db_dependent / Members.t
index ac928b2..c7bc6b3 100755 (executable)
@@ -17,7 +17,7 @@
 
 use Modern::Perl;
 
-use Test::More tests => 62;
+use Test::More tests => 60;
 use Test::MockModule;
 use Test::Exception;
 
@@ -373,72 +373,6 @@ ok( $borrower->{userid},  'A userid should have been generated correctly' );
 is( Check_Userid( C4::Context->config('user'), '' ), 0,
     'Check_Userid should return 0 for the DB user (Bug 12226)');
 
-subtest 'GetMemberAccountRecords' => sub {
-
-    plan tests => 2;
-
-    my $borrowernumber = $builder->build({ source => 'Borrower' })->{ borrowernumber };
-    my $accountline_1  = $builder->build({
-        source => 'Accountline',
-        value  => {
-            borrowernumber    => $borrowernumber,
-            amountoutstanding => 64.60
-        }
-    });
-
-    my ($total,undef,undef) = GetMemberAccountRecords( $borrowernumber );
-    is( $total , 64.60, "Rounding works correctly in total calculation (single value)" );
-
-    my $accountline_2 = $builder->build({
-        source => 'Accountline',
-        value  => {
-            borrowernumber    => $borrowernumber,
-            amountoutstanding => 10.65
-        }
-    });
-
-    ($total,undef,undef) = GetMemberAccountRecords( $borrowernumber );
-    is( $total , 75.25, "Rounding works correctly in total calculation (multiple values)" );
-
-};
-
-subtest 'GetMemberAccountBalance' => sub {
-
-    plan tests => 6;
-
-    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 );
-        }
-    });
-
-    # do not count holds charges
-    t::lib::Mocks::mock_preference( 'HoldsInNoissuesCharge', '1' );
-    t::lib::Mocks::mock_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");
-
-    t::lib::Mocks::mock_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");
-};
-
 subtest 'purgeSelfRegistration' => sub {
     plan tests => 2;