From d5993958feda7976c09633ba7ea85367d05dad2d Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Fri, 17 Oct 2025 15:07:20 +0300 Subject: [PATCH] Bug 41044: Add a failing test To test: 1. prove t/db_dependent/Koha/Item.t 2. Observe failing test Subtest: test empty string warning 1..1 not ok 1 - No warnings were produced Failed test 'No warnings were produced' at t/db_dependent/Koha/Item.t line 3656. found warning: Argument "" isn't numeric in addition (+) at /usr/local/lib/x86_64-linux-gnu/perl/5.34.0/DateTime/Duration.pm line 70. didn't expect to find a warning Looks like you failed 1 test of 1. not ok 9 - test empty string warning Failed test 'test empty string warning' at t/db_dependent/Koha/Item.t line 3657. Looks like you failed 1 test of 9. Signed-off-by: David Nind --- t/db_dependent/Koha/Item.t | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t index 19cdb04dea..2485928770 100755 --- a/t/db_dependent/Koha/Item.t +++ b/t/db_dependent/Koha/Item.t @@ -3462,7 +3462,7 @@ subtest 'bookings' => sub { }; subtest 'find_booking' => sub { - plan tests => 8; + plan tests => 9; $schema->storage->txn_begin; @@ -3632,6 +3632,30 @@ subtest 'find_booking' => sub { }; + subtest 'test empty string warning' => sub { + plan tests => 1; + + Koha::CirculationRules->set_rules( + { + branchcode => '*', + itemtype => $item->effective_itemtype, + rules => { + bookings_lead_period => '', + }, + } + ); + + warning_is { + $found_booking = $item->find_booking( + { + checkout_date => dt_from_string(), + due_date => dt_from_string()->add( days => 7 ), + } + ); + } + undef, "No warnings were produced"; + }; + $schema->storage->txn_rollback; }; -- 2.39.5