From 11d86b88f1e4fb309394890a819d90f2e15d8491 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Mon, 30 Oct 2023 16:45:54 +0000 Subject: [PATCH] Bug 27992: Unit test Signed-off-by: Emily Lamancusa Signed-off-by: Katrin Fischer --- t/db_dependent/Circulation.t | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index fc6e96b735..f64140defd 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -2434,7 +2434,7 @@ subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub { }; subtest 'CanBookBeIssued + Statistic patrons "X"' => sub { - plan tests => 9; + plan tests => 11; my $library = $builder->build_object( { class => 'Koha::Libraries' } ); my $patron_category_x = $builder->build_object( @@ -2474,6 +2474,18 @@ subtest 'CanBookBeIssued + Statistic patrons "X"' => sub { is( $stat->categorycode, $patron->categorycode, 'Recorded a categorycode' ); is( $stat->location, $item_1->location, 'Recorded a location' ); + + t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode }); + my $patron_2 = $builder->build_object( { class => 'Koha::Patrons', value => { categorycode => $patron_category->{categorycode} } } ); + my $item_2 = $builder->build_sample_item( { library => $library->branchcode } ); + my $issue = AddIssue( $patron_2, $item_2->barcode ); + $item_2->discard_changes; + ok($item_2->onloan, "Item is checked out"); + + ( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->barcode ); + $item_2->discard_changes; + ok(!$item_2->onloan, "Checked out item is returned"); + # TODO There are other tests to provide here }; -- 2.30.2