Bug 33791: Add unit test

Test plan:
Run t/db_dependent/Koha/Hold.t
NOTE: This test should fail without following patch, but pass with it.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Marcel de Rooy 2023-05-22 11:35:46 +00:00 committed by Tomas Cohen Arazi
parent 7b315a31b4
commit 306439b4c6
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -69,7 +69,7 @@ subtest 'store() tests' => sub {
subtest 'fill() tests' => sub {
plan tests => 13;
plan tests => 14;
$schema->storage->txn_begin;
@ -124,6 +124,18 @@ subtest 'fill() tests' => sub {
is( $old_hold->priority, 0, 'priority set to 0' );
is( $old_hold->found, 'F', 'found set to F' );
subtest 'itemnumber parameter' => sub {
plan tests => 1;
$category->reservefee(0)->store; # do not disturb later accounts
$hold = $builder->build_object({ class => 'Koha::Holds', value => { biblionumber => $biblio->id, borrowernumber => $patron->id, itemnumber => undef, priority => 1 } });
# Simulating checkout without confirming hold
$hold->fill({ itemnumber => $item->id });
$old_hold = Koha::Old::Holds->find($hold->id);
is( $old_hold->itemnumber, $item->itemnumber, 'The itemnumber has been saved in old_reserves by fill' );
$old_hold->delete;
$category->reservefee($fee)->store; # restore
};
subtest 'fee applied tests' => sub {
plan tests => 9;