From 43d4bba6c6546e42e505e554d554e2be9a0af043 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Tue, 1 Sep 2020 12:11:54 +0200
Subject: [PATCH] Bug 25504: Fix failing tests

---
 t/db_dependent/Koha/REST/Plugin/PluginRoutes.t | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/t/db_dependent/Koha/REST/Plugin/PluginRoutes.t b/t/db_dependent/Koha/REST/Plugin/PluginRoutes.t
index 27af737ab0..a1b3055443 100644
--- a/t/db_dependent/Koha/REST/Plugin/PluginRoutes.t
+++ b/t/db_dependent/Koha/REST/Plugin/PluginRoutes.t
@@ -20,6 +20,7 @@ use Modern::Perl;
 use Test::More tests => 4;
 use Test::Mojo;
 use Test::Warn;
+use Test::MockModule;
 
 use File::Basename;
 use t::lib::Mocks;
@@ -38,6 +39,12 @@ BEGIN {
 use Koha::Database;
 use Koha::Plugins;
 
+my $logger = Test::MockModule->new('Koha::Logger');
+$logger->mock('error', sub {
+    shift;
+    warn @_;
+});
+
 my $schema = Koha::Database->new->schema;
 
 subtest 'Bad plugins tests' => sub {
@@ -61,9 +68,10 @@ subtest 'Bad plugins tests' => sub {
 
     # initialize Koha::REST::V1 after mocking
     my $t;
-    warning_is
+    warning_like
         { $t = Test::Mojo->new('Koha::REST::V1'); }
-        'The resulting spec is invalid. Skipping Bad API Route Plugin',
+        [qr{Could not load REST API spec bundle: Invalid JSON specification},
+        qr{The resulting spec is invalid. Skipping Bad API Route Plugin},],
         'Bad plugins raise warning';
 
     my $routes = get_defined_routes($t);
@@ -139,9 +147,10 @@ subtest 'Anonymous access routes plugins tests' => sub {
 
     # initialize Koha::REST::V1 after mocking
     my $t;
-    warning_is
+    warning_like
         { $t = Test::Mojo->new('Koha::REST::V1'); }
-        'The resulting spec is invalid. Skipping Bad API Route Plugin',
+        [qr{Could not load REST API spec bundle: Invalid JSON specification},
+        qr{The resulting spec is invalid. Skipping Bad API Route Plugin},],
         'Bad plugins raise warning';
 
     my $routes = get_defined_routes($t);
-- 
2.20.1