Bug 24860: (QA follow-up) Add unit tests to cover Koha::Hold::item_group

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Kyle Hall 2022-10-12 13:10:50 -04:00 committed by Tomas Cohen Arazi
parent e1b9755808
commit 1e19b90e1f
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 45 additions and 1 deletions

View File

@ -19,7 +19,7 @@
use Modern::Perl;
use Test::More tests => 10;
use Test::More tests => 11;
use Test::Exception;
use Test::MockModule;
@ -911,3 +911,47 @@ subtest 'can_update_pickup_location_opac() tests' => sub {
$schema->storage->txn_rollback;
};
subtest 'Koha::Hold::item_group tests' => sub {
plan tests => 1;
$schema->storage->txn_begin;
my $library = $builder->build_object( { class => 'Koha::Libraries' } );
my $category = $builder->build_object(
{
class => 'Koha::Patron::Categories',
value => { exclude_from_local_holds_priority => 0 }
}
);
my $patron = $builder->build_object(
{
class => "Koha::Patrons",
value => {
branchcode => $library->branchcode,
categorycode => $category->categorycode
}
}
);
my $biblio = $builder->build_sample_biblio();
my $item_group =
Koha::Biblio::ItemGroup->new( { biblio_id => $biblio->id } )->store();
my $hold = $builder->build_object(
{
class => "Koha::Holds",
value => {
borrowernumber => $patron->borrowernumber,
biblionumber => $biblio->biblionumber,
priority => 1,
item_group_id => $item_group->id,
}
}
);
is( $hold->item_group->id, $item_group->id, "Got correct item group" );
$schema->storage->txn_rollback;
};