From a9c7fc92713594251da1e630db7989cb5592bb0f Mon Sep 17 00:00:00 2001 From: Brendan Lawlor Date: Thu, 4 Sep 2025 18:24:07 +0000 Subject: [PATCH] Bug 39419: (follow-up) Unit tests --- t/db_dependent/Reserves.t | 45 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t index ef0fec81b3..703cf41b6a 100755 --- a/t/db_dependent/Reserves.t +++ b/t/db_dependent/Reserves.t @@ -17,7 +17,7 @@ use Modern::Perl; -use Test::More tests => 70; +use Test::More tests => 71; use Test::NoWarnings; use Test::MockModule; use Test::Warn; @@ -1581,6 +1581,49 @@ subtest 'AddReserve() tests' => sub { $schema->storage->txn_rollback; }; +subtest 'ModReserve() tests' => sub { + + plan tests => 1; + + $schema->storage->txn_begin; + + my $library = $builder->build_object( { class => 'Koha::Libraries' } ); + my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { lastseen => undef } } ); + my $biblio = $builder->build_sample_biblio; + + my $reserve_id = AddReserve( + { + branchcode => $library->branchcode, + borrowernumber => $patron->id, + biblionumber => $biblio->id, + } + ); + + my $hold = Koha::Holds->find($reserve_id); + + ModReserve( + { + branchcode => $reserve_id, + expiration_date => '2040-04-02', + } + ); + + $hold = Koha::Holds->find($reserve_id); + is( $hold->expirationdate, '2040-04-02', 'Successfully updated expiration date' ); + + ModReserve( + { + branchcode => $reserve_id, + patron_expiration_date => '2040-04-02' + } + ); + + $hold = Koha::Holds->find($reserve_id); + is( $hold->patron_expiration_date, '2040-04-02', 'Successfully updated patron expiration date' ); + + $schema->storage->txn_rollback; +}; + subtest 'AlterPriorty() tests' => sub { plan tests => 2; -- 2.39.5