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

(-)a/Koha/Plugins/Handler.pm (-2 / +2 lines)
Lines 25-30 use File::Path qw( remove_tree ); Link Here
25
use Module::Load qw( load );
25
use Module::Load qw( load );
26
26
27
use C4::Context;
27
use C4::Context;
28
use Koha::Plugins;
28
use Koha::Plugins::Methods;
29
use Koha::Plugins::Methods;
29
30
30
BEGIN {
31
BEGIN {
Lines 101-108 sub delete { Link Here
101
        enable_plugins => $args->{enable_plugins},
102
        enable_plugins => $args->{enable_plugins},
102
    });
103
    });
103
104
104
    C4::Context->dbh->do( "DELETE FROM plugin_data WHERE plugin_class = ?", undef, ($plugin_class) );
105
    Koha::Plugins->RemovePlugins( { plugin_class => $plugin_class } );
105
    Koha::Plugins::Methods->search({ plugin_class => $plugin_class })->delete();
106
106
107
    unlink "$plugin_path.pm" or warn "Could not unlink $plugin_path.pm: $!";
107
    unlink "$plugin_path.pm" or warn "Could not unlink $plugin_path.pm: $!";
108
    remove_tree($plugin_path);
108
    remove_tree($plugin_path);
(-)a/t/db_dependent/Koha/Plugins/Account_hooks.t (-1 / +1 lines)
Lines 69-74 subtest 'Koha::Account tests' => sub { Link Here
69
    qr/after_account_action called with action: add_credit, type: payment, ref: Koha::Account::Line/,
69
    qr/after_account_action called with action: add_credit, type: payment, ref: Koha::Account::Line/,
70
      '->add_credit calls the after_account_action hook with type payment';
70
      '->add_credit calls the after_account_action hook with type payment';
71
71
72
    Koha::Plugins::Methods->delete;
72
    Koha::Plugins->RemovePlugins;
73
    $schema->storage->txn_rollback;
73
    $schema->storage->txn_rollback;
74
};
74
};
(-)a/t/db_dependent/Koha/Plugins/BackgroundJob.t (-1 / +1 lines)
Lines 85-89 subtest 'background_tasks() hooks tests' => sub { Link Here
85
    is_deeply( $tasks, $bj->core_types_to_classes, 'Only core mapping returned when plugins disabled' );
85
    is_deeply( $tasks, $bj->core_types_to_classes, 'Only core mapping returned when plugins disabled' );
86
86
87
    $schema->storage->txn_rollback;
87
    $schema->storage->txn_rollback;
88
    Koha::Plugins::Methods->delete;
88
    Koha::Plugins->RemovePlugins;
89
};
89
};
(-)a/t/db_dependent/Koha/Plugins/Barcode_transform_hooks.t (-1 / +1 lines)
Lines 100-104 subtest 'patron_barcode_transform() and item_barcode_transform() hook tests' => Link Here
100
        'Koha::Item->store calls the item_barcode_transform hook';
100
        'Koha::Item->store calls the item_barcode_transform hook';
101
101
102
    $schema->storage->txn_rollback;
102
    $schema->storage->txn_rollback;
103
    Koha::Plugins::Methods->delete;
103
    Koha::Plugins->RemovePlugins;
104
};
104
};
(-)a/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t (-1 / +1 lines)
Lines 84-88 subtest 'after_biblio_action() and after_item_action() hooks tests' => sub { Link Here
84
            'DelBiblio calls the hook with action=delete biblio_id passed';
84
            'DelBiblio calls the hook with action=delete biblio_id passed';
85
85
86
    $schema->storage->txn_rollback;
86
    $schema->storage->txn_rollback;
87
    Koha::Plugins::Methods->delete;
87
    Koha::Plugins->RemovePlugins;
88
};
88
};
(-)a/t/db_dependent/Koha/Plugins/Circulation_hooks.t (-1 / +1 lines)
Lines 121-125 subtest 'after_circ_action() hook tests' => sub { Link Here
121
    };
121
    };
122
122
123
    $schema->storage->txn_rollback;
123
    $schema->storage->txn_rollback;
124
    Koha::Plugins::Methods->delete;
124
    Koha::Plugins->RemovePlugins;
125
};
125
};
(-)a/t/db_dependent/Koha/Plugins/Holds_hooks.t (-3 / +3 lines)
Lines 80-86 subtest 'after_hold_create() hook tests' => sub { Link Here
80
          qr/after_hold_create called with parameter Koha::Hold/ ],
80
          qr/after_hold_create called with parameter Koha::Hold/ ],
81
          'AddReserve calls the after_hold_create hook, deprecation warning found';
81
          'AddReserve calls the after_hold_create hook, deprecation warning found';
82
82
83
    Koha::Plugins::Methods->delete;
83
    Koha::Plugins->RemovePlugins;
84
    $schema->storage->txn_rollback;
84
    $schema->storage->txn_rollback;
85
};
85
};
86
86
Lines 124-130 subtest 'after_hold_action (placed) hook tests' => sub { Link Here
124
    }
124
    }
125
    [ qr/after_hold_create is deprecated and will be removed soon/, qr/after_hold_action called with action: place, ref: Koha::Hold/,  ], 'AddReserve calls the after_hold_action hook';
125
    [ qr/after_hold_create is deprecated and will be removed soon/, qr/after_hold_action called with action: place, ref: Koha::Hold/,  ], 'AddReserve calls the after_hold_action hook';
126
126
127
    Koha::Plugins::Methods->delete;
127
    Koha::Plugins->RemovePlugins;
128
    $schema->storage->txn_rollback;
128
    $schema->storage->txn_rollback;
129
};
129
};
130
130
Lines 205-210 subtest 'Koha::Hold tests' => sub { Link Here
205
    qr/after_hold_action called with action: cancel, ref: Koha::Old::Hold/,
205
    qr/after_hold_action called with action: cancel, ref: Koha::Old::Hold/,
206
      '->cancel calls the after_hold_action hook';
206
      '->cancel calls the after_hold_action hook';
207
207
208
    Koha::Plugins::Methods->delete;
208
    Koha::Plugins->RemovePlugins;
209
    $schema->storage->txn_rollback;
209
    $schema->storage->txn_rollback;
210
};
210
};
(-)a/t/db_dependent/Koha/Plugins/Patron.t (-1 / +1 lines)
Lines 88-94 subtest 'check_password hook tests' => sub { Link Here
88
    ok( $patron->set_password({ password => 'explosion', skip_validation => 1}), 'Patron password updated via skip validation');
88
    ok( $patron->set_password({ password => 'explosion', skip_validation => 1}), 'Patron password updated via skip validation');
89
89
90
    $schema->storage->txn_rollback;
90
    $schema->storage->txn_rollback;
91
    Koha::Plugins::Methods->delete;
91
    Koha::Plugins->RemovePlugins;
92
};
92
};
93
93
94
1;
94
1;
(-)a/t/db_dependent/Koha/Plugins/Plugins.t (-11 / +6 lines)
Lines 56-63 subtest 'call() tests' => sub { Link Here
56
56
57
    $schema->storage->txn_begin;
57
    $schema->storage->txn_begin;
58
    # Temporarily remove any installed plugins data
58
    # Temporarily remove any installed plugins data
59
    Koha::Plugins::Methods->delete;
59
    Koha::Plugins->RemovePlugins;
60
    $schema->resultset('PluginData')->delete();
61
60
62
    t::lib::Mocks::mock_config('enable_plugins', 1);
61
    t::lib::Mocks::mock_config('enable_plugins', 1);
63
    my $plugins = Koha::Plugins->new({ enable_plugins => 1 });
62
    my $plugins = Koha::Plugins->new({ enable_plugins => 1 });
Lines 94-101 subtest 'more call() tests' => sub { Link Here
94
93
95
    $schema->storage->txn_begin;
94
    $schema->storage->txn_begin;
96
    # Temporarily remove any installed plugins data
95
    # Temporarily remove any installed plugins data
97
    Koha::Plugins::Methods->delete;
96
    Koha::Plugins->RemovePlugins;
98
    $schema->resultset('PluginData')->delete();
99
97
100
    t::lib::Mocks::mock_config('enable_plugins', 1);
98
    t::lib::Mocks::mock_config('enable_plugins', 1);
101
    my $plugins = Koha::Plugins->new({ enable_plugins => 1 });
99
    my $plugins = Koha::Plugins->new({ enable_plugins => 1 });
Lines 137-144 subtest 'feature_enabled tests' => sub { Link Here
137
    $schema->storage->txn_begin;
135
    $schema->storage->txn_begin;
138
136
139
    # Temporarily remove any installed plugins data
137
    # Temporarily remove any installed plugins data
140
    Koha::Plugins::Methods->delete;
138
    Koha::Plugins->RemovePlugins;
141
    $schema->resultset('PluginData')->delete();
142
139
143
    t::lib::Mocks::mock_config( 'enable_plugins', 0 );
140
    t::lib::Mocks::mock_config( 'enable_plugins', 0 );
144
    my $enabled = Koha::Plugins->feature_enabled('check_password');
141
    my $enabled = Koha::Plugins->feature_enabled('check_password');
Lines 169-175 subtest 'GetPlugins() tests' => sub { Link Here
169
166
170
    $schema->storage->txn_begin;
167
    $schema->storage->txn_begin;
171
    # Temporarily remove any installed plugins data
168
    # Temporarily remove any installed plugins data
172
    Koha::Plugins::Methods->delete;
169
    Koha::Plugins->RemovePlugins;
173
170
174
    my $plugins = Koha::Plugins->new({ enable_plugins => 1 });
171
    my $plugins = Koha::Plugins->new({ enable_plugins => 1 });
175
172
Lines 214-221 subtest 'is_enabled() tests' => sub { Link Here
214
    $schema->storage->txn_begin;
211
    $schema->storage->txn_begin;
215
212
216
    # Make sure there's no previous installs or leftovers on DB
213
    # Make sure there's no previous installs or leftovers on DB
217
    Koha::Plugins::Methods->delete;
214
    Koha::Plugins->RemovePlugins;
218
    $schema->resultset('PluginData')->delete;
219
215
220
    my $plugin = Koha::Plugin::Test->new({ enable_plugins => 1, cgi => CGI->new });
216
    my $plugin = Koha::Plugin::Test->new({ enable_plugins => 1, cgi => CGI->new });
221
    ok( $plugin->is_enabled, 'Plugins enabled by default' );
217
    ok( $plugin->is_enabled, 'Plugins enabled by default' );
Lines 233-240 subtest 'is_enabled() tests' => sub { Link Here
233
229
234
subtest 'Koha::Plugin::Test' => sub {
230
subtest 'Koha::Plugin::Test' => sub {
235
    $schema->storage->txn_begin;
231
    $schema->storage->txn_begin;
236
    Koha::Plugins::Methods->delete;
232
    Koha::Plugins->RemovePlugins;
237
    $schema->resultset('PluginData')->delete;
238
233
239
    warning_is { Koha::Plugins->new( { enable_plugins => 1 } )->InstallPlugins(); } undef;
234
    warning_is { Koha::Plugins->new( { enable_plugins => 1 } )->InstallPlugins(); } undef;
240
235
(-)a/t/db_dependent/Koha/Plugins/Recall_hooks.t (-2 / +1 lines)
Lines 26-32 use t::lib::TestBuilder; Link Here
26
use Koha::Database;
26
use Koha::Database;
27
use C4::Circulation qw();
27
use C4::Circulation qw();
28
use Koha::CirculationRules;
28
use Koha::CirculationRules;
29
use Koha::Plugins::Methods;
30
use Koha::Recalls;
29
use Koha::Recalls;
31
30
32
BEGIN {
31
BEGIN {
Lines 95-100 subtest 'after_recall_action hook' => sub { Link Here
95
    qr/after_recall_action called with action: add, ref: Koha::Recall/,
94
    qr/after_recall_action called with action: add, ref: Koha::Recall/,
96
      '->add_recall calls the after_recall_action hook with action add';
95
      '->add_recall calls the after_recall_action hook with action add';
97
96
98
    Koha::Plugins::Methods->delete;
97
    Koha::Plugins->RemovePlugins;
99
    $schema->storage->txn_rollback;
98
    $schema->storage->txn_rollback;
100
};
99
};
(-)a/t/db_dependent/Koha/Plugins/authority_hooks.t (-1 / +1 lines)
Lines 66-70 subtest 'after_authority_action hook' => sub { Link Here
66
            'DelAuthority calls the hook with action=delete, id passed';
66
            'DelAuthority calls the hook with action=delete, id passed';
67
67
68
    $schema->storage->txn_rollback;
68
    $schema->storage->txn_rollback;
69
    Koha::Plugins::Methods->delete;
69
    Koha::Plugins->RemovePlugins;
70
};
70
};
(-)a/t/db_dependent/Koha/REST/Plugin/PluginRoutes.t (-2 / +2 lines)
Lines 234-240 subtest 'needs_install use case tests' => sub { Link Here
234
234
235
    t::lib::Mocks::mock_preference('Version', '3.0.0');
235
    t::lib::Mocks::mock_preference('Version', '3.0.0');
236
236
237
    $schema->resultset('PluginData')->delete;
237
    Koha::Plugins->RemovePlugins;
238
    $plugins = Koha::Plugins->new;
238
    $plugins->InstallPlugins;
239
    $plugins->InstallPlugins;
239
240
240
    # re-initialize Koha::REST::V1 after mocking
241
    # re-initialize Koha::REST::V1 after mocking
241
- 

Return to bug 35536