Bugzilla – Attachment 192188 Details for
Bug 36506
Processing Fee should be configurable by branch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36506: Adjust existing tests and test builder
a6165cf.patch (text/plain), 13.46 KB, created by
Martin Renvoize (ashimema)
on 2026-01-29 18:21:21 UTC
(
hide
)
Description:
Bug 36506: Adjust existing tests and test builder
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-01-29 18:21:21 UTC
Size:
13.46 KB
patch
obsolete
>From a6165cfd116233b4924bad7f1d613e9627dd3fae Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 1 Oct 2025 19:54:41 +0000 >Subject: [PATCH] Bug 36506: Adjust existing tests and test builder > >All the previously written tests should continue to pass. > >Sponsored-by: The Main Library Alliance <https://www.mainlib.org/> >Signed-off-by: Trevor Diamond <trevor.diamond@mainlib.org> >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > t/db_dependent/Accounts.t | 16 ++++++++++++---- > t/db_dependent/Circulation.t | 21 ++++++++++----------- > t/db_dependent/Koha/Charges/Fees.t | 1 - > t/db_dependent/Koha/Items.t | 12 ++++++------ > t/db_dependent/api/v1/item_types.t | 15 ++++++++++----- > t/lib/TestBuilder.pm | 1 - > 6 files changed, 38 insertions(+), 28 deletions(-) > >diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t >index d22d4c7297a..dbecb759fb6 100755 >--- a/t/db_dependent/Accounts.t >+++ b/t/db_dependent/Accounts.t >@@ -607,7 +607,6 @@ subtest "C4::Accounts::chargelostitem tests" => sub { > value => { > rentalcharge => 0, > defaultreplacecost => undef, >- processfee => undef, > } > } > ); >@@ -617,7 +616,6 @@ subtest "C4::Accounts::chargelostitem tests" => sub { > value => { > rentalcharge => 0, > defaultreplacecost => 16.32, >- processfee => undef, > } > } > ); >@@ -627,7 +625,6 @@ subtest "C4::Accounts::chargelostitem tests" => sub { > value => { > rentalcharge => 0, > defaultreplacecost => undef, >- processfee => 8.16, > } > } > ); >@@ -637,10 +634,21 @@ subtest "C4::Accounts::chargelostitem tests" => sub { > value => { > rentalcharge => 0, > defaultreplacecost => 4.08, >- processfee => 2.04, > } > } > ); >+ my $one_rule = Koha::CirculationRules->set_rule( >+ { >+ itemtype => $itype_no_replace_fee->{itemtype}, branchcode => undef, rule_value => 8.16, >+ rule_name => 'lost_item_processing_fee' >+ } >+ ); >+ my $two_rule = Koha::CirculationRules->set_rule( >+ { >+ itemtype => $itype_replace_fee->{itemtype}, branchcode => undef, rule_value => 2.04, >+ rule_name => 'lost_item_processing_fee' >+ } >+ ); > my $cli_borrowernumber = $builder->build( { source => 'Borrower' } )->{'borrowernumber'}; > my $cli_itemnumber1 = $builder->build_sample_item( { itype => $itype_no_replace_no_fee->{itemtype} } )->itemnumber; > my $cli_itemnumber2 = $builder->build_sample_item( { itype => $itype_replace_no_fee->{itemtype} } )->itemnumber; >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 540108a3c1d..0321dc9f694 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -156,7 +156,6 @@ my $itemtype = $builder->build( > rentalcharge => 0, > rentalcharge_daily => 0, > defaultreplacecost => undef, >- processfee => undef > } > } > )->{itemtype}; >@@ -1185,7 +1184,7 @@ subtest "CanBookBeRenewed tests" => sub { > ); > > my $ten_days_before = dt_from_string->add( days => -10 ); >- my $ten_days_ahead = dt_from_string->add( days => 10 ); >+ my $ten_days_ahead = dt_from_string->add( days => 10 ); > my $issue = AddIssue( > $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, > undef, { auto_renew => 1 } >@@ -1335,7 +1334,7 @@ subtest "CanBookBeRenewed tests" => sub { > ); > > my $ten_days_before = dt_from_string->add( days => -10 ); >- my $ten_days_ahead = dt_from_string->add( days => 10 ); >+ my $ten_days_ahead = dt_from_string->add( days => 10 ); > my $issue = AddIssue( > $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, > undef, { auto_renew => 1 } >@@ -1445,7 +1444,7 @@ subtest "CanBookBeRenewed tests" => sub { > ); > > my $ten_days_before = dt_from_string->add( days => -10 ); >- my $ten_days_ahead = dt_from_string->add( days => 10 ); >+ my $ten_days_ahead = dt_from_string->add( days => 10 ); > > # Patron is expired and BlockExpiredPatronOpacActions='' > # => auto renew is allowed >@@ -1497,7 +1496,7 @@ subtest "CanBookBeRenewed tests" => sub { > ); > > my $ten_days_before = dt_from_string->add( days => -10 ); >- my $ten_days_ahead = dt_from_string->add( days => 10 ); >+ my $ten_days_ahead = dt_from_string->add( days => 10 ); > my $issue = AddIssue( > $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, > undef, { auto_renew => 1 } >@@ -1618,7 +1617,7 @@ subtest "CanBookBeRenewed tests" => sub { > ); > > my $ten_days_before = dt_from_string->add( days => -10 ); >- my $ten_days_ahead = dt_from_string->add( days => 10 ); >+ my $ten_days_ahead = dt_from_string->add( days => 10 ); > my $issue = AddIssue( > $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before, > undef, { auto_renew => 1 } >@@ -2020,7 +2019,7 @@ subtest "GetUpcomingDueIssues" => sub { > my $a_borrower = Koha::Patrons->find($a_borrower_borrowernumber); > > my $yesterday = DateTime->today( time_zone => C4::Context->tz() )->add( days => -1 ); >- my $two_days_ahead = DateTime->today( time_zone => C4::Context->tz() )->add( days => 2 ); >+ my $two_days_ahead = DateTime->today( time_zone => C4::Context->tz() )->add( days => 2 ); > my $today = DateTime->today( time_zone => C4::Context->tz() ); > > my $issue = AddIssue( $a_borrower, $item_1->barcode, $yesterday ); >@@ -3932,7 +3931,7 @@ subtest 'AddReturn | is_overdue' => sub { > is( $line->status, 'RETURNED', "Overdue fine is fixed" ); > $line = $lines->next; > is( $line->amount + 0, -2, "Original payment amount remains as 2" ); >- is( $line->amountoutstanding + 0, 0, "Original payment remains applied" ); >+ is( $line->amountoutstanding + 0, 0, "Original payment remains applied" ); > $line = $lines->next; > is( $line->amount + 0, -1, "Refund amount correctly set to 1" ); > is( $line->amountoutstanding + 0, -1, "Refund amount outstanding unspent" ); >@@ -4886,7 +4885,7 @@ subtest '_FixOverduesOnReturn' => sub { > my $credit = $offset->credit; > is( ref $credit, "Koha::Account::Line", "Found matching credit for fine forgiveness" ); > is( $credit->amount + 0, -99, "Credit amount is set correctly" ); >- is( $credit->amountoutstanding + 0, 0, "Credit amountoutstanding is correctly set to 0" ); >+ is( $credit->amountoutstanding + 0, 0, "Credit amountoutstanding is correctly set to 0" ); > > # Bug 25417 - Only forgive fines where there is an amount outstanding to forgive > $accountline->set( >@@ -7637,7 +7636,7 @@ subtest 'NoRefundOnLostFinesPaidAge' => sub { > { > borrowernumber => $patron->id, > date => '1970-01-01 14:00:01', >- amountoutstanding => 0, >+ amountoutstanding => 0, > amount => -5, > interface => 'commandline', > credit_type_code => 'PAYMENT' >@@ -7693,7 +7692,7 @@ subtest 'NoRefundOnLostFinesPaidAge' => sub { > borrowernumber => $patron2->id, > date => '1970-01-01 14:00:01', > amount => -5, >- amountoutstanding => 0, >+ amountoutstanding => 0, > interface => 'commandline', > credit_type_code => 'PAYMENT' > } >diff --git a/t/db_dependent/Koha/Charges/Fees.t b/t/db_dependent/Koha/Charges/Fees.t >index 8d01c2a38bc..b6e09a05b65 100755 >--- a/t/db_dependent/Koha/Charges/Fees.t >+++ b/t/db_dependent/Koha/Charges/Fees.t >@@ -68,7 +68,6 @@ my $itemtype = $builder->build_object( > rentalcharge_hourly => '0.00', > rentalcharge_hourly_calendar => 1, > rentalcharge => '0.00', >- processfee => '0.00', > defaultreplacecost => '0.00', > }, > } >diff --git a/t/db_dependent/Koha/Items.t b/t/db_dependent/Koha/Items.t >index 3e74ac1fb6c..a5bcd22a757 100755 >--- a/t/db_dependent/Koha/Items.t >+++ b/t/db_dependent/Koha/Items.t >@@ -465,11 +465,16 @@ subtest 'store' => sub { > notforloan => 0, > rentalcharge => 0, > defaultreplacecost => undef, >- processfee => $processfee_amount, > rentalcharge_daily => 0, > } > } > ); >+ Koha::CirculationRules->set_rule( >+ { >+ itemtype => $item_type->itemtype, branchcode => undef, rule_value => $processfee_amount, >+ rule_name => 'lost_item_processing_fee' >+ } >+ ); > my $library = $builder->build_object( { class => 'Koha::Libraries' } ); > > $biblio = $builder->build_sample_biblio( { author => 'Hall, Daria' } ); >@@ -1048,7 +1053,6 @@ subtest 'store' => sub { > notforloan => 0, > rentalcharge => 0, > defaultreplacecost => undef, >- processfee => 0, > rentalcharge_daily => 0, > } > } >@@ -1166,7 +1170,6 @@ subtest 'store' => sub { > my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); > my $barcode = 'KD123456794'; > my $replacement_amount = 100; >- my $processfee_amount = 20; > > my $item_type = $builder->build_object( > { >@@ -1175,7 +1178,6 @@ subtest 'store' => sub { > notforloan => 0, > rentalcharge => 0, > defaultreplacecost => undef, >- processfee => 0, > rentalcharge_daily => 0, > } > } >@@ -1579,7 +1581,6 @@ subtest 'store' => sub { > my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); > my $barcode = 'KD123456795'; > my $replacement_amount = 100; >- my $processfee_amount = 20; > > my $item_type = $builder->build_object( > { >@@ -1588,7 +1589,6 @@ subtest 'store' => sub { > notforloan => 0, > rentalcharge => 0, > defaultreplacecost => undef, >- processfee => 0, > rentalcharge_daily => 0, > } > } >diff --git a/t/db_dependent/api/v1/item_types.t b/t/db_dependent/api/v1/item_types.t >index db232ec6efe..dfab04d75a9 100755 >--- a/t/db_dependent/api/v1/item_types.t >+++ b/t/db_dependent/api/v1/item_types.t >@@ -53,7 +53,6 @@ subtest 'list() tests' => sub { > rentalcharge_hourly => 0.60, > rentalcharge_hourly_calendar => 1, > defaultreplacecost => 1000.0, >- processfee => 20.0, > notforloan => 0, > imageurl => 'https://upload.wikimedia.org/wikipedia/commons/1/1f/202208_test-tube-4.svg', > summary => 'An item type for testing', >@@ -112,12 +111,18 @@ subtest 'list() tests' => sub { > > ## Authorized user tests > my $query = encode_json( { item_type_id => $item_type->id } ); >- $t->get_ok("//$userid:$password@/api/v1/item_types?q=$query")->status_is(200)->json_has('/0') >- ->json_is( '/0/description', $item_type->description )->json_hasnt('/0/translated_descriptions'); >+ $t->get_ok("//$userid:$password@/api/v1/item_types?q=$query") >+ ->status_is(200) >+ ->json_has('/0') >+ ->json_is( '/0/description', $item_type->description ) >+ ->json_hasnt('/0/translated_descriptions'); > > $t->get_ok( "//$userid:$password@/api/v1/item_types?q=$query" => { 'x-koha-embed' => 'translated_descriptions' } ) >- ->status_is(200)->json_has('/0')->json_is( '/0/description', $item_type->description ) >- ->json_has('/0/translated_descriptions')->json_is( >+ ->status_is(200) >+ ->json_has('/0') >+ ->json_is( '/0/description', $item_type->description ) >+ ->json_has('/0/translated_descriptions') >+ ->json_is( > '/0/translated_descriptions', > [ > { lang => 'en', translation => 'English word "test"' }, >diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm >index adf15de6830..8c40c0aa990 100644 >--- a/t/lib/TestBuilder.pm >+++ b/t/lib/TestBuilder.pm >@@ -683,7 +683,6 @@ sub _gen_default_values { > rentalcharge_daily => 0, > rentalcharge_hourly => 0, > defaultreplacecost => 0, >- processfee => 0, > notforloan => 0, > bookable => 0, > }, >-- >2.52.0 >
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 36506
:
187411
|
187412
|
187413
|
187414
|
187415
|
187416
|
187417
|
187418
|
187573
|
187574
|
187575
|
187576
|
187577
|
187578
|
187579
|
187580
|
192182
|
192183
|
192184
|
192185
|
192186
|
192187
| 192188 |
192189
|
192190