Bugzilla – Attachment 94287 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: (follow-up) Further improve test coverage
Bug-23382-follow-up-Further-improve-test-coverage.patch (text/plain), 6.01 KB, created by
Martin Renvoize (ashimema)
on 2019-10-16 12:13:06 UTC
(
hide
)
Description:
Bug 23382: (follow-up) Further improve test coverage
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-10-16 12:13:06 UTC
Size:
6.01 KB
patch
obsolete
>From 39ef054feb5852cbc744abb9bac3935fff8debe9 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 16 Oct 2019 11:44:11 +0100 >Subject: [PATCH] Bug 23382: (follow-up) Further improve test coverage > >--- > t/db_dependent/Circulation.t | 48 +++++++++++++++++++++++------- > t/db_dependent/Koha/Charges/Fees.t | 21 +++++++++---- > 2 files changed, 54 insertions(+), 15 deletions(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 33cef21eb3..0c184807a8 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -3074,7 +3074,7 @@ subtest 'ProcessOfflinePayment() tests' => sub { > }; > > subtest 'Incremented fee tests' => sub { >- plan tests => 16; >+ plan tests => 20; > > my $dt = dt_from_string(); > Time::Fake->offset( $dt->epoch ); >@@ -3207,24 +3207,52 @@ subtest 'Incremented fee tests' => sub { > is( $issuingrule->lengthunit, 'hours', > 'Issuingrule updated and retrieved correctly' ); > >- $itemtype->rentalcharge_hourly('2.500000')->store(); >+ $itemtype->rentalcharge_hourly('0.25')->store(); > is( $itemtype->rentalcharge_hourly, >- '2.500000', 'Hourly rental charge stored and retreived correctly' ); >+ '0.25', 'Hourly rental charge stored and retreived correctly' ); > >- $dt_to = dt_from_string()->add( hours => 4 ); >- $dt_to_renew = dt_from_string()->add( hours => 6 ); >- $calendar->delete_holiday( weekday => 3); >+ $dt_to = dt_from_string()->add( hours => 168 ); >+ $dt_to_renew = dt_from_string()->add( hours => 312 ); > >+ t::lib::Mocks::mock_preference( 'finesCalendar', 'ignoreCalendar' ); > $issue = > AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); > $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); >- is( $accountline->amount, '10.000000', >- "Hourly rental charge calculated correctly" ); >+ is( $accountline->amount + 0, 42, >+ "Hourly rental charge calculated correctly with finesCalendar = ignoreCalendar (168h * 0.25u)" ); > $accountline->delete(); > AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to ); > $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); >- is( $accountline->amount, '5.000000', >- "Hourly rental charge calculated correctly, for renewal" ); >+ is( $accountline->amount + 0, 36, >+ "Hourly rental charge calculated correctly with finesCalendar = ignoreCalendar, for renewal (312h - 168h * 0.25u)" ); >+ $accountline->delete(); >+ $issue->delete(); >+ >+ t::lib::Mocks::mock_preference( 'finesCalendar', 'noFinesWhenClosed' ); >+ $issue = >+ AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); >+ $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); >+ is( $accountline->amount + 0, 36, >+ "Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays (168h - 24h * 0.25u)" ); >+ $accountline->delete(); >+ AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to ); >+ $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); >+ is( $accountline->amount + 0, 30, >+ "Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays, for renewal (312h - 168h - 24h * 0.25u" ); >+ $accountline->delete(); >+ $issue->delete(); >+ >+ $calendar->delete_holiday( weekday => 3 ); >+ $issue = >+ AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from ); >+ $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); >+ is( $accountline->amount + 0, 42, >+ "Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed (168h - 0h * 0.25u" ); >+ $accountline->delete(); >+ AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to ); >+ $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } ); >+ is( $accountline->amount + 0, 36, >+ "Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed, for renewal (312h - 168h - 0h * 0.25u)" ); > $accountline->delete(); > $issue->delete(); > $issuingrule->lengthunit('days')->store(); >diff --git a/t/db_dependent/Koha/Charges/Fees.t b/t/db_dependent/Koha/Charges/Fees.t >index db7e219538..65b7b23cac 100644 >--- a/t/db_dependent/Koha/Charges/Fees.t >+++ b/t/db_dependent/Koha/Charges/Fees.t >@@ -307,7 +307,7 @@ subtest 'from_date accessor' => sub { > }; > > subtest 'accumulate_rentalcharge tests' => sub { >- plan tests => 5; >+ plan tests => 7; > > my $fees = Koha::Charges::Fees->new( > { >@@ -358,10 +358,10 @@ subtest 'accumulate_rentalcharge tests' => sub { > ); > $issuingrule->lengthunit('hours'); > $issuingrule->store(); >- $itemtype->rentalcharge_hourly("2.50"); >+ $itemtype->rentalcharge_hourly("0.25"); > $itemtype->store(); >- $dt_from = dt_from_string(); >- $dt_to = dt_from_string()->add( hours => 4 ); >+ >+ $dt_to = $dt_from->clone->add( hours => 96 ); > $fees = Koha::Charges::Fees->new( > { > patron => $patron, >@@ -372,8 +372,19 @@ subtest 'accumulate_rentalcharge tests' => sub { > } > ); > >+ t::lib::Mocks::mock_preference( 'finesCalendar', 'ignoreCalendar' ); >+ $charge = $fees->accumulate_rentalcharge(); >+ is( $charge, 24.00, 'Hourly rental charge calculated correctly (96h * 0.25u)' ); >+ >+ t::lib::Mocks::mock_preference( 'finesCalendar', 'noFinesWhenClosed' ); >+ $charge = $fees->accumulate_rentalcharge(); >+ is( $charge, 18.00, >+'Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed Wednesdays (96h - 24h * 0.25u)' >+ ); >+ >+ $calendar->delete_holiday( weekday => 3); > $charge = $fees->accumulate_rentalcharge(); >- is( $charge, 10.00, 'Hourly rental charge calculated correctly' ); >+ is( $charge, 24.00, 'Hourly rental charge calculated correctly with finesCalendar = noFinesWhenClosed (96h - 0h * 0.25u)' ); > }; > > $schema->storage->txn_rollback; >-- >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