Bug 28854: Unit test for AddReturn addition

This patch adds tests for the AddReturn change that adds an 'InBundle' message
to the return.

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2022-06-17 15:01:04 +01:00 committed by Tomas Cohen Arazi
parent 140dafd3f7
commit 266bbe1234
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -4298,6 +4298,25 @@ subtest 'AddReturn | recalls' => sub {
$recall1->set_cancelled;
};
subtest 'AddReturn | bundles' => sub {
plan tests => 1;
my $schema = Koha::Database->schema;
$schema->storage->txn_begin;
my $patron1 = $builder->build_object({ class => 'Koha::Patrons' });
my $host_item1 = $builder->build_sample_item;
my $bundle_item1 = $builder->build_sample_item;
$schema->resultset('ItemBundle')
->create(
{ host => $host_item1->itemnumber, item => $bundle_item1->itemnumber } );
my ( $doreturn, $messages, $iteminfo, $borrowerinfo ) = AddReturn( $bundle_item1->barcode, $bundle_item1->homebranch );
is($messages->{InBundle}->id, $host_item1->id, 'AddReturn returns InBundle host item when item is part of a bundle');
$schema->storage->txn_rollback;
};
subtest 'AddRenewal and AddIssuingCharge tests' => sub {
plan tests => 13;