Bug 30194: (26351 follow-up) Silence useless warning
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 8 Mar 2022 19:08:26 +0000 (16:08 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Tue, 29 Mar 2022 14:44:31 +0000 (16:44 +0200)
Every place in which Koha::Plugin::Test is loaded, and a patron is
updated, this hook needs to be silenced.

To reproduce:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/REST/Plugin/PluginRoutes.t
=> FAIL: There's a warn about patron_barcode_transform
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!
4. Sign off :-D

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Mason James <mtj@kohaaloha.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
t/db_dependent/Koha/REST/Plugin/PluginRoutes.t

index 1bd91c9..6674650 100755 (executable)
@@ -138,6 +138,10 @@ subtest 'Permissions and access to plugin routes tests' => sub {
     # enable BASIC auth
     t::lib::Mocks::mock_preference( 'RESTBasicAuth', 1 );
 
+    # Silence warnings from unrelated plugins feature
+    my $plugin_mock = Test::MockModule->new('Koha::Plugin::Test');
+    $plugin_mock->mock( 'patron_barcode_transform', undef );
+
     # remove any existing plugins that might interfere
     Koha::Plugins::Methods->search->delete;
     my $plugins = Koha::Plugins->new;