From 851a3697ba5c799e06986dd8f785bc1e98fd33c8 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 22 May 2023 11:35:46 +0000 Subject: [PATCH] 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 Signed-off-by: Kyle M Hall --- t/db_dependent/Koha/Hold.t | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Hold.t b/t/db_dependent/Koha/Hold.t index e0c4bae997..58f3fc45eb 100755 --- a/t/db_dependent/Koha/Hold.t +++ b/t/db_dependent/Koha/Hold.t @@ -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; -- 2.30.2