Bugzilla – Attachment 90661 Details for
Bug 21073
Improve plugin performance
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21073: (QA follow-up) Add ->is_enabled and tests
Bug-21073-QA-follow-up-Add--isenabled-and-tests.patch (text/plain), 2.10 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-06-17 11:21:59 UTC
(
hide
)
Description:
Bug 21073: (QA follow-up) Add ->is_enabled and tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-06-17 11:21:59 UTC
Size:
2.10 KB
patch
obsolete
>From fe046ae7b13dea862d4d776a0354881c6208fa77 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 17 Jun 2019 08:06:23 -0300 >Subject: [PATCH] Bug 21073: (QA follow-up) Add ->is_enabled and tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Plugins/Base.pm | 14 ++++++++++++++ > t/db_dependent/Plugins.t | 25 ++++++++++++++++++++++++- > 2 files changed, 38 insertions(+), 1 deletion(-) > >diff --git a/Koha/Plugins/Base.pm b/Koha/Plugins/Base.pm >index 392ab4c900..b311a770db 100644 >--- a/Koha/Plugins/Base.pm >+++ b/Koha/Plugins/Base.pm >@@ -272,6 +272,20 @@ sub _version_compare { > return 0; > } > >+=head2 is_enabled >+ >+Method that returns wether the plugin is enabled or not >+ >+$plugin->enable >+ >+=cut >+ >+sub is_enabled { >+ my ($self) = @_; >+ >+ return $self->retrieve_data( '__ENABLED__' ); >+} >+ > =head2 enable > > Method for enabling plugin >diff --git a/t/db_dependent/Plugins.t b/t/db_dependent/Plugins.t >index 53ae26e06e..5723d02c0a 100755 >--- a/t/db_dependent/Plugins.t >+++ b/t/db_dependent/Plugins.t >@@ -23,7 +23,7 @@ use File::Temp qw( tempdir tempfile ); > use FindBin qw($Bin); > use Module::Load::Conditional qw(can_load); > use Test::MockModule; >-use Test::More tests => 50; >+use Test::More tests => 51; > > use C4::Context; > use Koha::Database; >@@ -109,6 +109,29 @@ subtest 'Version upgrade tests' => sub { > $schema->storage->txn_rollback; > }; > >+subtest 'is_enabled() tests' => sub { >+ >+ plan tests => 3; >+ $schema->storage->txn_begin; >+ >+ # Make sure there's no previous installs or leftovers on DB >+ Koha::Plugins::Methods->delete; >+ $schema->resultset('PluginData')->delete; >+ >+ my $plugin = Koha::Plugin::Test->new({ enable_plugins => 1, cgi => CGI->new }); >+ ok( $plugin->is_enabled, 'Plugins enabled by default' ); >+ >+ # disable >+ $plugin->disable; >+ ok( !$plugin->is_enabled, 'Calling ->disable disables the plugin' ); >+ >+ # enable >+ $plugin->enable; >+ ok( $plugin->is_enabled, 'Calling ->enable enabled the plugin' ); >+ >+ $schema->storage->txn_rollback; >+}; >+ > $schema->storage->txn_begin; > Koha::Plugins::Methods->delete; > >-- >2.22.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21073
:
76955
|
76956
|
76957
|
76958
|
76973
|
88379
|
88380
|
88381
|
89247
|
89251
|
89252
|
89255
|
89256
|
89272
|
89273
|
89274
|
89275
|
89276
|
89277
|
89278
|
89279
|
89786
|
89800
|
89801
|
89802
|
89803
|
89804
|
89805
|
89806
|
89807
|
89808
|
90630
|
90631
|
90650
|
90651
|
90652
|
90653
|
90654
|
90655
|
90656
|
90657
|
90658
|
90659
|
90660
|
90661
|
90662
|
90663
|
90664
|
90724
|
90725
|
90726
|
90727
|
90728
|
90729
|
90730
|
90731
|
90732
|
90733
|
90734
|
90735
|
90736
|
90737
|
90738
|
90739
|
90759
|
90816