From 86f0800ede0c73217837d32ab35e4018501eab92 Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Tue, 22 Feb 2022 14:08:34 +0000 Subject: [PATCH] Bug 22321: Unit test for new()->borrowernumber()->store() Signed-off-by: Magnus Enger --- t/db_dependent/Illrequests.t | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Illrequests.t b/t/db_dependent/Illrequests.t index a8260b5633..0b0d19a22a 100755 --- a/t/db_dependent/Illrequests.t +++ b/t/db_dependent/Illrequests.t @@ -126,7 +126,7 @@ subtest 'Basic object tests' => sub { }; subtest 'store borrowernumber change also updates holds' => sub { - plan tests => 3; + plan tests => 5; $schema->storage->txn_begin; @@ -170,6 +170,21 @@ subtest 'store borrowernumber change also updates holds' => sub { is( $request->borrowernumber, $other_patron->borrowernumber, 'after change, changed borrowernumber found in illrequests' ); + my $new_request = Koha::Illrequest->new({ + biblio_id => $biblio->biblionumber, + branchcode => $patron->branchcode, + })->borrowernumber( $patron->borrowernumber )->store; + + is( $new_request->borrowernumber, $patron->borrowernumber, + 'Koha::Illrequest->new()->store() works as expected'); + + my $new_holds_found = Koha::Holds->search({ + biblionumber => $new_request->biblio_id, + borrowernumber => $new_request->borrowernumber, + })->count; + + is( $new_holds_found, 0, 'no holds found with new()->store()' ); + $schema->storage->txn_rollback; }; -- 2.11.0