Lines 20-25
use Modern::Perl;
Link Here
|
20 |
use Test::More tests => 4; |
20 |
use Test::More tests => 4; |
21 |
use Test::Mojo; |
21 |
use Test::Mojo; |
22 |
use Test::Warn; |
22 |
use Test::Warn; |
|
|
23 |
use Test::MockModule; |
23 |
|
24 |
|
24 |
use File::Basename; |
25 |
use File::Basename; |
25 |
use t::lib::Mocks; |
26 |
use t::lib::Mocks; |
Lines 38-43
BEGIN {
Link Here
|
38 |
use Koha::Database; |
39 |
use Koha::Database; |
39 |
use Koha::Plugins; |
40 |
use Koha::Plugins; |
40 |
|
41 |
|
|
|
42 |
my $logger = Test::MockModule->new('Koha::Logger'); |
43 |
$logger->mock('error', sub { |
44 |
shift; |
45 |
warn @_; |
46 |
}); |
47 |
|
41 |
my $schema = Koha::Database->new->schema; |
48 |
my $schema = Koha::Database->new->schema; |
42 |
|
49 |
|
43 |
subtest 'Bad plugins tests' => sub { |
50 |
subtest 'Bad plugins tests' => sub { |
Lines 61-69
subtest 'Bad plugins tests' => sub {
Link Here
|
61 |
|
68 |
|
62 |
# initialize Koha::REST::V1 after mocking |
69 |
# initialize Koha::REST::V1 after mocking |
63 |
my $t; |
70 |
my $t; |
64 |
warning_is |
71 |
warning_like |
65 |
{ $t = Test::Mojo->new('Koha::REST::V1'); } |
72 |
{ $t = Test::Mojo->new('Koha::REST::V1'); } |
66 |
'The resulting spec is invalid. Skipping Bad API Route Plugin', |
73 |
[qr{Could not load REST API spec bundle: Invalid JSON specification}, |
|
|
74 |
qr{The resulting spec is invalid. Skipping Bad API Route Plugin},], |
67 |
'Bad plugins raise warning'; |
75 |
'Bad plugins raise warning'; |
68 |
|
76 |
|
69 |
my $routes = get_defined_routes($t); |
77 |
my $routes = get_defined_routes($t); |
Lines 139-147
subtest 'Anonymous access routes plugins tests' => sub {
Link Here
|
139 |
|
147 |
|
140 |
# initialize Koha::REST::V1 after mocking |
148 |
# initialize Koha::REST::V1 after mocking |
141 |
my $t; |
149 |
my $t; |
142 |
warning_is |
150 |
warning_like |
143 |
{ $t = Test::Mojo->new('Koha::REST::V1'); } |
151 |
{ $t = Test::Mojo->new('Koha::REST::V1'); } |
144 |
'The resulting spec is invalid. Skipping Bad API Route Plugin', |
152 |
[qr{Could not load REST API spec bundle: Invalid JSON specification}, |
|
|
153 |
qr{The resulting spec is invalid. Skipping Bad API Route Plugin},], |
145 |
'Bad plugins raise warning'; |
154 |
'Bad plugins raise warning'; |
146 |
|
155 |
|
147 |
my $routes = get_defined_routes($t); |
156 |
my $routes = get_defined_routes($t); |
148 |
- |
|
|