From 7d93405e599a4840f75a9a0fde8884f4f14ff4d9 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 16 Oct 2020 16:30:49 -0300 Subject: [PATCH] Bug 23091: Add tests for \->credits and \->debits Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart --- t/db_dependent/Koha/Account/Line.t | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Account/Line.t b/t/db_dependent/Koha/Account/Line.t index 81b5366041..a2c1715754 100755 --- a/t/db_dependent/Koha/Account/Line.t +++ b/t/db_dependent/Koha/Account/Line.t @@ -615,7 +615,7 @@ subtest 'checkout() tests' => sub { }; subtest 'credits() and debits() tests' => sub { - plan tests => 10; + plan tests => 12; $schema->storage->txn_begin; @@ -670,6 +670,17 @@ subtest 'credits() and debits() tests' => sub { $debit = $debits->next; is($debit->amount + 0, 12, 'Correct second debit'); + throws_ok + { $debit1->debits; } + 'Koha::Exceptions::Account::IsNotCredit', + 'Exception is thrown when requesting debits linked to debit'; + + throws_ok + { $credit1->credits; } + 'Koha::Exceptions::Account::IsNotDebit', + 'Exception is thrown when requesting credits linked to credit'; + + $schema->storage->txn_rollback; }; -- 2.39.2