Bug 23091: Add tests for \->credits and \->debits
authorTomas Cohen Arazi <tomascohen@theke.io>
Fri, 16 Oct 2020 19:30:49 +0000 (16:30 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 6 Nov 2020 14:55:17 +0000 (15:55 +0100)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
t/db_dependent/Koha/Account/Line.t

index 81b5366..a2c1715 100755 (executable)
@@ -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;
 };