Lines 50-55
subtest 'Bad plugins tests' => sub {
Link Here
|
50 |
t::lib::Mocks::mock_config( 'enable_plugins', 1 ); |
50 |
t::lib::Mocks::mock_config( 'enable_plugins', 1 ); |
51 |
t::lib::Mocks::mock_preference( 'UseKohaPlugins', 1 ); |
51 |
t::lib::Mocks::mock_preference( 'UseKohaPlugins', 1 ); |
52 |
|
52 |
|
|
|
53 |
# remove any existing plugins that might interfere |
54 |
Koha::Plugins::Methods->search->delete; |
53 |
my $plugins = Koha::Plugins->new; |
55 |
my $plugins = Koha::Plugins->new; |
54 |
$plugins->InstallPlugins; |
56 |
$plugins->InstallPlugins; |
55 |
|
57 |
|
Lines 66-73
subtest 'Bad plugins tests' => sub {
Link Here
|
66 |
'Bad plugins raise warning'; |
68 |
'Bad plugins raise warning'; |
67 |
|
69 |
|
68 |
my $routes = get_defined_routes($t); |
70 |
my $routes = get_defined_routes($t); |
69 |
ok( !exists $routes->{'/contrib/badass/patrons/(:patron_id)/bother_wrong'}, 'Route doesn\'t exist' ); |
71 |
# Support placeholders () and <> (latter style used starting with Mojolicious::Plugin::OpenAPI@1.28) |
70 |
ok( exists $routes->{'/contrib/testplugin/patrons/(:patron_id)/bother'}, 'Route exists' ); |
72 |
# TODO: remove () if minimum version is bumped to at least 1.28. |
|
|
73 |
ok( !exists $routes->{'/contrib/badass/patrons/(:patron_id)/bother_wrong'} && !exists $routes->{'/contrib/badass/patrons/<:patron_id>/bother_wrong'}, 'Route doesn\'t exist' ); |
74 |
ok( exists $routes->{'/contrib/testplugin/patrons/(:patron_id>)/bother'} || exists $routes->{'/contrib/testplugin/patrons/<:patron_id>/bother'}, 'Route exists' ); |
71 |
|
75 |
|
72 |
$schema->storage->txn_rollback; |
76 |
$schema->storage->txn_rollback; |
73 |
}; |
77 |
}; |
Lines 98-104
subtest 'Disabled plugins tests' => sub {
Link Here
|
98 |
my $t = Test::Mojo->new('Koha::REST::V1'); |
102 |
my $t = Test::Mojo->new('Koha::REST::V1'); |
99 |
|
103 |
|
100 |
my $routes = get_defined_routes($t); |
104 |
my $routes = get_defined_routes($t); |
101 |
ok( !exists $routes->{'/contrib/testplugin/patrons/(:patron_id)/bother'}, |
105 |
# Support placeholders () and <> (latter style used starting with Mojolicious::Plugin::OpenAPI@1.28) |
|
|
106 |
# TODO: remove () if minimum version is bumped to at least 1.28. |
107 |
ok( !exists $routes->{'/contrib/testplugin/patrons/(:patron_id)/bother'} && !exists $routes->{'/contrib/testplugin/patrons/<:patron_id>/bother'}, |
102 |
'Plugin disabled, route not defined' ); |
108 |
'Plugin disabled, route not defined' ); |
103 |
|
109 |
|
104 |
$good_plugin->enable; |
110 |
$good_plugin->enable; |
Lines 106-112
subtest 'Disabled plugins tests' => sub {
Link Here
|
106 |
$t = Test::Mojo->new('Koha::REST::V1'); |
112 |
$t = Test::Mojo->new('Koha::REST::V1'); |
107 |
$routes = get_defined_routes($t); |
113 |
$routes = get_defined_routes($t); |
108 |
|
114 |
|
109 |
ok( exists $routes->{'/contrib/testplugin/patrons/(:patron_id)/bother'}, |
115 |
# Support placeholders () and <> (latter style used starting with Mojolicious::Plugin::OpenAPI@1.28) |
|
|
116 |
# TODO: remove () if minimum version is bumped to at least 1.28. |
117 |
ok( exists $routes->{'/contrib/testplugin/patrons/(:patron_id)/bother'} || exists $routes->{'/contrib/testplugin/patrons/<:patron_id>/bother'}, |
110 |
'Plugin enabled, route defined' ); |
118 |
'Plugin enabled, route defined' ); |
111 |
|
119 |
|
112 |
$schema->storage->txn_rollback; |
120 |
$schema->storage->txn_rollback; |
113 |
- |
|
|