Bugzilla – Attachment 76380 Details for
Bug 20990
Add Koha::Account::outstanding_credits
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20990: Unit tests for Koha::Account->outstanding_credits
Bug-20990-Unit-tests-for-KohaAccount-outstandingcr.patch (text/plain), 1.84 KB, created by
Tomás Cohen Arazi (tcohen)
on 2018-06-25 14:18:17 UTC
(
hide
)
Description:
Bug 20990: Unit tests for Koha::Account->outstanding_credits
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2018-06-25 14:18:17 UTC
Size:
1.84 KB
patch
obsolete
>From c5271508c968e397e89db09d5bb31318e1d98472 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 25 Jun 2018 11:15:08 -0300 >Subject: [PATCH] Bug 20990: Unit tests for Koha::Account->outstanding_credits > >--- > t/db_dependent/Koha/Account.t | 31 ++++++++++++++++++++++++++++++- > 1 file changed, 30 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Account.t b/t/db_dependent/Koha/Account.t >index 95d096c2a0..86dac361b9 100755 >--- a/t/db_dependent/Koha/Account.t >+++ b/t/db_dependent/Koha/Account.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; > > use Koha::Account; > use Koha::Account::Lines; >@@ -60,6 +60,35 @@ subtest 'outstanding_debits() tests' => sub { > $schema->storage->txn_rollback; > }; > >+subtest 'outstanding_credits() tests' => sub { >+ >+ plan tests => 5; >+ >+ $schema->storage->txn_begin; >+ >+ my $patron = $builder->build_object({ class => 'Koha::Patrons' }); >+ my $account = Koha::Account->new({ patron_id => $patron->id }); >+ >+ my @generated_lines; >+ push @generated_lines, $account->add_credit({ amount => 1 }); >+ push @generated_lines, $account->add_credit({ amount => 2 }); >+ push @generated_lines, $account->add_credit({ amount => 3 }); >+ push @generated_lines, $account->add_credit({ amount => 4 }); >+ >+ my ( $total, $lines ) = $account->outstanding_credits(); >+ >+ is( $total, -10, 'Outstandig debits total is correctly calculated' ); >+ >+ my $i = 0; >+ foreach my $line ( @{ $lines->as_list } ) { >+ my $fetched_line = Koha::Account::Lines->find( $generated_lines[$i]->id ); >+ is_deeply( $line->unblessed, $fetched_line->unblessed, "Fetched line matches the generated one ($i)" ); >+ $i++; >+ } >+ >+ $schema->storage->txn_rollback; >+}; >+ > subtest 'add_credit() tests' => sub { > > plan tests => 15; >-- >2.18.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 20990
:
76380
|
76381
|
76405
|
76406
|
76407
|
76446
|
76447
|
76448
|
76449
|
76525
|
76640
|
76739
|
76740
|
76741
|
76742
|
76743