Bugzilla – Attachment 166742 Details for
Bug 34978
Add --include and --exclude options to install_plugins.pl to choose the plugins to install
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34978: (follow-up) Add exception when plugin to install is not found and fix unit test
Bug-34978-follow-up-Add-exception-when-plugin-to-i.patch (text/plain), 3.50 KB, created by
Hammat wele
on 2024-05-14 20:28:26 UTC
(
hide
)
Description:
Bug 34978: (follow-up) Add exception when plugin to install is not found and fix unit test
Filename:
MIME Type:
Creator:
Hammat wele
Created:
2024-05-14 20:28:26 UTC
Size:
3.50 KB
patch
obsolete
>From 3754a19cdf3bdb0c3ffbfcb5261a61b6ed0bd732 Mon Sep 17 00:00:00 2001 >From: Hammat Wele <hammat.wele@inlibro.com> >Date: Tue, 14 May 2024 20:03:16 +0000 >Subject: [PATCH] Bug 34978: (follow-up) Add exception when plugin to install > is not found and fix unit test > >Signed-off-by: Hammat Wele <hammat.wele@inlibro.com> >--- > Koha/Plugins.pm | 3 +-- > t/db_dependent/Koha/Plugins/Plugins.t | 20 +++++++++++++++++--- > 2 files changed, 18 insertions(+), 5 deletions(-) > >diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm >index 636a4d5692..335ae50d7f 100644 >--- a/Koha/Plugins.pm >+++ b/Koha/Plugins.pm >@@ -311,8 +311,7 @@ sub InstallPlugins { > # Warn user if the specified classes doesn't exist and return nothing > foreach my $class_name (@classes_filters) { > unless ( any { $class_name eq $_ } @plugin_classes ) { >- warn "$class_name has not been found, try a different name"; >- return; >+ Koha::Exceptions::BadParameter->throw("$class_name has not been found, try a different name"); > } > } > >diff --git a/t/db_dependent/Koha/Plugins/Plugins.t b/t/db_dependent/Koha/Plugins/Plugins.t >index 1db51568c4..f56d8ddce0 100755 >--- a/t/db_dependent/Koha/Plugins/Plugins.t >+++ b/t/db_dependent/Koha/Plugins/Plugins.t >@@ -26,6 +26,7 @@ use Module::Load::Conditional qw(can_load); > use Test::MockModule; > use Test::More tests => 19; > use Test::Warn; >+use Test::Exception; > > use C4::Context; > use Koha::Cache::Memory::Lite; >@@ -187,7 +188,7 @@ subtest 'GetPlugins() tests' => sub { > > subtest 'InstallPlugins() tests' => sub { > >- plan tests => 4; >+ plan tests => 6; > > $schema->storage->txn_begin; > >@@ -198,7 +199,7 @@ subtest 'InstallPlugins() tests' => sub { > # Tests for the exclude parameter > # Test the returned plugins of the InstallPlugins subroutine > my $plugins = Koha::Plugins->new( { enable_plugins => 1 } ); >- my @installed_plugins = $plugins->InstallPlugins( { exclude => [ "Test", "Koha::Plugin::MarcFieldValues" ] } ); >+ my @installed_plugins = $plugins->InstallPlugins( { exclude => [ "Koha::Plugin::Test", "Koha::Plugin::MarcFieldValues" ] } ); > my $plugin_classes = join( " ", map { $_->{class} } @installed_plugins ); > > my $result = grep { $plugin_classes !~ $_ } [ ":Test |:Test\$", ":MarcFieldValues |:MarcFieldValues\$" ] >@@ -219,7 +220,7 @@ subtest 'InstallPlugins() tests' => sub { > > # Tests for the include parameter > # Test the returned plugins of the InstallPlugins subroutine >- @installed_plugins = $plugins->InstallPlugins( { include => [ "Test", "Koha::Plugin::MarcFieldValues" ] } ); >+ @installed_plugins = $plugins->InstallPlugins( { include => [ "Koha::Plugin::Test", "Koha::Plugin::MarcFieldValues" ] } ); > > $result = 1; > foreach my $plugin_class ( map { $_->{class} } @installed_plugins ) { >@@ -236,6 +237,19 @@ subtest 'InstallPlugins() tests' => sub { > } > ok( $result, "Only included plugins are installed" ); > >+ # Tests when both include and exclude parameter are used simultaneously >+ throws_ok >+ { >+ $plugins->InstallPlugins( { exclude => [ "Koha::Plugin::Test" ], include => [ "Koha::Plugin::Test" ] } ); >+ } >+ 'Koha::Exceptions::BadParameter'; >+ # Tests when the plugin to be installled is not found >+ throws_ok >+ { >+ $plugins->InstallPlugins( { include => [ "Koha::Plugin::NotfoundPlugin" ] } ); >+ } >+ 'Koha::Exceptions::BadParameter'; >+ > $schema->storage->txn_rollback; > }; > >-- >2.34.1
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 34978
:
156539
|
156555
|
156557
|
160210
|
160239
|
160240
|
163800
|
163801
|
166560
|
166561
|
166562
|
166576
|
166736
|
166738
|
166739
|
166740
|
166741
| 166742