use Test::More tests => 4;
use Test::Mojo;
use Test::Warn;
+use Test::MockModule;
use File::Basename;
use t::lib::Mocks;
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 {
# 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);
# 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);