Bugzilla – Attachment 94724 Details for
Bug 23382
Issuing rules failing after bug 20912
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23382: Add tests for hourly calculations
Bug-23382-Add-tests-for-hourly-calculations.patch (text/plain), 2.83 KB, created by
Martin Renvoize (ashimema)
on 2019-10-25 10:01:16 UTC
(
hide
)
Description:
Bug 23382: Add tests for hourly calculations
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-10-25 10:01:16 UTC
Size:
2.83 KB
patch
obsolete
>From 1c3639ebdc753de01ec06197aeca78f992e02f6a Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 6 Aug 2019 15:23:39 +0100 >Subject: [PATCH] Bug 23382: Add tests for hourly calculations > >--- > t/db_dependent/Koha/Charges/Fees.t | 42 ++++++++++++++++++++++++++---- > 1 file changed, 37 insertions(+), 5 deletions(-) > >diff --git a/t/db_dependent/Koha/Charges/Fees.t b/t/db_dependent/Koha/Charges/Fees.t >index 1722fc191c..db7e219538 100644 >--- a/t/db_dependent/Koha/Charges/Fees.t >+++ b/t/db_dependent/Koha/Charges/Fees.t >@@ -34,7 +34,9 @@ BEGIN { > use_ok('Koha::Charges::Fees'); > } > >+my $schema = Koha::Database->new->schema; > my $builder = t::lib::TestBuilder->new(); >+$schema->storage->txn_begin; > > my $patron_category = $builder->build_object( > { >@@ -59,10 +61,11 @@ my $itemtype = $builder->build_object( > { > class => 'Koha::ItemTypes', > value => { >- rentalcharge_daily => '0.00', >- rentalcharge => '0.00', >- processfee => '0.00', >- defaultreplacecost => '0.00', >+ rentalcharge_daily => '0.00', >+ rentalcharge_hourly => '0.00', >+ rentalcharge => '0.00', >+ processfee => '0.00', >+ defaultreplacecost => '0.00', > }, > } > ); >@@ -304,7 +307,7 @@ subtest 'from_date accessor' => sub { > }; > > subtest 'accumulate_rentalcharge tests' => sub { >- plan tests => 4; >+ plan tests => 5; > > my $fees = Koha::Charges::Fees->new( > { >@@ -316,6 +319,7 @@ subtest 'accumulate_rentalcharge tests' => sub { > } > ); > >+ # Daily tests > $itemtype->rentalcharge_daily(1.00); > $itemtype->store(); > is( $itemtype->rentalcharge_daily, >@@ -343,6 +347,34 @@ subtest 'accumulate_rentalcharge tests' => sub { > is( $charge, 5.00, > 'Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays' > ); >+ >+ # Hourly tests >+ my $issuingrule = Koha::IssuingRules->get_effective_issuing_rule( >+ { >+ categorycode => $patron->categorycode, >+ itemtype => $itemtype->id, >+ branchcode => $library->id >+ } >+ ); >+ $issuingrule->lengthunit('hours'); >+ $issuingrule->store(); >+ $itemtype->rentalcharge_hourly("2.50"); >+ $itemtype->store(); >+ $dt_from = dt_from_string(); >+ $dt_to = dt_from_string()->add( hours => 4 ); >+ $fees = Koha::Charges::Fees->new( >+ { >+ patron => $patron, >+ library => $library, >+ item => $item, >+ to_date => $dt_to, >+ from_date => $dt_from, >+ } >+ ); >+ >+ $charge = $fees->accumulate_rentalcharge(); >+ is( $charge, 10.00, 'Hourly rental charge calculated correctly' ); > }; > >+$schema->storage->txn_rollback; > Time::Fake->reset; >-- >2.20.1
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 23382
:
92221
|
92222
|
92236
|
92237
|
92238
|
92273
|
92274
|
92275
|
92276
|
93407
|
93408
|
93409
|
93410
|
93411
|
93412
|
94281
|
94282
|
94283
|
94284
|
94285
|
94286
|
94287
|
94288
|
94289
|
94723
|
94724
|
94725
|
94726
|
94727
|
94728
|
94729
|
94730
|
94731
|
94743
|
94755
|
94756
|
94757
|
94758
|
94759
|
94760
|
94761
|
94762
|
94763
|
94764
|
94765
|
94766
|
94774
|
94775
|
94776
|
94777
|
94778
|
94779
|
94780
|
94781
|
94782
|
94783
|
94784
|
107456
|
107457