Bugzilla – Attachment 129150 Details for
Bug 29757
Add filter_by_non_reversible/reversible methods for offsets
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29757: Unit tests
Bug-29757-Unit-tests.patch (text/plain), 2.12 KB, created by
Kyle M Hall (khall)
on 2022-01-07 13:07:27 UTC
(
hide
)
Description:
Bug 29757: Unit tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2022-01-07 13:07:27 UTC
Size:
2.12 KB
patch
obsolete
>From 8c7aa06d095f2c7ee1223be0626c72b5a333cc79 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 22 Dec 2021 16:06:35 -0300 >Subject: [PATCH] Bug 29757: Unit tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > t/db_dependent/Koha/Account/Offsets.t | 34 +++++++++++++++++++++++++-- > 1 file changed, 32 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Koha/Account/Offsets.t b/t/db_dependent/Koha/Account/Offsets.t >index ee942527ee9..9aea5df7ad6 100755 >--- a/t/db_dependent/Koha/Account/Offsets.t >+++ b/t/db_dependent/Koha/Account/Offsets.t >@@ -19,8 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 1; >-use Test::Exception; >+use Test::More tests => 2; > > use Koha::Account::Offsets; > >@@ -73,3 +72,34 @@ subtest 'total() tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'filter_by_non_reversable() and filter_by_reversable() tests' => sub { >+ >+ plan tests => 4; >+ >+ $schema->storage->txn_begin; >+ >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $account = $patron->account; >+ >+ my $manual_fee = $account->add_debit({ amount => 11, interface => 'intranet', type => 'MANUAL' }); >+ >+ $account->pay( { amount => 1, type => 'WRITEOFF' } ); >+ $account->pay( { amount => 2, type => 'DISCOUNT' } ); >+ $account->pay( { amount => 3, type => 'CANCELLATION' } ); >+ $account->pay( { amount => 4, type => 'PAYMENT' } ); >+ $account->pay( { amount => 5, type => 'CREDIT' } ); >+ >+ # non-reversable offsets >+ is( $manual_fee->debit_offsets->filter_by_non_reversable->count, >+ 3, '3 non-reversable offsets' ); >+ is( $manual_fee->debit_offsets->filter_by_non_reversable->total, >+ -6, '-6 the total amount of the non-reversable offsets' ); >+ # reversable offsets >+ is( $manual_fee->debit_offsets->filter_by_reversable->count, >+ 2, 'The right reversable offsets count' ); >+ is( $manual_fee->debit_offsets->filter_by_reversable->total, >+ -5, 'The right total amount of the reversable offsets' ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.30.2
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 29757
:
128865
|
128866
|
128867
|
129150
|
129151
|
129152
|
129178
|
129179
|
129180
|
129296