Bug 21073: (QA follow-up) Only public subs should be considered
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
f380a06cb9
commit
81186ea269
|
|
@ -136,7 +136,7 @@ sub InstallPlugins {
|
|||
|
||||
Koha::Plugins::Methods->search({ plugin_class => $plugin_class })->delete();
|
||||
|
||||
foreach my $method ( @{ Class::Inspector->methods($plugin_class) } ) {
|
||||
foreach my $method ( @{ Class::Inspector->methods( $plugin_class, 'public' ) } ) {
|
||||
Koha::Plugins::Method->new(
|
||||
{
|
||||
plugin_class => $plugin_class,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ use File::Temp qw( tempdir tempfile );
|
|||
use FindBin qw($Bin);
|
||||
use Module::Load::Conditional qw(can_load);
|
||||
use Test::MockModule;
|
||||
use Test::More tests => 49;
|
||||
use Test::More tests => 50;
|
||||
|
||||
use C4::Context;
|
||||
use Koha::Database;
|
||||
|
|
@ -115,6 +115,7 @@ Koha::Plugins::Methods->delete;
|
|||
Koha::Plugins->new( { enable_plugins => 1 } )->InstallPlugins();
|
||||
|
||||
ok( Koha::Plugins::Methods->search( { plugin_class => 'Koha::Plugin::Test' } )->count, 'Test plugin methods added to database' );
|
||||
is( Koha::Plugins::Methods->search({ plugin_class => 'Koha::Plugin::Test', plugin_method => '_private_sub' })->count, 0, 'Private methods are skipped' );
|
||||
|
||||
my $mock_plugin = Test::MockModule->new( 'Koha::Plugin::Test' );
|
||||
$mock_plugin->mock( 'test_template', sub {
|
||||
|
|
@ -286,4 +287,4 @@ subtest 'new() tests' => sub {
|
|||
is( ref($result), 'Koha::Plugins', 'calling new with enable_plugins makes it override the config' );
|
||||
};
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
$schema->storage->txn_rollback;
|
||||
|
|
|
|||
|
|
@ -182,3 +182,7 @@ sub api_routes {
|
|||
|
||||
return decode_json($spec);
|
||||
}
|
||||
|
||||
sub _private_sub {
|
||||
return "";
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue