View | Details | Raw Unified | Return to bug 26470
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t (-2 / +2 lines)
Lines 64-74 subtest 'after_biblio_action() and after_item_action() hooks tests' => sub { Link Here
64
64
65
    my $item;
65
    my $item;
66
    warning_like { $item = $builder->build_sample_item({ biblionumber => $biblio_id }); }
66
    warning_like { $item = $builder->build_sample_item({ biblionumber => $biblio_id }); }
67
            qr/after_item_action called with action: create, ref: Koha::Item/,
67
            qr/after_item_action called with action: create, ref: Koha::Item item_id defined: yes itemnumber defined: yes/,
68
            'AddItem calls the hook with action=create';
68
            'AddItem calls the hook with action=create';
69
69
70
    warning_like { $item->location('shelves')->store; }
70
    warning_like { $item->location('shelves')->store; }
71
            qr/after_item_action called with action: modify, ref: Koha::Item/,
71
            qr/after_item_action called with action: modify, ref: Koha::Item item_id defined: yes itemnumber defined: yes/,
72
            'ModItem calls the hook with action=modify';
72
            'ModItem calls the hook with action=modify';
73
73
74
    warning_like { $item->delete; }
74
    warning_like { $item->delete; }
(-)a/t/lib/Koha/Plugin/Test.pm (-2 / +5 lines)
Lines 153-159 sub after_item_action { Link Here
153
    my $item_id = $params->{item_id};
153
    my $item_id = $params->{item_id};
154
154
155
    if ( $action ne 'delete' ) {
155
    if ( $action ne 'delete' ) {
156
        Koha::Exceptions::Exception->throw("after_item_action called with action: $action, ref: " . ref($item) );
156
        my $itemnumber_defined = (defined $item->itemnumber) ? 'yes' : 'no';
157
        my $item_id_defined    = (defined $item_id) ? 'yes' : 'no';
158
        Koha::Exceptions::Exception->throw("after_item_action called with action: $action, ref: " . ref($item) . " ".
159
                                           "item_id defined: $item_id_defined ".
160
                                           "itemnumber defined: $itemnumber_defined" );
157
    }
161
    }
158
    else {
162
    else {
159
        Koha::Exceptions::Exception->throw("after_item_action called with action: $action" ) if $item_id;
163
        Koha::Exceptions::Exception->throw("after_item_action called with action: $action" ) if $item_id;
160
- 

Return to bug 26470