From eb9ba8ea664a05aaae3d8b3e39e0d4f07878c330 Mon Sep 17 00:00:00 2001 From: Sam Lau Date: Tue, 9 Jul 2024 18:27:05 +0000 Subject: [PATCH] Bug 25733: Unit tests prove t/db_dependent/Circulation/ReturnClaims.t --- t/db_dependent/Circulation/ReturnClaims.t | 25 ++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Circulation/ReturnClaims.t b/t/db_dependent/Circulation/ReturnClaims.t index 6fb1c8d176..c0298c245c 100755 --- a/t/db_dependent/Circulation/ReturnClaims.t +++ b/t/db_dependent/Circulation/ReturnClaims.t @@ -17,7 +17,7 @@ use Modern::Perl; -use Test::More tests => 3; +use Test::More tests => 4; use Test::MockModule; use Test::Warn; @@ -114,6 +114,29 @@ subtest 'Test Koha::Patronn::return_claims' => sub { ok( $claim->created_on, "Claim created_on is set" ); }; +subtest 'Test Koha::Patron::unresolved_return_claims' => sub { + plan tests => 2; + + my $item = $builder->build_sample_item; + my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); + my $checkout = AddIssue( $patron, $item->barcode ); + my $librarian = $builder->build_object( { class => 'Koha::Patrons' } ); + + my $claim = $checkout->claim_returned( + { + created_by => $patron->id, + notes => "Test note", + } + ); + + my $unresolved_claims = $patron->unresolved_return_claims; + is( $unresolved_claims->count, 1, "Got back correct number of unresolved claims" ); + + $claim->resolve( { resolution => "X", resolved_by => $librarian } ); + is( $unresolved_claims->count, 0, "Claim is now resolved, so the count is 0" ); + +}; + subtest 'Test Koha::Checkout::claim_returned, mark as returned' => sub { plan tests => 8; -- 2.39.2