From 3d5ea8d426123e190369fafc35576096ebf96a3d Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Tue, 28 Sep 2021 11:50:22 +0000 Subject: [PATCH] Bug 27155: Include identifier test in Biblio_and_Items_plugin_hooks.t The biblio and item action hooks pass a biblionumber or itemnumber now to the plugin at time of deletion. This patch adds a tiny refinement to Biblio_and_Items_plugin_hooks.t and the associated test plugin to be sure of that. Test plan: Run t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t | 5 +++-- t/lib/Koha/Plugin/Test.pm | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t b/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t index 44f68ee87f..18292a02a7 100755 --- a/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t +++ b/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t @@ -71,12 +71,13 @@ subtest 'after_biblio_action() and after_item_action() hooks tests' => sub { qr/after_item_action called with action: modify, ref: Koha::Item item_id defined: yes itemnumber defined: yes/, 'ModItem calls the hook with action=modify'; + my $itemnumber = $item->id; warning_like { $item->delete; } - qr/after_item_action called with action: delete/, + qr/after_item_action called with action: delete, id: $itemnumber/, 'DelItem calls the hook with action=delete, item_id passed'; warning_like { C4::Biblio::DelBiblio( $biblio_id ); } - qr/after_biblio_action called with action: delete/, + qr/after_biblio_action called with action: delete, id: $biblio_id/, 'DelBiblio calls the hook with action=delete biblio_id passed'; $schema->storage->txn_rollback; diff --git a/t/lib/Koha/Plugin/Test.pm b/t/lib/Koha/Plugin/Test.pm index 1c296b0595..b08ac89954 100644 --- a/t/lib/Koha/Plugin/Test.pm +++ b/t/lib/Koha/Plugin/Test.pm @@ -142,7 +142,7 @@ sub after_biblio_action { Koha::Exceptions::Exception->throw("after_biblio_action called with action: $action, ref: " . ref($biblio) ); } else { - Koha::Exceptions::Exception->throw("after_biblio_action called with action: $action") if $biblio_id; + Koha::Exceptions::Exception->throw("after_biblio_action called with action: $action, id: $biblio_id") if $biblio_id; } } @@ -160,7 +160,7 @@ sub after_item_action { "itemnumber defined: $itemnumber_defined" ); } else { - Koha::Exceptions::Exception->throw("after_item_action called with action: $action" ) if $item_id; + Koha::Exceptions::Exception->throw("after_item_action called with action: $action, id: $item_id" ) if $item_id; } } -- 2.39.5