Bug 33789: Add unit test
JD amended patch: Remove biblionumber => 144 Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
14e4a3b5c7
commit
143e0fe8ac
1 changed files with 27 additions and 1 deletions
|
@ -182,7 +182,7 @@ subtest 'outstanding_credits() tests' => sub {
|
||||||
|
|
||||||
subtest 'add_credit() tests' => sub {
|
subtest 'add_credit() tests' => sub {
|
||||||
|
|
||||||
plan tests => 21;
|
plan tests => 22;
|
||||||
|
|
||||||
$schema->storage->txn_begin;
|
$schema->storage->txn_begin;
|
||||||
|
|
||||||
|
@ -294,6 +294,32 @@ subtest 'add_credit() tests' => sub {
|
||||||
# Disable cash registers
|
# Disable cash registers
|
||||||
t::lib::Mocks::mock_preference( 'UseCashRegisters', 0 );
|
t::lib::Mocks::mock_preference( 'UseCashRegisters', 0 );
|
||||||
|
|
||||||
|
my $item = $builder->build_sample_item;
|
||||||
|
|
||||||
|
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;
|
$schema->storage->txn_rollback;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue