Bug 21468: Unit tests for AddReturn
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 6 Jul 2020 12:46:15 +0000 (13:46 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 30 Jul 2020 15:30:24 +0000 (17:30 +0200)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

t/db_dependent/Koha/Plugins/Circulation_hooks.t

index a081af1..97bee3d 100755 (executable)
@@ -44,7 +44,7 @@ t::lib::Mocks::mock_config( 'enable_plugins', 1 );
 
 subtest 'after_circ_action() hook tests' => sub {
 
-    plan tests => 2;
+    plan tests => 3;
 
     $schema->storage->txn_begin;
 
@@ -88,6 +88,17 @@ subtest 'after_circ_action() hook tests' => sub {
                 'AddRenewal calls the after_circ_action hook';
     };
 
+    subtest 'AddReturn' => sub {
+        plan tests => 1;
+
+        warning_like {
+            AddReturn( $patron->borrowernumber, $item->id,
+                $patron->branchcode );
+        }
+        qr/after_circ_action called with action: checkin, ref: DateTime/,
+          'AddReturn calls the after_circ_action hook';
+    };
+
     $schema->storage->txn_rollback;
     Koha::Plugins::Methods->delete;
 };