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

(-)a/Koha/Plugins/Base.pm (+14 lines)
Lines 272-277 sub _version_compare { Link Here
272
    return 0;
272
    return 0;
273
}
273
}
274
274
275
=head2 is_enabled
276
277
Method that returns wether the plugin is enabled or not
278
279
$plugin->enable
280
281
=cut
282
283
sub is_enabled {
284
    my ($self) = @_;
285
286
    return $self->retrieve_data( '__ENABLED__' );
287
}
288
275
=head2 enable
289
=head2 enable
276
290
277
Method for enabling plugin
291
Method for enabling plugin
(-)a/t/db_dependent/Plugins.t (-2 / +24 lines)
Lines 23-29 use File::Temp qw( tempdir tempfile ); Link Here
23
use FindBin qw($Bin);
23
use FindBin qw($Bin);
24
use Module::Load::Conditional qw(can_load);
24
use Module::Load::Conditional qw(can_load);
25
use Test::MockModule;
25
use Test::MockModule;
26
use Test::More tests => 50;
26
use Test::More tests => 51;
27
27
28
use C4::Context;
28
use C4::Context;
29
use Koha::Database;
29
use Koha::Database;
Lines 109-114 subtest 'Version upgrade tests' => sub { Link Here
109
    $schema->storage->txn_rollback;
109
    $schema->storage->txn_rollback;
110
};
110
};
111
111
112
subtest 'is_enabled() tests' => sub {
113
114
    plan tests => 3;
115
    $schema->storage->txn_begin;
116
117
    # Make sure there's no previous installs or leftovers on DB
118
    Koha::Plugins::Methods->delete;
119
    $schema->resultset('PluginData')->delete;
120
121
    my $plugin = Koha::Plugin::Test->new({ enable_plugins => 1, cgi => CGI->new });
122
    ok( $plugin->is_enabled, 'Plugins enabled by default' );
123
124
    # disable
125
    $plugin->disable;
126
    ok( !$plugin->is_enabled, 'Calling ->disable disables the plugin' );
127
128
    # enable
129
    $plugin->enable;
130
    ok( $plugin->is_enabled, 'Calling ->enable enabled the plugin' );
131
132
    $schema->storage->txn_rollback;
133
};
134
112
$schema->storage->txn_begin;
135
$schema->storage->txn_begin;
113
Koha::Plugins::Methods->delete;
136
Koha::Plugins::Methods->delete;
114
137
115
- 

Return to bug 21073