Bugzilla – Attachment 126503 Details for
Bug 29273
Warning not caught in tests for plugins
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29273: Remove warnings from plugin tests
Bug-29273-Remove-warnings-from-plugin-tests.patch (text/plain), 10.14 KB, created by
Jonathan Druart
on 2021-10-19 13:59:32 UTC
(
hide
)
Description:
Bug 29273: Remove warnings from plugin tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-10-19 13:59:32 UTC
Size:
10.14 KB
patch
obsolete
>From a1b0427c3d99f5842b510d354353c7bdb8780099 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 19 Oct 2021 15:58:25 +0200 >Subject: [PATCH] Bug 29273: Remove warnings from plugin tests > >This patch is suggesting to move the broken test plugins into a separate >directory. > >t/lib/plugins and t/lib/bad_plugins >--- > .../Koha/Plugins/Barcode_transform_hooks.t | 7 ++---- > .../Plugins/Biblio_and_Items_plugin_hooks.t | 2 +- > .../Koha/Plugins/Circulation_hooks.t | 2 +- > t/db_dependent/Koha/Plugins/Holds_hooks.t | 2 +- > t/db_dependent/Koha/Plugins/Patron.t | 2 +- > t/db_dependent/Koha/Plugins/Plugins.t | 23 ++++++------------- > .../Koha/Plugin/BrokenInstall.pm | 0 > .../Koha/Plugin/BrokenUpgrade.pm | 0 > .../{ => plugins}/Koha/Plugin/BadAPIRoute.pm | 0 > .../Koha/Plugin/MarcFieldValues.pm | 0 > t/lib/{ => plugins}/Koha/Plugin/Test.pm | 0 > .../Koha/Plugin/Test/Controller.pm | 0 > .../Koha/Plugin/TestItemBarcodeTransform.pm | 0 > 13 files changed, 13 insertions(+), 25 deletions(-) > rename t/lib/{ => bad_plugins}/Koha/Plugin/BrokenInstall.pm (100%) > rename t/lib/{ => bad_plugins}/Koha/Plugin/BrokenUpgrade.pm (100%) > rename t/lib/{ => plugins}/Koha/Plugin/BadAPIRoute.pm (100%) > rename t/lib/{ => plugins}/Koha/Plugin/MarcFieldValues.pm (100%) > rename t/lib/{ => plugins}/Koha/Plugin/Test.pm (100%) > rename t/lib/{ => plugins}/Koha/Plugin/Test/Controller.pm (100%) > rename t/lib/{ => plugins}/Koha/Plugin/TestItemBarcodeTransform.pm (100%) > >diff --git a/t/db_dependent/Koha/Plugins/Barcode_transform_hooks.t b/t/db_dependent/Koha/Plugins/Barcode_transform_hooks.t >index 86f8c31e130..2fba2fb7440 100755 >--- a/t/db_dependent/Koha/Plugins/Barcode_transform_hooks.t >+++ b/t/db_dependent/Koha/Plugins/Barcode_transform_hooks.t >@@ -27,7 +27,7 @@ use t::lib::TestBuilder; > > BEGIN { > # Mock pluginsdir before loading Plugins module >- my $path = dirname(__FILE__) . '/../../../lib'; >+ my $path = dirname(__FILE__) . '/../../../lib/plugins'; > t::lib::Mocks::mock_config( 'pluginsdir', $path ); > > use_ok('Koha::Plugins'); >@@ -53,10 +53,7 @@ subtest 'patron_barcode_transform() and item_barcode_transform() hook tests' => > > my $plugins = Koha::Plugins->new; > >- warnings_are >- { $plugins->InstallPlugins; } >- [ "Calling 'install' died for plugin Koha::Plugin::BrokenInstall", >- "Calling 'upgrade' died for plugin Koha::Plugin::BrokenUpgrade" ]; >+ warning_is { $plugins->InstallPlugins; } undef; > > C4::Context->dbh->do("DELETE FROM plugin_methods WHERE plugin_class LIKE '%TestBarcodes%'"); > >diff --git a/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t b/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t >index fda58e013d3..4f29aae60f5 100755 >--- a/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t >+++ b/t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t >@@ -28,7 +28,7 @@ use t::lib::TestBuilder; > > BEGIN { > # Mock pluginsdir before loading Plugins module >- my $path = dirname(__FILE__) . '/../../../lib'; >+ my $path = dirname(__FILE__) . '/../../../lib/plugins'; > t::lib::Mocks::mock_config( 'pluginsdir', $path ); > > use_ok('Koha::Plugins'); >diff --git a/t/db_dependent/Koha/Plugins/Circulation_hooks.t b/t/db_dependent/Koha/Plugins/Circulation_hooks.t >index 7d038bb4db9..e667f179717 100755 >--- a/t/db_dependent/Koha/Plugins/Circulation_hooks.t >+++ b/t/db_dependent/Koha/Plugins/Circulation_hooks.t >@@ -29,7 +29,7 @@ use t::lib::TestBuilder; > > BEGIN { > # Mock pluginsdir before loading Plugins module >- my $path = dirname(__FILE__) . '/../../../lib'; >+ my $path = dirname(__FILE__) . '/../../../lib/plugins'; > t::lib::Mocks::mock_config( 'pluginsdir', $path ); > > use_ok('Koha::Plugins'); >diff --git a/t/db_dependent/Koha/Plugins/Holds_hooks.t b/t/db_dependent/Koha/Plugins/Holds_hooks.t >index 07aa4f7344c..2e40b9d939b 100755 >--- a/t/db_dependent/Koha/Plugins/Holds_hooks.t >+++ b/t/db_dependent/Koha/Plugins/Holds_hooks.t >@@ -29,7 +29,7 @@ use t::lib::TestBuilder; > > BEGIN { > # Mock pluginsdir before loading Plugins module >- my $path = dirname(__FILE__) . '/../../../lib'; >+ my $path = dirname(__FILE__) . '/../../../lib/plugins'; > t::lib::Mocks::mock_config( 'pluginsdir', $path ); > > use_ok('Koha::Plugins'); >diff --git a/t/db_dependent/Koha/Plugins/Patron.t b/t/db_dependent/Koha/Plugins/Patron.t >index c8b2e86f25e..a818cdeb45e 100755 >--- a/t/db_dependent/Koha/Plugins/Patron.t >+++ b/t/db_dependent/Koha/Plugins/Patron.t >@@ -28,7 +28,7 @@ use t::lib::TestBuilder; > > BEGIN { > # Mock pluginsdir before loading Plugins module >- my $path = dirname(__FILE__) . '/../../../lib'; >+ my $path = dirname(__FILE__) . '/../../../lib/plugins'; > t::lib::Mocks::mock_config( 'pluginsdir', $path ); > > use_ok('Koha::Plugins'); >diff --git a/t/db_dependent/Koha/Plugins/Plugins.t b/t/db_dependent/Koha/Plugins/Plugins.t >index 418311b0627..14990ad09a5 100755 >--- a/t/db_dependent/Koha/Plugins/Plugins.t >+++ b/t/db_dependent/Koha/Plugins/Plugins.t >@@ -36,7 +36,7 @@ use t::lib::Mocks; > > BEGIN { > # Mock pluginsdir before loading Plugins module >- my $path = dirname(__FILE__) . '/../../../lib'; >+ my $path = dirname(__FILE__) . '/../../../lib/plugins'; > t::lib::Mocks::mock_config( 'pluginsdir', $path ); > > use_ok('Koha::Plugins'); >@@ -61,9 +61,7 @@ subtest 'call() tests' => sub { > > my @plugins; > >- warnings_are >- { @plugins = $plugins->InstallPlugins; } >- [ "Calling 'install' died for plugin Koha::Plugin::BrokenInstall", "Calling 'upgrade' died for plugin Koha::Plugin::BrokenUpgrade" ]; >+ warning_is { @plugins = $plugins->InstallPlugins; } undef; > > foreach my $plugin (@plugins) { > $plugin->enable(); >@@ -99,10 +97,7 @@ subtest 'more call() tests' => sub { > my $plugins = Koha::Plugins->new({ enable_plugins => 1 }); > my @plugins; > >- warnings_are >- { @plugins = $plugins->InstallPlugins; } >- [ "Calling 'install' died for plugin Koha::Plugin::BrokenInstall", >- "Calling 'upgrade' died for plugin Koha::Plugin::BrokenUpgrade" ]; >+ warning_is { @plugins = $plugins->InstallPlugins; } undef; > > foreach my $plugin (@plugins) { > $plugin->enable(); >@@ -142,8 +137,7 @@ subtest 'GetPlugins() tests' => sub { > > my $plugins = Koha::Plugins->new({ enable_plugins => 1 }); > >- warnings_are { $plugins->InstallPlugins; } >- [ "Calling 'install' died for plugin Koha::Plugin::BrokenInstall", "Calling 'upgrade' died for plugin Koha::Plugin::BrokenUpgrade" ]; >+ warning_is { $plugins->InstallPlugins; } undef; > > my @plugins = $plugins->GetPlugins({ method => 'report', all => 1 }); > >@@ -204,8 +198,7 @@ subtest 'is_enabled() tests' => sub { > $schema->storage->txn_begin; > Koha::Plugins::Methods->delete; > >-warnings_are { Koha::Plugins->new( { enable_plugins => 1 } )->InstallPlugins(); } >-[ "Calling 'install' died for plugin Koha::Plugin::BrokenInstall", "Calling 'upgrade' died for plugin Koha::Plugin::BrokenUpgrade" ]; >+warning_is { Koha::Plugins->new( { enable_plugins => 1 } )->InstallPlugins(); } undef; > > ok( Koha::Plugins::Methods->search( { plugin_class => 'Koha::Plugin::Test' } )->count, 'Test plugin methods added to database' ); > is( Koha::Plugins::Methods->search({ plugin_class => 'Koha::Plugin::Test', plugin_method => '_private_sub' })->count, 0, 'Private methods are skipped' ); >@@ -320,9 +313,7 @@ for my $pass ( 1 .. 2 ) { > > ok( -f $plugins_dir . "/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm", "KitchenSink plugin installed successfully" ); > $INC{$pm_path} = $full_pm_path; # FIXME I do not really know why, but if this is moved before the $plugin constructor, it will fail with Can't locate object method "new" via package "Koha::Plugin::Com::ByWaterSolutions::KitchenSink" >- warnings_are >- { Koha::Plugins->new( { enable_plugins => 1 } )->InstallPlugins(); } >- [ "Calling 'install' died for plugin Koha::Plugin::BrokenInstall", "Calling 'upgrade' died for plugin Koha::Plugin::BrokenUpgrade" ]; >+ warning_is { Koha::Plugins->new( { enable_plugins => 1 } )->InstallPlugins(); } undef; > ok( -f $full_pm_path, "Koha::Plugins::Handler::delete works correctly (pass $pass)" ); > Koha::Plugins::Handler->delete({ class => "Koha::Plugin::Com::ByWaterSolutions::KitchenSink", enable_plugins => 1 }); > my $sth = C4::Context->dbh->table_info( undef, undef, $table, 'TABLE' ); >@@ -400,7 +391,7 @@ subtest 'bundle_path() tests' => sub { > > my $plugin = Koha::Plugin::Test->new; > >- is( $plugin->bundle_path, File::Spec->catdir(@current_dir) . '/lib/Koha/Plugin/Test' ); >+ is( $plugin->bundle_path, File::Spec->catdir(@current_dir) . '/lib/plugins/Koha/Plugin/Test' ); > > }; > >diff --git a/t/lib/Koha/Plugin/BrokenInstall.pm b/t/lib/bad_plugins/Koha/Plugin/BrokenInstall.pm >similarity index 100% >rename from t/lib/Koha/Plugin/BrokenInstall.pm >rename to t/lib/bad_plugins/Koha/Plugin/BrokenInstall.pm >diff --git a/t/lib/Koha/Plugin/BrokenUpgrade.pm b/t/lib/bad_plugins/Koha/Plugin/BrokenUpgrade.pm >similarity index 100% >rename from t/lib/Koha/Plugin/BrokenUpgrade.pm >rename to t/lib/bad_plugins/Koha/Plugin/BrokenUpgrade.pm >diff --git a/t/lib/Koha/Plugin/BadAPIRoute.pm b/t/lib/plugins/Koha/Plugin/BadAPIRoute.pm >similarity index 100% >rename from t/lib/Koha/Plugin/BadAPIRoute.pm >rename to t/lib/plugins/Koha/Plugin/BadAPIRoute.pm >diff --git a/t/lib/Koha/Plugin/MarcFieldValues.pm b/t/lib/plugins/Koha/Plugin/MarcFieldValues.pm >similarity index 100% >rename from t/lib/Koha/Plugin/MarcFieldValues.pm >rename to t/lib/plugins/Koha/Plugin/MarcFieldValues.pm >diff --git a/t/lib/Koha/Plugin/Test.pm b/t/lib/plugins/Koha/Plugin/Test.pm >similarity index 100% >rename from t/lib/Koha/Plugin/Test.pm >rename to t/lib/plugins/Koha/Plugin/Test.pm >diff --git a/t/lib/Koha/Plugin/Test/Controller.pm b/t/lib/plugins/Koha/Plugin/Test/Controller.pm >similarity index 100% >rename from t/lib/Koha/Plugin/Test/Controller.pm >rename to t/lib/plugins/Koha/Plugin/Test/Controller.pm >diff --git a/t/lib/Koha/Plugin/TestItemBarcodeTransform.pm b/t/lib/plugins/Koha/Plugin/TestItemBarcodeTransform.pm >similarity index 100% >rename from t/lib/Koha/Plugin/TestItemBarcodeTransform.pm >rename to t/lib/plugins/Koha/Plugin/TestItemBarcodeTransform.pm >-- >2.25.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 29273
:
126503
|
126567
|
126582
|
127605
|
127643