@@ -, +, @@ --- Koha/Plugins/Base.pm | 7 ++----- t/db_dependent/KitchenSinkPlugin.kpz | Bin 0 -> 74771 bytes t/db_dependent/Plugins.t | 22 +++++++++++++++++++--- 3 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 t/db_dependent/KitchenSinkPlugin.kpz --- a/Koha/Plugins/Base.pm +++ a/Koha/Plugins/Base.pm @@ -60,9 +60,9 @@ sub new { =head2 store_data -set_data allows a plugin to store key value pairs in the database for future use. +store_data allows a plugin to store key value pairs in the database for future use. -usage: $self->set_data({ param1 => 'param1val', param2 => 'param2value' }) +usage: $self->store_data({ param1 => 'param1val', param2 => 'param2value' }) =cut @@ -108,9 +108,6 @@ C4:Template, but at the moment, it does not. sub get_template { my ( $self, $args ) = @_; - # my $template = - # C4::Templates->new( my $interface = 'intranet', my $filename = $self->mbf_path( $args->{'file'} ), my $tmplbase = '', my $query = $self->{'cgi'} ); - my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { template_name => $self->mbf_path( $args->{'file'} ), query => $self->{'cgi'}, --- a/t/db_dependent/Plugins.t +++ a/t/db_dependent/Plugins.t @@ -3,9 +3,10 @@ use strict; use warnings; -use Test::More tests => 16; +use Test::More tests => 20; use File::Basename; - +use FindBin qw($Bin); +use Archive::Extract; use Module::Load::Conditional qw(can_load); use C4::Context; @@ -38,4 +39,19 @@ my $metadata = $plugin->get_metadata(); ok( $metadata->{'name'} eq 'Test Plugin', 'Test $plugin->get_metadata()' ); ok( $plugin->get_qualified_table_name('mytable') eq 'koha_plugin_test_mytable', 'Test $plugin->get_qualified_table_name()' ); -ok( $plugin->get_plugin_http_path() eq '/plugin/Koha/Plugin/Test', 'Test $plugin->get_plugin_http_path()' ); +ok( $plugin->get_plugin_http_path() eq '/plugin/Koha/Plugin/Test', 'Test $plugin->get_plugin_http_path()' ); + +my @plugins = Koha::Plugins->new()->GetPlugins( 'report' ); +ok( $plugins[0]->get_metadata()->{'name'} eq 'Test Plugin', "Koha::Plugins::GetPlugins functions correctly" ); + +my $plugins_dir = C4::Context->config("pluginsdir"); +my $ae = Archive::Extract->new( archive => "$Bin/KitchenSinkPlugin.kpz", type => 'zip' ); +unless ( $ae->extract( to => $plugins_dir ) ) { + warn "ERROR: " . $ae->error; +} +use_ok('Koha::Plugin::Com::ByWaterSolutions::KitchenSink'); +$plugin = Koha::Plugin::Com::ByWaterSolutions::KitchenSink->new({ enable_plugins => 1}); + +ok( -f $plugins_dir . "/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm", "KitchenSink plugin installed successfully" ); +Koha::Plugins::Handler->delete({ class => "Koha::Plugin::Com::ByWaterSolutions::KitchenSink" }); +ok( !( -f $plugins_dir . "/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm" ), "Koha::Plugins::Handler::delete works correctly." ); --