Bug 16496: Add test

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-05-11 10:24:13 +01:00 committed by Kyle M Hall
parent b79107a49a
commit 5cf8bfb360
1 changed files with 39 additions and 1 deletions

View File

@ -30,7 +30,7 @@ use Koha::Database;
use t::lib::TestBuilder;
use Test::More tests => 83;
use Test::More tests => 84;
BEGIN {
use_ok('C4::Circulation');
@ -870,4 +870,42 @@ C4::Context->dbh->do("DELETE FROM accountlines");
is( $error, 'onsite_checkout', 'A correct error code should be returned by CanBookBeRenewed for on-site checkout' );
}
{
my $library = $builder->build({ source => 'Branch' });
my $biblio = MARC::Record->new();
my ($biblionumber, $biblioitemnumber) = AddBiblio($biblio, '');
my $barcode = 'just a barcode';
my ( undef, undef, $itemnumber ) = AddItem(
{
homebranch => $library->{branchcode},
holdingbranch => $library->{branchcode},
barcode => $barcode,
},
$biblionumber,
);
my $patron = $builder->build({ source => 'Borrower', value => { branchcode => $library->{branchcode} } } );
my $issue = AddIssue( GetMember( borrowernumber => $patron->{borrowernumber} ), $barcode );
UpdateFine(
{
issue_id => $issue->id(),
itemnumber => $itemnumber,
borrowernumber => $patron->{borrowernumber},
amount => 1,
}
);
UpdateFine(
{
issue_id => $issue->id(),
itemnumber => $itemnumber,
borrowernumber => $patron->{borrowernumber},
amount => 2,
}
);
is( Koha::Account::Lines->search({ issue_id => $issue->id })->count, 1, 'UpdateFine should not create a new accountline when updating an existing fine');
}
1;