Bugzilla – Attachment 110134 Details for
Bug 26470
itemnumber not available for plugin hook
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26470: Regression tests
Bug-26470-Regression-tests.patch (text/plain), 2.87 KB, created by
David Nind
on 2020-09-15 21:40:00 UTC
(
hide
)
Description:
Bug 26470: Regression tests
Filename:
MIME Type:
Creator:
David Nind
Created:
2020-09-15 21:40:00 UTC
Size:
2.87 KB
patch
obsolete
>From 47d76189476040bd2c264dbac086ca4d413fdd4d Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 15 Sep 2020 16:21:33 -0300 >Subject: [PATCH] Bug 26470: Regression tests > >This patch tweaks the test plugin so it composes an exception based on >the fact that the hook was called with the item and item_id parameters >defined. > >It then makes the tests expect a specific exception message with >information about this. > >To test: >1. Apply this patch >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t >=> FAIL: Tests fail! > >Signed-off-by: David Nind <david@davidnind.com> >--- > 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(-) > >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 bfc83b3f16..44f68ee87f 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 >@@ -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; } >diff --git a/t/lib/Koha/Plugin/Test.pm b/t/lib/Koha/Plugin/Test.pm >index 06b24d619a..0a92967738 100644 >--- a/t/lib/Koha/Plugin/Test.pm >+++ b/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; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26470
:
110119
|
110120
|
110134
|
110135
|
110185
|
110186