From 3d6954c94a670817892cbd981dd2114d5f2c0bd1 Mon Sep 17 00:00:00 2001 From: Nick Clemens 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 Signed-off-by: Trevor Diamond --- t/db_dependent/Accounts.t | 16 ++++++++++++---- t/db_dependent/Circulation.t | 1 - t/db_dependent/Koha/Charges/Fees.t | 1 - t/db_dependent/Koha/Items.t | 12 ++++++------ t/db_dependent/api/v1/item_types.t | 1 - t/lib/TestBuilder.pm | 1 - 6 files changed, 18 insertions(+), 14 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 e663e3e6f3f..dfb391f5e43 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}; diff --git a/t/db_dependent/Koha/Charges/Fees.t b/t/db_dependent/Koha/Charges/Fees.t index 9c9e3a0e05b..ca5b6182256 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 29a29a50e3d..607ea590d2d 100755 --- a/t/db_dependent/Koha/Items.t +++ b/t/db_dependent/Koha/Items.t @@ -461,11 +461,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' } ); @@ -1044,7 +1049,6 @@ subtest 'store' => sub { notforloan => 0, rentalcharge => 0, defaultreplacecost => undef, - processfee => 0, rentalcharge_daily => 0, } } @@ -1162,7 +1166,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( { @@ -1171,7 +1174,6 @@ subtest 'store' => sub { notforloan => 0, rentalcharge => 0, defaultreplacecost => undef, - processfee => 0, rentalcharge_daily => 0, } } @@ -1575,7 +1577,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( { @@ -1584,7 +1585,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..2b93db4e542 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', diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm index 5aa5f9589cc..0d923bfbfef 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.39.5