Bug 32268: Prevent XSLT.t to fail randomly

Can't call method "itemnumber" on an undefined value at /kohadevbox/koha/Koha/Recall.pm line 343.

We should set item_level and not let TestBuilder pick a value.

This may have been caught (make it more obvious) by the recent change to
TestBuilder for boolean (Bug 32030: fix test builder for boolean)

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2022-11-18 14:41:51 +01:00 committed by Tomas Cohen Arazi
parent 3d8ff90a8f
commit cb7b9b37c9
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 11 additions and 5 deletions

View File

@ -133,11 +133,17 @@ subtest 'buildKohaItemsNamespace status tests' => sub {
like($xml,qr{<resultbranch>${library_name}</resultbranch>}, "Found resultbranch / holding branch" );
t::lib::Mocks::mock_preference('UseRecalls', 1);
my $recall = $builder->build_object({ class => 'Koha::Recalls', value => {
biblio_id => $item->biblionumber,
item_id => $item->itemnumber,
pickup_library_id => $item->holdingbranch,
}});
my $recall = $builder->build_object(
{
class => 'Koha::Recalls',
value => {
biblio_id => $item->biblionumber,
item_id => $item->itemnumber,
pickup_library_id => $item->holdingbranch,
item_level => 1,
}
}
);
$recall->set_waiting;
$xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]);
like($xml,qr{<substatus>Recall waiting</substatus>},"Waiting status takes precedence over In transit (recalls)");