From c4ac5eb8e8793d865cc1367a58e4a3d78de78bc4 Mon Sep 17 00:00:00 2001 From: Emily Lamancusa Date: Mon, 21 Oct 2024 09:32:11 -0400 Subject: [PATCH] Bug 37505: (QA follow-up) Adjust tests Signed-off-by: Emily Lamancusa Signed-off-by: Katrin Fischer --- t/db_dependent/Circulation.t | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 009c968c44..01e4526825 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -2600,8 +2600,8 @@ subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub { is( $error->{USERBLOCKEDNOENDDATE}, '9999-12-31', 'USERBLOCKEDNOENDDATE should be 9999-12-31 for unlimited debarments' ); }; -subtest 'CanBookBeIssued + Statistic patrons "X"' => sub { - plan tests => 13; +subtest 'Statistic patrons "X"' => sub { + plan tests => 15; my $library = $builder->build_object( { class => 'Koha::Libraries' } ); my $patron_category_x = $builder->build_object( @@ -2660,6 +2660,13 @@ subtest 'CanBookBeIssued + Statistic patrons "X"' => sub { 'Single entry recorded in the stats table' ); + AddReturn( $item_3->barcode, C4::Context->userenv->{'branch'}, undef, undef, 1 ); + $item_3->discard_changes; + is( + Koha::Statistics->search( { itemnumber => $item_3->itemnumber } )->count, 1, + 'Stats skipped in AddReturn when there was no checkout and skip_localuse was passed' + ); + my $item_4 = $builder->build_sample_item( { library => $library->branchcode } ); AddIssue( $patron_2, $item_4->barcode ); $item_4->discard_changes; @@ -2671,6 +2678,13 @@ subtest 'CanBookBeIssued + Statistic patrons "X"' => sub { $item_4->discard_changes; is( Koha::Statistics->search( { itemnumber => $item_4->itemnumber } )->count, 2, + 'Issue and localuse should be recorded in statistics table for item 4.' + ); + + AddReturn( $item_4->barcode, C4::Context->userenv->{'branch'}, undef, undef, 1 ); + $item_4->discard_changes; + is( + Koha::Statistics->search( { itemnumber => $item_4->itemnumber } )->count, 3, 'Issue, return, and localuse should be recorded in statistics table for item 4.' ); -- 2.39.5