@@ -, +, @@ $ kshell k$ prove t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t --- t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t | 4 ++-- t/lib/Koha/Plugin/Test.pm | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) --- a/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t +++ a/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t @@ -64,11 +64,11 @@ subtest 'after_biblio_action() and after_item_action() hooks tests' => sub { my $item; warning_like { $item = $builder->build_sample_item({ biblionumber => $biblio_id }); } - qr/after_item_action called with action: create, ref: Koha::Item/, + qr/after_item_action called with action: create, ref: Koha::Item item_id defined: yes itemnumber defined: yes/, 'AddItem calls the hook with action=create'; warning_like { $item->location('shelves')->store; } - qr/after_item_action called with action: modify, ref: Koha::Item/, + 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'; warning_like { $item->delete; } --- a/t/lib/Koha/Plugin/Test.pm +++ a/t/lib/Koha/Plugin/Test.pm @@ -153,7 +153,11 @@ sub after_item_action { my $item_id = $params->{item_id}; if ( $action ne 'delete' ) { - Koha::Exceptions::Exception->throw("after_item_action called with action: $action, ref: " . ref($item) ); + my $itemnumber_defined = (defined $item->itemnumber) ? 'yes' : 'no'; + my $item_id_defined = (defined $item_id) ? 'yes' : 'no'; + Koha::Exceptions::Exception->throw("after_item_action called with action: $action, ref: " . ref($item) . " ". + "item_id defined: $item_id_defined ". + "itemnumber defined: $itemnumber_defined" ); } else { Koha::Exceptions::Exception->throw("after_item_action called with action: $action" ) if $item_id; --