Bug 27058: Add test to show ordered items cannot be checked out

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 1c0acc36ba)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Joonas Kylmälä 2020-11-19 17:13:25 +02:00 committed by Fridolin Somers
parent af888cd3b8
commit 1031e9dcdc
1 changed files with 34 additions and 1 deletions

View File

@ -8,7 +8,7 @@ use C4::Items;
use Koha::Items;
use Koha::CirculationRules;
use Test::More tests => 11;
use Test::More tests => 12;
use t::lib::TestBuilder;
use t::lib::Mocks;
@ -393,6 +393,39 @@ subtest 'Check holds availability with different item types' => sub {
is( $is, 1, "Item5 can be requested to hold, 2 items, Item4 checked out, Item5 restricted" );
};
subtest 'Check item checkout availability with ordered item' => sub {
plan tests => 1;
my $biblio2 = $builder->build_sample_biblio( { itemtype => $itemtype } );
my $biblionumber1 = $biblio2->biblionumber;
my $item1 = $builder->build_sample_item(
{ biblionumber => $biblionumber1,
itype => $itemtype2,
homebranch => $library_A,
holdingbranch => $library_A,
notforloan => -1
}
);
$dbh->do("DELETE FROM circulation_rules");
Koha::CirculationRules->set_rules(
{ categorycode => undef,
itemtype => $itemtype2,
branchcode => undef,
rules => {
issuelength => 7,
lengthunit => 8,
reservesallowed => 99,
holds_per_record => 99,
onshelfholds => 2,
}
}
);
$is = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblionumber1, patron => $patron1 } );
is( $is, 0, "Ordered item cannot be checked out" );
};
# Cleanup
$schema->storage->txn_rollback;