Bug 21849: Add unit tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 2dbaaa3008)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit aa565b8e99)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 0a6c0c3260)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Kyle M Hall 2018-11-16 09:54:39 -05:00 committed by Fridolin Somers
parent 172fed8521
commit e2e7dc6220
1 changed files with 7 additions and 1 deletions

View File

@ -1865,7 +1865,7 @@ subtest '_FixAccountForLostAndReturned' => sub {
};
subtest '_FixOverduesOnReturn' => sub {
plan tests => 6;
plan tests => 10;
# Generate test biblio
my $title = 'Koha for Dummies';
@ -1918,9 +1918,12 @@ subtest '_FixOverduesOnReturn' => sub {
C4::Circulation::_FixOverduesOnReturn( $patron->{borrowernumber}, $itemnumber, 1 );
$accountline->_result()->discard_changes();
my $offset = Koha::Account::Offsets->search({ debit_id => $accountline->id, type => 'Forgiven' })->next();
is( $accountline->amountoutstanding, '0.000000', 'Fine has been reduced to 0' );
is( $accountline->accounttype, 'FFOR', 'Open fine ( account type FU ) has been set to fine forgiven ( account type FFOR )');
is( ref $offset, "Koha::Account::Offset", "Found matching offset for fine reduction via forgiveness" );
is( $offset->amount, '-99.000000', "Amount of offset is correct" );
## Run again, with dropbox mode enabled
$accountline->set(
@ -1933,9 +1936,12 @@ subtest '_FixOverduesOnReturn' => sub {
C4::Circulation::_FixOverduesOnReturn( $patron->{borrowernumber}, $itemnumber, 0, 1 );
$accountline->_result()->discard_changes();
$offset = Koha::Account::Offsets->search({ debit_id => $accountline->id, type => 'Dropbox' })->next();
is( $accountline->amountoutstanding, '90.000000', 'Fine has been reduced to 90' );
is( $accountline->accounttype, 'F', 'Open fine ( account type FU ) has been closed out ( account type F )');
is( ref $offset, "Koha::Account::Offset", "Found matching offset for fine reduction via dropbox" );
is( $offset->amount, '-9.000000', "Amount of offset is correct" );
};
subtest 'Set waiting flag' => sub {