From 3fc5056b7e5515993db725afbe5dd64654edde87 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Wed, 24 May 2023 18:38:42 +0000 Subject: [PATCH] Bug 33789: Add unit test --- t/db_dependent/Koha/Account.t | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Account.t b/t/db_dependent/Koha/Account.t index fbdb4414c6..72a6e74bc9 100755 --- a/t/db_dependent/Koha/Account.t +++ b/t/db_dependent/Koha/Account.t @@ -182,7 +182,7 @@ subtest 'outstanding_credits() tests' => sub { subtest 'add_credit() tests' => sub { - plan tests => 21; + plan tests => 22; $schema->storage->txn_begin; @@ -294,6 +294,33 @@ subtest 'add_credit() tests' => sub { # Disable cash registers t::lib::Mocks::mock_preference( 'UseCashRegisters', 0 ); + my $item = + $builder->build_sample_item( { biblionumber => 144 } ); + + my $checkout = Koha::Checkout->new( + { + borrowernumber => $patron->id, + itemnumber => $item->id, + date_due => \'NOW()', + branchcode => $patron->branchcode, + issuedate => \'NOW()', + } + )->store(); + + my $line_4 = $account->add_credit( + { + amount => 20, + description => 'Manual credit applied', + library_id => $patron->branchcode, + user_id => $patron->id, + type => 'FORGIVEN', + interface => 'commandline', + issue_id => $checkout->id + } + ); + + is( $line_4->issue_id, $checkout->id, 'The issue ID matches the checkout ID' ); + $schema->storage->txn_rollback; }; -- 2.30.2