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

(-)a/Koha/Plugins/Base.pm (-5 / +2 lines)
Lines 60-68 sub new { Link Here
60
60
61
=head2 store_data
61
=head2 store_data
62
62
63
set_data allows a plugin to store key value pairs in the database for future use.
63
store_data allows a plugin to store key value pairs in the database for future use.
64
64
65
usage: $self->set_data({ param1 => 'param1val', param2 => 'param2value' })
65
usage: $self->store_data({ param1 => 'param1val', param2 => 'param2value' })
66
66
67
=cut
67
=cut
68
68
Lines 108-116 C4:Template, but at the moment, it does not. Link Here
108
sub get_template {
108
sub get_template {
109
    my ( $self, $args ) = @_;
109
    my ( $self, $args ) = @_;
110
110
111
    #    my $template =
112
    #      C4::Templates->new( my $interface = 'intranet', my $filename = $self->mbf_path( $args->{'file'} ), my $tmplbase = '', my $query = $self->{'cgi'} );
113
114
    my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
111
    my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
115
        {   template_name   => $self->mbf_path( $args->{'file'} ),
112
        {   template_name   => $self->mbf_path( $args->{'file'} ),
116
            query           => $self->{'cgi'},
113
            query           => $self->{'cgi'},
(-)a/t/db_dependent/Plugins.t (-3 / +18 lines)
Lines 5-11 use warnings; Link Here
5
5
6
use Test::More tests => 16;
6
use Test::More tests => 16;
7
use File::Basename;
7
use File::Basename;
8
8
use FindBin qw($Bin);
9
use Archive::Extract;
9
use Module::Load::Conditional qw(can_load);
10
use Module::Load::Conditional qw(can_load);
10
11
11
use C4::Context;
12
use C4::Context;
Lines 38-41 my $metadata = $plugin->get_metadata(); Link Here
38
ok( $metadata->{'name'} eq 'Test Plugin', 'Test $plugin->get_metadata()' );
39
ok( $metadata->{'name'} eq 'Test Plugin', 'Test $plugin->get_metadata()' );
39
40
40
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()' );
41
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
44
my $plugins_dir = C4::Context->config("pluginsdir");
45
my $ae = Archive::Extract->new( archive => "$Bin/KitchenSinkPlugin.kpz", type => 'zip' );
46
unless ( $ae->extract( to => $plugins_dir ) ) {
47
    warn "ERROR: " . $ae->error;
48
}
49
use_ok('Koha::Plugin::Com::ByWaterSolutions::KitchenSink');
50
$plugin = Koha::Plugin::Com::ByWaterSolutions::KitchenSink->new({ enable_plugins => 1});
51
52
$plugin->store_data({ 'test_data' => 'my test' });
53
ok( $plugin->retrieve_data( 'test_data' ) eq 'my test', "store_data & retrieve_data function correctly" );
54
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." );
42
- 

Return to bug 7804