From b813a6c38a0b23b2c8fd856afa99ebfad1955843 Mon Sep 17 00:00:00 2001
From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Date: Tue, 28 Sep 2021 11:50:22 +0000
Subject: [PATCH] Bug 27155: Include identifier test in
Biblio_and_Items_plugin_hooks.t
Content-Type: text/plain; charset=utf-8
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 <m.de.rooy@rijksmuseum.nl>
---
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 36565397b7..8ca9babff4 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.20.1