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 <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
c8257a4ecf
commit
2ae5204bfe
2 changed files with 5 additions and 4 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue