Bugzilla – Attachment 54263 Details for
Bug 7595
Add branchcode to accountlines
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7595 - Unit Tests
Bug-7595---Unit-Tests.patch (text/plain), 3.58 KB, created by
Kyle M Hall (khall)
on 2016-08-10 10:50:19 UTC
(
hide
)
Description:
Bug 7595 - Unit Tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2016-08-10 10:50:19 UTC
Size:
3.58 KB
patch
obsolete
>From 83fb8bad30acbe751d80d6917570c640c8c7514b Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 27 Jun 2016 18:41:32 +0000 >Subject: [PATCH] Bug 7595 - Unit Tests > >--- > t/db_dependent/Accounts.t | 52 +++++++++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 50 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t >index fb0ffb7..358058a 100644 >--- a/t/db_dependent/Accounts.t >+++ b/t/db_dependent/Accounts.t >@@ -18,16 +18,19 @@ > > use Modern::Perl; > >-use Test::More tests => 19; >+use Test::More tests => 33; > use Test::MockModule; > use Test::Warn; > > use t::lib::TestBuilder; > >+use C4::Circulation; >+ > BEGIN { > use_ok('C4::Accounts'); > use_ok('Koha::Object'); > use_ok('Koha::Patron'); >+ use_ok('Koha::Account::Lines'); > use_ok('Data::Dumper'); > } > >@@ -60,7 +63,6 @@ $dbh->do(q|DELETE FROM issues|); > $dbh->do(q|DELETE FROM borrowers|); > > my $branchcode = $library->{branchcode}; >-my $borrower_number; > > my $context = new Test::MockModule('C4::Context'); > $context->mock( 'userenv', sub { >@@ -71,6 +73,52 @@ $context->mock( 'userenv', sub { > }; > }); > >+ >+# Test chargelostitem >+my $item = $builder->build( { source => 'Item' } ); >+my $patron = $builder->build( { source => 'Borrower' } ); >+my $amount = '5.000000'; >+my $description = "Test fee!"; >+chargelostitem( $patron->{borrowernumber}, $item->{itemnumber}, $amount, $description ); >+my ($accountline) = Koha::Account::Lines->search( >+ { >+ borrowernumber => $patron->{borrowernumber} >+ } >+); >+is( $accountline->amount, $amount, 'Accountline amount set correctly for chargelostitem' ); >+is( $accountline->description, $description, 'Accountline description set correctly for chargelostitem' ); >+is( $accountline->branchcode, $branchcode, 'Accountline branchcode set correctly for chargelostitem' ); >+$dbh->do(q|DELETE FROM accountlines|); >+ >+# Test manualinvoice, reuse some of the vars from testing chargelostitem >+my $type = 'L'; >+my $note = 'Test note!'; >+manualinvoice( $patron->{borrowernumber}, $item->{itemnumber}, $description, $type, $amount, $note ); >+($accountline) = Koha::Account::Lines->search( >+ { >+ borrowernumber => $patron->{borrowernumber} >+ } >+); >+is( $accountline->accounttype, $type, 'Accountline type set correctly for manualinvoice' ); >+is( $accountline->amount, $amount, 'Accountline amount set correctly for manualinvoice' ); >+ok( $accountline->description =~ /^$description/, 'Accountline description set correctly for manualinvoice' ); >+is( $accountline->note, $note, 'Accountline note set correctly for manualinvoice' ); >+is( $accountline->branchcode, $branchcode, 'Accountline branchcode set correctly for manualinvoice' ); >+ >+# Test _FixAccountForLostAndReturned, use the accountline from the manualinvoice to test >+C4::Circulation::_FixAccountForLostAndReturned( $item->{itemnumber} ); >+my ( $accountline_fee, $accountline_payment ) = Koha::Account::Lines->search( >+ { >+ borrowernumber => $patron->{borrowernumber} >+ } >+); >+is( $accountline_fee->accounttype, 'LR', 'Lost item fee account type updated to LR' ); >+is( $accountline_fee->amountoutstanding, '0.000000', 'Lost item fee amount outstanding updated to 0' ); >+is( $accountline_payment->accounttype, 'CR', 'Lost item fee account type is CR' ); >+is( $accountline_payment->amount, "-$amount", 'Lost item refund amount is correct' ); >+is( $accountline_payment->branchcode, $branchcode, 'Lost item refund branchcode is set correctly' ); >+$dbh->do(q|DELETE FROM accountlines|); >+ > # Testing purge_zero_balance_fees > > # The 3rd value in the insert is 'days ago' -- >-- >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 7595
:
7866
|
7867
|
7868
|
7869
|
7870
|
8037
|
8162
|
12394
|
12395
|
12717
|
12719
|
14814
|
14815
|
20808
|
20809
|
23306
|
23308
|
27337
|
30946
|
30947
|
30950
|
38150
|
38225
|
38235
|
52909
|
52910
|
52911
|
54262
| 54263 |
54264