Bug 42700: Add unit tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Aleisha Amohia <aleisha@catalyst.net.nz>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Kyle M Hall 2026-05-28 09:09:54 -04:00 committed by Pedro Amorim
parent b33dae39ad
commit d8cf6da3a2
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 36 additions and 1 deletions

View File

@ -5,7 +5,7 @@
use Modern::Perl;
use Test::NoWarnings;
use Test::More tests => 12;
use Test::More tests => 13;
use t::lib::Mocks;
use t::lib::TestBuilder;
@ -557,3 +557,38 @@ subtest "Patron messages tests" => sub {
$schema->storage->txn_rollback;
};
subtest "hold_items counts all holds ( Bug 42700 )" => sub {
plan tests => 2;
$schema->storage->txn_begin;
my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
$builder->build_object(
{
class => 'Koha::Holds',
value => { borrowernumber => $patron->borrowernumber, found => 'W' },
}
) for 1 .. 2;
$builder->build_object(
{
class => 'Koha::Holds',
value => { borrowernumber => $patron->borrowernumber, found => undef },
}
) for 1 .. 3;
my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber );
is(
scalar @{ $sip_patron->{hold_items} }, 5,
"hold_items contains all holds ( waiting + non-waiting )"
);
is(
scalar @{ $sip_patron->{unavail_holds} }, 3,
"unavail_holds contains only non-waiting holds"
);
$schema->storage->txn_rollback;
};