Bug 20325: Do not remove accountlines between tests

This is part of the tests, to make sure they have not been deleted

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2018-04-04 15:36:46 -03:00
parent 373b2f747b
commit 328d5e7007
1 changed files with 4 additions and 3 deletions

View File

@ -798,7 +798,7 @@ subtest "Koha::Account::non_issues_charges tests" => sub {
};
subtest "Koha::Account::non_issues_charges tests" => sub {
plan tests => 6;
plan tests => 9;
my $patron = $builder->build_object(
{
@ -820,8 +820,8 @@ subtest "Koha::Account::non_issues_charges tests" => sub {
my $credit_2 = Koha::Account::Lines->find( $credit->id );
ok( $debit_2, 'Debit was correctly not deleted when credit has balance' );
ok( $credit_2, 'Credit was correctly not deleted when credit has balance' );
is( Koha::Account::Lines->count({ borrowernumber => $patron->id }), 2, "The 2 account lines still exists" );
$dbh->do(q|DELETE FROM accountlines WHERE borrowernumber=?|, undef, $patron->id);
$debit = Koha::Account::Line->new({ borrowernumber => $patron->id, date => '1900-01-01', amountoutstanding => 5 })->store();
$credit = Koha::Account::Line->new({ borrowernumber => $patron->id, date => '1900-01-01', amountoutstanding => 0 })->store();
$offset = Koha::Account::Offset->new({ credit_id => $credit->id, debit_id => $debit->id, type => 'Payment' })->store();
@ -831,8 +831,8 @@ subtest "Koha::Account::non_issues_charges tests" => sub {
$credit_2 = Koha::Account::Lines->find( $credit->id );
ok( $debit_2, 'Debit was correctly not deleted when debit has balance' );
ok( $credit_2, 'Credit was correctly not deleted when debit has balance' );
is( Koha::Account::Lines->count({ borrowernumber => $patron->id }), 2 + 2, "The 2 + 2 account lines still exists" );
$dbh->do(q|DELETE FROM accountlines WHERE borrowernumber=?|, undef, $patron->id);
$debit = Koha::Account::Line->new({ borrowernumber => $patron->id, date => '1900-01-01', amountoutstanding => 0 })->store();
$credit = Koha::Account::Line->new({ borrowernumber => $patron->id, date => '1900-01-01', amountoutstanding => 0 })->store();
$offset = Koha::Account::Offset->new({ credit_id => $credit->id, debit_id => $debit->id, type => 'Payment' })->store();
@ -841,6 +841,7 @@ subtest "Koha::Account::non_issues_charges tests" => sub {
$credit_2 = Koha::Account::Lines->find( $credit->id );
ok( !$debit_2, 'Debit was correctly deleted' );
ok( !$credit_2, 'Credit was correctly deleted' );
is( Koha::Account::Lines->count({ borrowernumber => $patron->id }), 2 + 2, "The 2 + 2 account lines still exists, the last 2 have been deleted ok" );
};
1;