From e091e690783fc1688afb5ada295bb0650e735ef3 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 --- 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 b843b40fd1..9da6f59733 100644 --- a/t/db_dependent/Accounts.t +++ b/t/db_dependent/Accounts.t @@ -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; -- 2.11.0