Bugzilla – Attachment 73655 Details for
Bug 20325
C4::Accounts::purge_zero_balance_fees does not check account_offsets
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20325: Move tests to a subtest
Bug-20325-Move-tests-to-a-subtest.patch (text/plain), 5.69 KB, created by
Jonathan Druart
on 2018-04-04 18:29:07 UTC
(
hide
)
Description:
Bug 20325: Move tests to a subtest
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-04-04 18:29:07 UTC
Size:
5.69 KB
patch
obsolete
>From f34eacc888a3de0187a03f88a512411146b94536 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 4 Apr 2018 15:19:54 -0300 >Subject: [PATCH] Bug 20325: Move tests to a subtest > >--- > t/db_dependent/Accounts.t | 79 ++++++++++++++++++++++++++++------------------- > 1 file changed, 47 insertions(+), 32 deletions(-) > >diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t >index 426a4a4ecd..b843b40fd1 100644 >--- a/t/db_dependent/Accounts.t >+++ b/t/db_dependent/Accounts.t >@@ -18,7 +18,7 @@ > > use Modern::Perl; > >-use Test::More tests => 30; >+use Test::More tests => 25; > use Test::MockModule; > use Test::Warn; > >@@ -134,37 +134,6 @@ for my $data (@test_data) { > } > > $dbh->do(q|DELETE FROM accountlines|); >-my $debit = Koha::Account::Line->new({ borrowernumber => $borrower->id, date => '1900-01-01', amountoutstanding => 0 })->store(); >-my $credit = Koha::Account::Line->new({ borrowernumber => $borrower->id, date => '1900-01-01', amountoutstanding => -5 })->store(); >-my $offset = Koha::Account::Offset->new({ credit_id => $credit->id, debit_id => $debit->id, type => 'Payment' })->store(); >-purge_zero_balance_fees( 1 ); >-my $debit_2 = Koha::Account::Lines->find( $debit->id ); >-my $credit_2 = Koha::Account::Lines->find( $credit->id ); >-ok( $debit_2, 'Debit was correctly not deleted when credit has balance' ); >-ok( $credit_2, 'Credit was correctly not deleted when credit has balance' ); >- >-$dbh->do(q|DELETE FROM accountlines|); >-$debit = Koha::Account::Line->new({ borrowernumber => $borrower->id, date => '1900-01-01', amountoutstanding => 5 })->store(); >-$credit = Koha::Account::Line->new({ borrowernumber => $borrower->id, date => '1900-01-01', amountoutstanding => 0 })->store(); >-$offset = Koha::Account::Offset->new({ credit_id => $credit->id, debit_id => $debit->id, type => 'Payment' })->store(); >-purge_zero_balance_fees( 1 ); >-$debit_2 = $credit_2 = undef; >-$debit_2 = Koha::Account::Lines->find( $debit->id ); >-$credit_2 = Koha::Account::Lines->find( $credit->id ); >-ok( $debit_2, 'Debit was correctly not deleted when debit has balance' ); >-ok( $credit_2, 'Credit was correctly not deleted when debit has balance' ); >- >-$dbh->do(q|DELETE FROM accountlines|); >-$debit = Koha::Account::Line->new({ borrowernumber => $borrower->id, date => '1900-01-01', amountoutstanding => 0 })->store(); >-$credit = Koha::Account::Line->new({ borrowernumber => $borrower->id, date => '1900-01-01', amountoutstanding => 0 })->store(); >-$offset = Koha::Account::Offset->new({ credit_id => $credit->id, debit_id => $debit->id, type => 'Payment' })->store(); >-purge_zero_balance_fees( 1 ); >-$debit_2 = Koha::Account::Lines->find( $debit->id ); >-$credit_2 = Koha::Account::Lines->find( $credit->id ); >-ok( !$debit_2, 'Debit was correctly deleted' ); >-ok( !$credit_2, 'Credit was correctly deleted' ); >- >-$dbh->do(q|DELETE FROM accountlines|); > > subtest "Koha::Account::pay tests" => sub { > >@@ -828,4 +797,50 @@ subtest "Koha::Account::non_issues_charges tests" => sub { > is( $other_charges, 0, 'If 1|1|1 there should not have any other charges' ); > }; > >+subtest "Koha::Account::non_issues_charges tests" => sub { >+ plan tests => 6; >+ >+ my $patron = $builder->build_object( >+ { >+ class => "Koha::Patrons", >+ value => { >+ firstname => 'Test', >+ surname => 'Patron', >+ categorycode => $categorycode, >+ branchcode => $branchcode >+ } >+ } >+ ); >+ >+ my $debit = Koha::Account::Line->new({ borrowernumber => $patron->id, date => '1900-01-01', amountoutstanding => 0 })->store(); >+ my $credit = Koha::Account::Line->new({ borrowernumber => $patron->id, date => '1900-01-01', amountoutstanding => -5 })->store(); >+ my $offset = Koha::Account::Offset->new({ credit_id => $credit->id, debit_id => $debit->id, type => 'Payment' })->store(); >+ purge_zero_balance_fees( 1 ); >+ my $debit_2 = Koha::Account::Lines->find( $debit->id ); >+ my $credit_2 = Koha::Account::Lines->find( $credit->id ); >+ ok( $debit_2, 'Debit was correctly not deleted when credit has balance' ); >+ ok( $credit_2, 'Credit was correctly not deleted when credit has balance' ); >+ >+ $dbh->do(q|DELETE FROM accountlines WHERE borrowernumber=?|, undef, $patron->id); >+ $debit = Koha::Account::Line->new({ borrowernumber => $patron->id, date => '1900-01-01', amountoutstanding => 5 })->store(); >+ $credit = Koha::Account::Line->new({ borrowernumber => $patron->id, date => '1900-01-01', amountoutstanding => 0 })->store(); >+ $offset = Koha::Account::Offset->new({ credit_id => $credit->id, debit_id => $debit->id, type => 'Payment' })->store(); >+ purge_zero_balance_fees( 1 ); >+ $debit_2 = $credit_2 = undef; >+ $debit_2 = Koha::Account::Lines->find( $debit->id ); >+ $credit_2 = Koha::Account::Lines->find( $credit->id ); >+ ok( $debit_2, 'Debit was correctly not deleted when debit has balance' ); >+ ok( $credit_2, 'Credit was correctly not deleted when debit has balance' ); >+ >+ $dbh->do(q|DELETE FROM accountlines WHERE borrowernumber=?|, undef, $patron->id); >+ $debit = Koha::Account::Line->new({ borrowernumber => $patron->id, date => '1900-01-01', amountoutstanding => 0 })->store(); >+ $credit = Koha::Account::Line->new({ borrowernumber => $patron->id, date => '1900-01-01', amountoutstanding => 0 })->store(); >+ $offset = Koha::Account::Offset->new({ credit_id => $credit->id, debit_id => $debit->id, type => 'Payment' })->store(); >+ purge_zero_balance_fees( 1 ); >+ $debit_2 = Koha::Account::Lines->find( $debit->id ); >+ $credit_2 = Koha::Account::Lines->find( $credit->id ); >+ ok( !$debit_2, 'Debit was correctly deleted' ); >+ ok( !$credit_2, 'Credit was correctly deleted' ); >+}; >+ > 1; >-- >2.11.0
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 20325
:
73350
|
73516
|
73599
|
73603
| 73655 |
73656
|
73678