Browse Source

Bug 16496: Add test

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
16.05.x
Jonathan Druart 8 years ago
committed by Kyle M Hall
parent
commit
5cf8bfb360
  1. 40
      t/db_dependent/Circulation.t

40
t/db_dependent/Circulation.t

@ -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;

Loading…
Cancel
Save