From 4bfae55d56f412410638111044e8d40eef5558f9 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 Signed-off-by: Katrin Fischer --- 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 5765df476c..c660486d79 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.30.2