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

Sponsored-by: OpenFifth <https://openfifth.co.uk/>
Signed-off-by: Marcus Michel <marcus.michel@rbkc.gov.uk>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Martin Renvoize 2026-01-19 14:26:14 +00:00 committed by Pedro Amorim
parent cd728e5bb2
commit c6798323cd
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 27 additions and 0 deletions

View File

@ -1385,6 +1385,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,
@ -1393,6 +1401,7 @@ sub test_checkin_v2 {
restricted => 0,
homebranch => $branchcode,
holdingbranch => $branchcode,
itype => $itemtype_obj->itemtype,
}
);
@ -1679,6 +1688,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,
@ -1687,6 +1704,7 @@ sub test_checkout_desensitize {
restricted => 0,
homebranch => $branchcode,
holdingbranch => $branchcode,
itype => $itemtype_obj->itemtype,
}
);
my $itemtype = $item_object->effective_itemtype;
@ -1873,6 +1891,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,
@ -1881,6 +1907,7 @@ sub test_renew_desensitize {
restricted => 0,
homebranch => $branchcode,
holdingbranch => $branchcode,
itype => $itemtype_obj->itemtype,
}
);
my $itemtype = $item_object->effective_itemtype;