From 5f4995ea9de54d6237934f81db51a0950cfb167e Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 19 Jan 2026 14:26:14 +0000 Subject: [PATCH] Bug 41649: Fix SIP Message tests for magnetic media The tests for desensitize and alert flags were failing because items were created with random itemtypes that could have sip_magnetic=1. This caused unexpected behavior since magnetic media items don't get desensitized and trigger alert flags. Fix by explicitly creating itemtypes with sip_magnetic=0 in: - test_checkout_desensitize - test_renew_desensitize - test_checkin_v2 --- t/db_dependent/SIP/Message.t | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/t/db_dependent/SIP/Message.t b/t/db_dependent/SIP/Message.t index 71406dbf363..5e5a252040c 100755 --- a/t/db_dependent/SIP/Message.t +++ b/t/db_dependent/SIP/Message.t @@ -1369,6 +1369,14 @@ sub test_checkin_v2 { my $card1 = $patron1->{cardnumber}; my $sip_patron1 = C4::SIP::ILS::Patron->new($card1); $findpatron = $sip_patron1; + + # Create itemtype with sip_magnetic = 0 to ensure alert flag tests work correctly + my $itemtype_obj = $builder->build_object( + { + class => 'Koha::ItemTypes', + value => { sip_magnetic => 0 }, + } + ); my $item_object = $builder->build_sample_item( { damaged => 0, @@ -1377,6 +1385,7 @@ sub test_checkin_v2 { restricted => 0, homebranch => $branchcode, holdingbranch => $branchcode, + itype => $itemtype_obj->itemtype, } ); @@ -1663,6 +1672,14 @@ sub test_checkout_desensitize { my $sip_patron1 = C4::SIP::ILS::Patron->new($card1); my $patron_category = $sip_patron1->ptype(); $findpatron = $sip_patron1; + + # Create itemtype with sip_magnetic = 0 to ensure desensitize tests work correctly + my $itemtype_obj = $builder->build_object( + { + class => 'Koha::ItemTypes', + value => { sip_magnetic => 0 }, + } + ); my $item_object = $builder->build_sample_item( { damaged => 0, @@ -1671,6 +1688,7 @@ sub test_checkout_desensitize { restricted => 0, homebranch => $branchcode, holdingbranch => $branchcode, + itype => $itemtype_obj->itemtype, } ); my $itemtype = $item_object->effective_itemtype; @@ -1857,6 +1875,14 @@ sub test_renew_desensitize { my $sip_patron1 = C4::SIP::ILS::Patron->new($card1); my $patron_category = $sip_patron1->ptype(); $findpatron = $sip_patron1; + + # Create itemtype with sip_magnetic = 0 to ensure desensitize tests work correctly + my $itemtype_obj = $builder->build_object( + { + class => 'Koha::ItemTypes', + value => { sip_magnetic => 0 }, + } + ); my $item_object = $builder->build_sample_item( { damaged => 0, @@ -1865,6 +1891,7 @@ sub test_renew_desensitize { restricted => 0, homebranch => $branchcode, holdingbranch => $branchcode, + itype => $itemtype_obj->itemtype, } ); my $itemtype = $item_object->effective_itemtype; -- 2.52.0