Bugzilla – Attachment 114338 Details for
Bug 27204
SIP patron information request with fee line items returns incorrect data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27204: Add unit tests for fine_items
Bug-27204-Add-unit-tests-for-fineitems.patch (text/plain), 3.42 KB, created by
Kyle M Hall (khall)
on 2020-12-11 12:16:42 UTC
(
hide
)
Description:
Bug 27204: Add unit tests for fine_items
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-12-11 12:16:42 UTC
Size:
3.42 KB
patch
obsolete
>From b566a5588bb7fb22f9acd4483ac2561f6e47496b Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 11 Dec 2020 07:13:06 -0500 >Subject: [PATCH] Bug 27204: Add unit tests for fine_items > >--- > t/db_dependent/SIP/Patron.t | 74 ++++++++++++++++++++++++++++++++++--- > 1 file changed, 69 insertions(+), 5 deletions(-) > >diff --git a/t/db_dependent/SIP/Patron.t b/t/db_dependent/SIP/Patron.t >index d517c7693b..55f65a3144 100755 >--- a/t/db_dependent/SIP/Patron.t >+++ b/t/db_dependent/SIP/Patron.t >@@ -4,15 +4,17 @@ > # This needs to be extended! Your help is appreciated.. > > use Modern::Perl; >-use Test::More tests => 6; >+use Test::More tests => 7; > >-use Koha::Database; >-use Koha::Patrons; >-use Koha::DateUtils; >-use t::lib::TestBuilder; > use t::lib::Mocks; >+use t::lib::TestBuilder; >+ > use C4::SIP::ILS::Patron; >+use Koha::Account::Lines; >+use Koha::Database; >+use Koha::DateUtils; > use Koha::Patron::Attributes; >+use Koha::Patrons; > > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; >@@ -182,4 +184,66 @@ subtest "update_lastseen tests" => sub { > is( output_pref({str => $seen_patron->lastseen(), dateonly => 1}), output_pref({dt => dt_from_string(), dateonly => 1}),'Last seen updated to today if tracking patrons'); > }; > >+subtest "fine_items tests" => sub { >+ >+ plan tests => 12; >+ >+ my $patron = $builder->build( >+ { >+ source => 'Borrower', >+ } >+ ); >+ >+ my $fee1 = $builder->build( >+ { >+ source => 'Accountline', >+ value => { >+ borrowernumber => $patron->{borrowernumber}, >+ amountoutstanding => 1, >+ } >+ } >+ ); >+ >+ my $fee2 = $builder->build( >+ { >+ source => 'Accountline', >+ value => { >+ borrowernumber => $patron->{borrowernumber}, >+ amountoutstanding => 1, >+ } >+ } >+ ); >+ >+ my $sip_patron = C4::SIP::ILS::Patron->new( $patron->{cardnumber} ); >+ >+ my $all_fine_items = $sip_patron->fine_items; >+ is( @$all_fine_items, 2, "Got all fine items" ); >+ >+ # Should return only the first fine item >+ my $fine_items = $sip_patron->fine_items(1,1); >+ is( @$fine_items, 1, "Got one fine item" ); >+ is( $fine_items->[0]->{barcode}, $all_fine_items->[0]->{barcode}, "Got correct fine item"); >+ >+ # Should return only the second fine item >+ $fine_items = $sip_patron->fine_items(2,2); >+ is( @$fine_items, 1, "Got one fine item" ); >+ is( $fine_items->[0]->{barcode}, $all_fine_items->[1]->{barcode}, "Got correct fine item"); >+ >+ # Should return all fine items >+ $fine_items = $sip_patron->fine_items(1,2); >+ is( @$fine_items, 2, "Got two fine items" ); >+ is( $fine_items->[0]->{barcode}, $all_fine_items->[0]->{barcode}, "Got correct first fine item"); >+ is( $fine_items->[1]->{barcode}, $all_fine_items->[1]->{barcode}, "Got correct second fine item"); >+ >+ # Check an invalid end boundary >+ $fine_items = $sip_patron->fine_items(1,99); >+ is( @$fine_items, 2, "Got two fine items" ); >+ is( $fine_items->[0]->{barcode}, $all_fine_items->[0]->{barcode}, "Got correct first fine item"); >+ is( $fine_items->[1]->{barcode}, $all_fine_items->[1]->{barcode}, "Got correct second fine item"); >+ >+ # Check an invalid start boundary >+ $fine_items = $sip_patron->fine_items(98,99); >+ is( @$fine_items, 0, "Got zero fine items" ); >+}; >+ > $schema->storage->txn_rollback; >-- >2.24.1 (Apple Git-126)
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 27204
:
114338
|
114339
|
115824
|
115825
|
116119
|
116120