use FindBin qw($Bin);
use Module::Load::Conditional qw(can_load);
use Test::MockModule;
-use Test::More tests => 47;
+use Test::More tests => 49;
use C4::Context;
use Koha::Database;
my $plugins = Koha::Plugins->new({ enable_plugins => 1 });
$plugins->InstallPlugins;
- my @plugins = $plugins->GetPlugins({ method => 'report' });
+ my @plugins = $plugins->GetPlugins({ method => 'report', all => 1 });
my @names = map { $_->get_metadata()->{'name'} } @plugins;
is( scalar grep( /^Test Plugin$/, @names), 1, "Koha::Plugins::GetPlugins functions correctly" );
- @plugins = $plugins->GetPlugins({ metadata => { my_example_tag => 'find_me' } });
+ @plugins = $plugins->GetPlugins({ metadata => { my_example_tag => 'find_me' }, all => 1 });
@names = map { $_->get_metadata()->{'name'} } @plugins;
is( scalar @names, 2, "Only two plugins found via a metadata tag" );
$schema->storage->txn_rollback;
};
+subtest 'Version upgrade tests' => sub {
+
+ plan tests => 1;
+
+ $schema->storage->txn_begin;
+
+ my $plugin = Koha::Plugin::Test->new( { enable_plugins => 1, cgi => CGI->new } );
+
+ # make sure there's no version on the DB
+ $schema->resultset('PluginData')
+ ->search( { plugin_class => $plugin->{class}, plugin_key => '__INSTALLED_VERSION__' } )
+ ->delete;
+
+ $plugin = Koha::Plugin::Test->new( { enable_plugins => 1, cgi => CGI->new } );
+ my $version = $plugin->retrieve_data('__INSTALLED_VERSION__');
+
+ is( $version, $plugin->get_metadata->{version}, 'Version has been populated correctly' );
+
+ $schema->storage->txn_rollback;
+};
+
$schema->storage->txn_begin;
Koha::Plugins::Methods->delete;
like($stdout, qr{¡Hola output_html!}, 'Correct data');
};
-subtest 'Version upgrade tests' => sub {
-
- plan tests => 1;
-
- $schema->storage->txn_begin;
-
- my $plugin = Koha::Plugin::Test->new( { enable_plugins => 1, cgi => CGI->new } );
-
- # make sure there's no version on the DB
- $schema->resultset('PluginData')
- ->search( { plugin_class => $plugin->{class}, plugin_key => '__INSTALLED_VERSION__' } )
- ->delete;
-
- $plugin = Koha::Plugin::Test->new( { enable_plugins => 1, cgi => CGI->new } );
- my $version = $plugin->retrieve_data('__INSTALLED_VERSION__');
-
- is( $version, $plugin->get_metadata->{version}, 'Version has been populated correctly' );
-
- $schema->storage->txn_rollback;
-};
-
-
subtest 'Test _version_compare' => sub {
plan tests => 6;
$result = Koha::Plugins->new({ enable_plugins => 1 });
is( ref($result), 'Koha::Plugins', 'calling new with enable_plugins makes it override the config' );
};
+
+$schema->storage->txn_rollback;
\ No newline at end of file