Bug 25504: Fix failing tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2020-09-01 12:11:54 +02:00
parent 092276f53c
commit 9be6b76a7b
1 changed files with 13 additions and 4 deletions

View File

@ -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);