Bugzilla – Attachment 64223 Details for
Bug 14826
Store account offsets
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14826 - Unit Tests
Bug-14826---Unit-Tests.patch (text/plain), 5.41 KB, created by
Kyle M Hall (khall)
on 2017-06-12 16:59:56 UTC
(
hide
)
Description:
Bug 14826 - Unit Tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2017-06-12 16:59:56 UTC
Size:
5.41 KB
patch
obsolete
>From ef9f8affd19fa3985e8867e5ef3228542e4946da Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 21 Jul 2016 18:32:05 +0000 >Subject: [PATCH] Bug 14826 - Unit Tests > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > t/db_dependent/Accounts.t | 13 +++++++++++-- > t/db_dependent/Circulation.t | 15 ++++++++++++++- > t/db_dependent/Circulation/NoIssuesChargeGuarantees.t | 12 +++++++++++- > 3 files changed, 36 insertions(+), 4 deletions(-) > >diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t >index fcc63d3..34e3d23 100644 >--- a/t/db_dependent/Accounts.t >+++ b/t/db_dependent/Accounts.t >@@ -27,6 +27,7 @@ use t::lib::TestBuilder; > use Koha::Account; > use Koha::Account::Lines; > use Koha::Account::Line; >+use Koha::Account::Offsets; > > BEGIN { > use_ok('C4::Accounts'); >@@ -346,7 +347,7 @@ subtest "Koha::Account::pay writeoff tests" => sub { > > subtest "More Koha::Account::pay tests" => sub { > >- plan tests => 6; >+ plan tests => 8; > > # Create a borrower > my $category = $builder->build({ source => 'Category' })->{ categorycode }; >@@ -376,6 +377,10 @@ subtest "More Koha::Account::pay tests" => sub { > # make the full payment > $account->pay({ lines => [$line], amount => $amount, library_id => $branch, note => 'A payment note' }); > >+ my $offset = Koha::Account::Offsets->search({ debit_id => $accountline->{accountlines_id} })->next(); >+ is( $offset->amount(), '-100.000000', 'Offset amount is -100.00' ); >+ is( $offset->type(), 'Payment', 'Offset type is Payment' ); >+ > my $stat = $schema->resultset('Statistic')->search({ > branch => $branch, > type => 'payment' >@@ -395,7 +400,7 @@ subtest "More Koha::Account::pay tests" => sub { > > subtest "Even more Koha::Account::pay tests" => sub { > >- plan tests => 6; >+ plan tests => 8; > > # Create a borrower > my $category = $builder->build({ source => 'Category' })->{ categorycode }; >@@ -426,6 +431,10 @@ subtest "Even more Koha::Account::pay tests" => sub { > # make the full payment > $account->pay({ lines => [$line], amount => $partialamount, library_id => $branch, note => 'A payment note' }); > >+ my $offset = Koha::Account::Offsets->search( { debit_id => $accountline->{ accountlines_id } } )->next(); >+ is( $offset->amount, '-60.000000', 'Offset amount is -60.00' ); >+ is( $offset->type, 'Payment', 'Offset type is payment' ); >+ > my $stat = $schema->resultset('Statistic')->search({ > branch => $branch, > type => 'payment' >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 9d0f77c..ae39393 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 95; >+use Test::More tests => 102; > > use DateTime; > >@@ -35,6 +35,8 @@ use Koha::DateUtils; > use Koha::Database; > use Koha::IssuingRules; > use Koha::Subscriptions; >+use Koha::Account::Lines; >+use Koha::Account::Offsets; > > my $schema = Koha::Database->schema; > $schema->storage->txn_begin; >@@ -750,6 +752,17 @@ C4::Context->dbh->do("DELETE FROM accountlines"); > } > ); > >+ my $line = Koha::Account::Lines->search({ borrowernumber => $renewing_borrower->{borrowernumber} })->next(); >+ is( $line->accounttype, 'FU', 'Account line type is FU' ); >+ is( $line->lastincrement, '15.000000', 'Account line last increment is 15.00' ); >+ is( $line->amountoutstanding, '15.000000', 'Account line amount outstanding is 15.00' ); >+ is( $line->amount, '15.000000', 'Account line amount is 15.00' ); >+ is( $line->issue_id, $issue->id, 'Account line issue id matches' ); >+ >+ my $offset = Koha::Account::Offsets->search({ debit_id => $line->id })->next(); >+ is( $offset->type, 'Fine', 'Account offset type is Fine' ); >+ is( $offset->amount, '15.000000', 'Account offset amount is 15.00' ); >+ > LostItem( $itemnumber, 1 ); > > my $item = Koha::Database->new()->schema()->resultset('Item')->find($itemnumber); >diff --git a/t/db_dependent/Circulation/NoIssuesChargeGuarantees.t b/t/db_dependent/Circulation/NoIssuesChargeGuarantees.t >index dc2c880..20042b5 100644 >--- a/t/db_dependent/Circulation/NoIssuesChargeGuarantees.t >+++ b/t/db_dependent/Circulation/NoIssuesChargeGuarantees.t >@@ -17,13 +17,15 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 6; > > use t::lib::TestBuilder; > use t::lib::Mocks; > > use C4::Accounts qw( manualinvoice ); > use C4::Circulation qw( CanBookBeIssued ); >+use Koha::Account::Lines; >+use Koha::Account::Offsets; > > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; >@@ -63,6 +65,14 @@ manualinvoice( $guarantee->{borrowernumber}, undef, undef, 'L', 10.00 ); > ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->{barcode} ); > is( $issuingimpossible->{DEBT_GUARANTEES} + 0, '10.00' + 0, "Patron cannot check out item due to debt for guarantee" ); > >+my $accountline = Koha::Account::Lines->search({ borrowernumber => $guarantee->{borrowernumber} })->next(); >+is( $accountline->amountoutstanding, "10.000000", "Found 10.00 amount outstanding" ); >+is( $accountline->accounttype, "L", "Account type is L" ); >+ >+my $offset = Koha::Account::Offsets->search({ debit_id => $accountline->id })->next(); >+is( $offset->type, 'Manual Debit', 'Got correct offset type' ); >+is( $offset->amount, '10.000000', 'Got amount of $10.00' ); >+ > $schema->storage->txn_rollback; > > 1; >-- >2.1.4
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 14826
:
53318
|
53319
|
53320
|
53321
|
53324
|
53326
|
53602
|
53603
|
53604
|
53605
|
53606
|
53607
|
59254
|
59255
|
59256
|
59257
|
59258
|
60270
|
60271
|
60272
|
60273
|
60274
|
60275
|
60276
|
60277
|
60278
|
60439
|
60440
|
60441
|
60442
|
60443
|
60444
|
60445
|
60446
|
64051
|
64052
|
64053
|
64054
|
64055
|
64056
|
64057
|
64058
|
64059
|
64217
|
64220
|
64222
|
64223
|
64224
|
64225
|
64226
|
64227
|
64228
|
65459
|
65460
|
65461
|
65462
|
65463
|
65464
|
65465
|
65466
|
65467
|
65642
|
65643
|
65644
|
65645
|
65646
|
65647
|
65648
|
65649
|
65650
|
65651
|
65652
|
66387
|
66388
|
66389
|
66390
|
66391
|
66392
|
66393
|
66394
|
66395
|
66396
|
66397
|
66716
|
67453
|
67454
|
67455
|
67456
|
67457
|
67458
|
67459
|
67460
|
67461
|
67462
|
67463
|
67464
|
67465
|
67936
|
67937
|
67938
|
67939
|
67940
|
67941
|
67942
|
67943
|
67944
|
67945
|
67946
|
67947
|
67948
|
67949
|
68018
|
68019
|
68020
|
68021
|
68022
|
68023
|
68024
|
68025
|
68026
|
68027
|
68028
|
68029
|
68030
|
68031
|
68032
|
68334
|
68383