From ebafcc700840a93c9c076819f8e42ad67ea1063d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 4 Apr 2018 15:36:46 -0300 Subject: [PATCH] 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 Conflicts: t/db_dependent/Accounts.t --- t/db_dependent/Accounts.t | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t index 7cd7ce20e0..f245536aa1 100644 --- a/t/db_dependent/Accounts.t +++ b/t/db_dependent/Accounts.t @@ -628,7 +628,7 @@ subtest "Koha::Account::chargelostitem tests" => sub { }; subtest "Koha::Account::non_issues_charges tests" => sub { - plan tests => 6; + plan tests => 9; my $patron = $builder->build_object( { @@ -650,8 +650,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(); @@ -661,8 +661,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(); @@ -671,6 +671,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; -- 2.39.5