Lines 33-39
ok( $plugin->can('configure'), 'Test plugin can configure' );
Link Here
|
33 |
ok( $plugin->can('install'), 'Test plugin can install' ); |
33 |
ok( $plugin->can('install'), 'Test plugin can install' ); |
34 |
ok( $plugin->can('uninstall'), 'Test plugin can install' ); |
34 |
ok( $plugin->can('uninstall'), 'Test plugin can install' ); |
35 |
|
35 |
|
36 |
ok( Koha::Plugins::Handler->run({ class => "Koha::Plugin::Test", method => 'report' }) eq "Koha::Plugin::Test::report", 'Test run plugin report method' ); |
36 |
ok( Koha::Plugins::Handler->run({ class => "Koha::Plugin::Test", method => 'report', enable_plugins => 1 }) eq "Koha::Plugin::Test::report", 'Test run plugin report method' ); |
37 |
|
37 |
|
38 |
my $metadata = $plugin->get_metadata(); |
38 |
my $metadata = $plugin->get_metadata(); |
39 |
ok( $metadata->{'name'} eq 'Test Plugin', 'Test $plugin->get_metadata()' ); |
39 |
ok( $metadata->{'name'} eq 'Test Plugin', 'Test $plugin->get_metadata()' ); |
Lines 41-57
ok( $metadata->{'name'} eq 'Test Plugin', 'Test $plugin->get_metadata()' );
Link Here
|
41 |
ok( $plugin->get_qualified_table_name('mytable') eq 'koha_plugin_test_mytable', 'Test $plugin->get_qualified_table_name()' ); |
41 |
ok( $plugin->get_qualified_table_name('mytable') eq 'koha_plugin_test_mytable', 'Test $plugin->get_qualified_table_name()' ); |
42 |
ok( $plugin->get_plugin_http_path() eq '/plugin/Koha/Plugin/Test', 'Test $plugin->get_plugin_http_path()' ); |
42 |
ok( $plugin->get_plugin_http_path() eq '/plugin/Koha/Plugin/Test', 'Test $plugin->get_plugin_http_path()' ); |
43 |
|
43 |
|
44 |
my @plugins = Koha::Plugins->new()->GetPlugins( 'report' ); |
44 |
my @plugins = Koha::Plugins->new({ enable_plugins => 1 })->GetPlugins( 'report' ); |
45 |
ok( $plugins[0]->get_metadata()->{'name'} eq 'Test Plugin', "Koha::Plugins::GetPlugins functions correctly" ); |
45 |
ok( $plugins[0]->get_metadata()->{'name'} eq 'Test Plugin', "Koha::Plugins::GetPlugins functions correctly" ); |
46 |
|
46 |
|
47 |
my $plugins_dir = C4::Context->config("pluginsdir"); |
47 |
SKIP: { |
48 |
my $ae = Archive::Extract->new( archive => "$Bin/KitchenSinkPlugin.kpz", type => 'zip' ); |
48 |
skip "plugindir not set", 3 unless C4::Context->config("pluginsdir"); |
49 |
unless ( $ae->extract( to => $plugins_dir ) ) { |
49 |
|
50 |
warn "ERROR: " . $ae->error; |
50 |
my $plugins_dir = C4::Context->config("pluginsdir"); |
|
|
51 |
my $ae = Archive::Extract->new( archive => "$Bin/KitchenSinkPlugin.kpz", type => 'zip' ); |
52 |
unless ( $ae->extract( to => $plugins_dir ) ) { |
53 |
warn "ERROR: " . $ae->error; |
54 |
} |
55 |
use_ok('Koha::Plugin::Com::ByWaterSolutions::KitchenSink'); |
56 |
$plugin = Koha::Plugin::Com::ByWaterSolutions::KitchenSink->new({ enable_plugins => 1}); |
57 |
|
58 |
ok( -f $plugins_dir . "/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm", "KitchenSink plugin installed successfully" ); |
59 |
Koha::Plugins::Handler->delete({ class => "Koha::Plugin::Com::ByWaterSolutions::KitchenSink" }); |
60 |
ok( !( -f $plugins_dir . "/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm" ), "Koha::Plugins::Handler::delete works correctly." ); |
51 |
} |
61 |
} |
52 |
use_ok('Koha::Plugin::Com::ByWaterSolutions::KitchenSink'); |
|
|
53 |
$plugin = Koha::Plugin::Com::ByWaterSolutions::KitchenSink->new({ enable_plugins => 1}); |
54 |
|
62 |
|
55 |
ok( -f $plugins_dir . "/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm", "KitchenSink plugin installed successfully" ); |
|
|
56 |
Koha::Plugins::Handler->delete({ class => "Koha::Plugin::Com::ByWaterSolutions::KitchenSink" }); |
57 |
ok( !( -f $plugins_dir . "/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm" ), "Koha::Plugins::Handler::delete works correctly." ); |
58 |
- |