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

(-)a/Koha/Plugins.pm (-1 / +1 lines)
Lines 136-142 sub InstallPlugins { Link Here
136
136
137
            Koha::Plugins::Methods->search({ plugin_class => $plugin_class })->delete();
137
            Koha::Plugins::Methods->search({ plugin_class => $plugin_class })->delete();
138
138
139
            foreach my $method ( @{ Class::Inspector->methods($plugin_class) } ) {
139
            foreach my $method ( @{ Class::Inspector->methods( $plugin_class, 'public' ) } ) {
140
                Koha::Plugins::Method->new(
140
                Koha::Plugins::Method->new(
141
                    {
141
                    {
142
                        plugin_class  => $plugin_class,
142
                        plugin_class  => $plugin_class,
(-)a/t/db_dependent/Plugins.t (-2 / +3 lines)
Lines 23-29 use File::Temp qw( tempdir tempfile ); Link Here
23
use FindBin qw($Bin);
23
use FindBin qw($Bin);
24
use Module::Load::Conditional qw(can_load);
24
use Module::Load::Conditional qw(can_load);
25
use Test::MockModule;
25
use Test::MockModule;
26
use Test::More tests => 49;
26
use Test::More tests => 50;
27
27
28
use C4::Context;
28
use C4::Context;
29
use Koha::Database;
29
use Koha::Database;
Lines 115-120 Koha::Plugins::Methods->delete; Link Here
115
Koha::Plugins->new( { enable_plugins => 1 } )->InstallPlugins();
115
Koha::Plugins->new( { enable_plugins => 1 } )->InstallPlugins();
116
116
117
ok( Koha::Plugins::Methods->search( { plugin_class => 'Koha::Plugin::Test' } )->count, 'Test plugin methods added to database' );
117
ok( Koha::Plugins::Methods->search( { plugin_class => 'Koha::Plugin::Test' } )->count, 'Test plugin methods added to database' );
118
is( Koha::Plugins::Methods->search({ plugin_class => 'Koha::Plugin::Test', plugin_method => '_private_sub' })->count, 0, 'Private methods are skipped' );
118
119
119
my $mock_plugin = Test::MockModule->new( 'Koha::Plugin::Test' );
120
my $mock_plugin = Test::MockModule->new( 'Koha::Plugin::Test' );
120
$mock_plugin->mock( 'test_template', sub {
121
$mock_plugin->mock( 'test_template', sub {
Lines 286-289 subtest 'new() tests' => sub { Link Here
286
    is( ref($result), 'Koha::Plugins', 'calling new with enable_plugins makes it override the config' );
287
    is( ref($result), 'Koha::Plugins', 'calling new with enable_plugins makes it override the config' );
287
};
288
};
288
289
289
$schema->storage->txn_rollback;
290
$schema->storage->txn_rollback;
(-)a/t/lib/Koha/Plugin/Test.pm (-1 / +4 lines)
Lines 182-184 sub api_routes { Link Here
182
182
183
    return decode_json($spec);
183
    return decode_json($spec);
184
}
184
}
185
- 
185
186
sub _private_sub {
187
    return "";
188
}

Return to bug 21073