From 819557e65d7596c53eb518757927fa7d4b6c9b43 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 6 Jul 2018 09:11:32 -0300 Subject: [PATCH] Bug 20978: (QA follow-up) Do not delete existing data on tests Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/Koha/Account.t | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/t/db_dependent/Koha/Account.t b/t/db_dependent/Koha/Account.t index cfc14addf7..21f0e62191 100755 --- a/t/db_dependent/Koha/Account.t +++ b/t/db_dependent/Koha/Account.t @@ -124,8 +124,8 @@ subtest 'add_credit() tests' => sub { $schema->storage->txn_begin; # delete logs and statistics - $schema->resultset('ActionLog')->search()->delete(); - $schema->resultset('Statistic')->search()->delete(); + my $action_logs = $schema->resultset('ActionLog')->search()->count; + my $statistics = $schema->resultset('Statistic')->search()->count; my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); my $account = Koha::Account->new( { patron_id => $patron->borrowernumber } ); @@ -146,8 +146,8 @@ subtest 'add_credit() tests' => sub { ); is( $account->balance, -25, 'Patron has a balance of -25' ); - is( $schema->resultset('ActionLog')->count(), 0, 'No log was added' ); - is( $schema->resultset('Statistic')->count(), 1, 'Action added to statistics' ); + is( $schema->resultset('ActionLog')->count(), $action_logs + 0, 'No log was added' ); + is( $schema->resultset('Statistic')->count(), $statistics + 1, 'Action added to statistics' ); is( $line_1->accounttype, $Koha::Account::account_type->{'payment'}, 'Account type is correctly set' ); # Enable logs @@ -165,8 +165,8 @@ subtest 'add_credit() tests' => sub { ); is( $account->balance, -62, 'Patron has a balance of -25' ); - is( $schema->resultset('ActionLog')->count(), 1, 'Log was added' ); - is( $schema->resultset('Statistic')->count(), 2, 'Action added to statistics' ); + is( $schema->resultset('ActionLog')->count(), $action_logs + 1, 'Log was added' ); + is( $schema->resultset('Statistic')->count(), $statistics + 2, 'Action added to statistics' ); is( $line_2->accounttype, $Koha::Account::account_type->{'payment'} . $sip_code, 'Account type is correctly set' ); # offsets have the credit_id set to accountlines_id, and debit_id is undef @@ -187,8 +187,8 @@ subtest 'add_credit() tests' => sub { } ); - is( $schema->resultset('ActionLog')->count(), 2, 'Log was added' ); - is( $schema->resultset('Statistic')->count(), 2, 'No action added to statistics, because of credit type' ); + is( $schema->resultset('ActionLog')->count(), $action_logs + 2, 'Log was added' ); + is( $schema->resultset('Statistic')->count(), $statistics + 2, 'No action added to statistics, because of credit type' ); $schema->storage->txn_rollback; }; -- 2.18.0