Bugzilla – Attachment 119202 Details for
Bug 27971
The VOID method should be updated to respect double-entry accounting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27971: Enhance unit tests
Bug-27971-Enhance-unit-tests.patch (text/plain), 4.26 KB, created by
Martin Renvoize (ashimema)
on 2021-04-06 11:09:57 UTC
(
hide
)
Description:
Bug 27971: Enhance unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-04-06 11:09:57 UTC
Size:
4.26 KB
patch
obsolete
>From 2982e8211b669fe01d7d3145398ecff4952241d4 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 17 Mar 2021 16:23:56 +0000 >Subject: [PATCH] Bug 27971: Enhance unit tests > >This patch adds some additional unit tests for extra functionality >included with this patchset. > >Test plan >1/ t/db_dependent/Koha/Account/Line.t should pass > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Account/Line.t | 51 +++++++++++++++++++++++------- > 1 file changed, 40 insertions(+), 11 deletions(-) > >diff --git a/t/db_dependent/Koha/Account/Line.t b/t/db_dependent/Koha/Account/Line.t >index 64a4b49bc4..00a462fd71 100755 >--- a/t/db_dependent/Koha/Account/Line.t >+++ b/t/db_dependent/Koha/Account/Line.t >@@ -714,7 +714,7 @@ subtest 'credits() and debits() tests' => sub { > > subtest "void() tests" => sub { > >- plan tests => 16; >+ plan tests => 23; > > $schema->storage->txn_begin; > >@@ -772,9 +772,35 @@ subtest "void() tests" => sub { > is( $line1->amountoutstanding+0, 0, 'First fee has amount outstanding of 0' ); > is( $line2->amountoutstanding+0, 0, 'Second fee has amount outstanding of 0' ); > >- my $ret = $account_payment->void({ interface => 'test' }); >+ throws_ok { >+ $line1->void( { interface => 'test' } ); >+ } >+ 'Koha::Exceptions::Account::IsNotCredit', >+ '->void() can only be used with credits'; >+ >+ throws_ok { >+ $account_payment->void(); >+ } >+ 'Koha::Exceptions::MissingParameter', >+ "->void() requires the `interface` parameter is passed"; >+ >+ throws_ok { >+ $account_payment->void( { interface => 'intranet' } ); >+ } >+ 'Koha::Exceptions::MissingParameter', >+ "->void() requires the `staff_id` parameter is passed when `interface` equals 'intranet'"; >+ throws_ok { >+ $account_payment->void( { interface => 'intranet', staff_id => $borrower->borrowernumber } ); >+ } >+ 'Koha::Exceptions::MissingParameter', >+ "->void() requires the `branch` parameter is passed when `interface` equals 'intranet'"; >+ >+ my $void = $account_payment->void({ interface => 'test' }); > >- is( ref($ret), 'Koha::Account::Line', 'Void returns the account line' ); >+ is( ref($void), 'Koha::Account::Line', 'Void returns the account line' ); >+ is( $void->debit_type_code, 'VOID', 'Void returns the VOID account line' ); >+ is( $void->manager_id, undef, 'Void proceeds without manager_id OK if interface is not "intranet"' ); >+ is( $void->branchcode, undef, 'Void proceeds without branchcode OK if interface is not "intranet"' ); > is( $account->balance(), 30, "Account balance is again 30" ); > > $account_payment->_result->discard_changes(); >@@ -783,19 +809,22 @@ subtest "void() tests" => sub { > > is( $account_payment->credit_type_code, 'PAYMENT', 'Voided payment credit_type_code is still PAYMENT' ); > is( $account_payment->status, 'VOID', 'Voided payment status is VOID' ); >- is( $account_payment->amount+0, -30, 'Voided payment amount is -30' ); >+ is( $account_payment->amount+0, -30, 'Voided payment amount is still -30' ); > is( $account_payment->amountoutstanding+0, 0, 'Voided payment amount outstanding is 0' ); > > is( $line1->amountoutstanding+0, 10, 'First fee again has amount outstanding of 10' ); > is( $line2->amountoutstanding+0, 20, 'Second fee again has amount outstanding of 20' ); > >- # Accountlines that are not credits should be un-voidable >- my $line1_pre = $line1->unblessed(); >- $ret = $line1->void({ interface => 'test' }); >- $line1->_result->discard_changes(); >- my $line1_post = $line1->unblessed(); >- is( $ret, undef, 'Attempted void on non-credit returns undef' ); >- is_deeply( $line1_pre, $line1_post, 'Non-credit account line cannot be voided' ); >+ my $credit2 = $account->add_credit( { interface => 'test', amount => 10 } ); >+ $void = $credit2->void( >+ { >+ interface => 'intranet', >+ staff_id => $borrower->borrowernumber, >+ branch => $branchcode >+ } >+ ); >+ is( $void->manager_id, $borrower->borrowernumber, "->void stores the manager_id when it's passed"); >+ is( $void->branchcode, $branchcode, "->void stores the branchcode when it's passed"); > > $schema->storage->txn_rollback; > }; >-- >2.20.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 27971
:
118358
|
118419
|
118420
|
118422
|
118423
|
118504
|
118505
|
118613
|
118614
|
118624
|
118625
|
119201
| 119202