From 5fdc66ba03331a249290e13af655dfd0fde25894 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 Signed-off-by: Marion Durand --- 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 267c831a71..94c4362d29 100755 --- a/t/db_dependent/Circulation/ReturnClaims.t +++ b/t/db_dependent/Circulation/ReturnClaims.t @@ -18,7 +18,7 @@ use Modern::Perl; use Test::NoWarnings; -use Test::More tests => 6; +use Test::More tests => 7; use Test::MockModule; use Test::Warn; @@ -115,6 +115,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.5