Bug 27992: Unit test

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit f7e2894156)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Lucas Gass 2023-10-30 16:45:54 +00:00 committed by Fridolin Somers
parent 5322b70a29
commit de99239d0d
1 changed files with 13 additions and 1 deletions

View File

@ -2277,7 +2277,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(
@ -2317,6 +2317,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
};