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

(-)a/t/db_dependent/Koha/Plugins/Holds_hooks.t (-2 / +46 lines)
Lines 16-22 Link Here
16
16
17
use Modern::Perl;
17
use Modern::Perl;
18
18
19
use Test::More tests => 5;
19
use Test::More tests => 6;
20
use Test::MockModule;
20
use Test::MockModule;
21
use Test::Warn;
21
use Test::Warn;
22
22
Lines 67-72 subtest 'after_hold_create() hook tests' => sub { Link Here
67
    $test_plugin->mock( 'after_item_action',   undef );
67
    $test_plugin->mock( 'after_item_action',   undef );
68
    $test_plugin->mock( 'after_biblio_action', undef );
68
    $test_plugin->mock( 'after_biblio_action', undef );
69
    $test_plugin->mock( 'item_barcode_transform', undef );
69
    $test_plugin->mock( 'item_barcode_transform', undef );
70
    $test_plugin->mock( 'after_hold_action', undef );
70
71
71
    my $biblio = $builder->build_sample_biblio();
72
    my $biblio = $builder->build_sample_biblio();
72
    my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } );
73
    my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } );
Lines 82-87 subtest 'after_hold_create() hook tests' => sub { Link Here
82
    Koha::Plugins::Methods->delete;
83
    Koha::Plugins::Methods->delete;
83
};
84
};
84
85
86
subtest 'after_hold_action (placed) hook tests' => sub {
87
88
    plan tests => 1;
89
90
    $schema->storage->txn_begin;
91
92
    my $plugins = Koha::Plugins->new;
93
    $plugins->InstallPlugins;
94
95
    my $plugin = Koha::Plugin::Test->new->enable;
96
97
    my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
98
99
    t::lib::Mocks::mock_userenv(
100
        {
101
            patron     => $patron,
102
            branchcode => $patron->branchcode
103
        }
104
    );
105
106
    # Avoid testing useless warnings
107
    my $test_plugin = Test::MockModule->new('Koha::Plugin::Test');
108
    $test_plugin->mock( 'after_item_action',   undef );
109
    $test_plugin->mock( 'after_biblio_action', undef );
110
    $test_plugin->mock( 'item_barcode_transform', undef );
111
    $test_plugin->mock( 'after_hold_create', undef );
112
113
    my $biblio = $builder->build_sample_biblio();
114
    my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } );
115
116
    warning_like {
117
        AddReserve(
118
            {   branchcode     => $patron->branchcode,
119
                borrowernumber => $patron->borrowernumber,
120
                biblionumber   => $item_1->biblionumber
121
            }
122
        );
123
    }
124
    qr/after_hold_action called with action: place, ref: Koha::Hold/, 'AddReserve calls the after_hold_action hook';
125
126
    $schema->storage->txn_rollback;
127
    Koha::Plugins::Methods->delete;
128
};
129
85
subtest 'Koha::Hold tests' => sub {
130
subtest 'Koha::Hold tests' => sub {
86
131
87
    plan tests => 4;
132
    plan tests => 4;
88
- 

Return to bug 30180