Bugzilla – Attachment 102942 Details for
Bug 25131
Web installer broken if enable_plugin is set
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25131: Regression tests
Bug-25131-Regression-tests.patch (text/plain), 2.69 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-04-14 19:33:05 UTC
(
hide
)
Description:
Bug 25131: Regression tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-04-14 19:33:05 UTC
Size:
2.69 KB
patch
obsolete
>From 7f0106094cf8e6f3a3e89aa60a05dca23b3df2fc Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 14 Apr 2020 16:24:33 -0300 >Subject: [PATCH] Bug 25131: Regression tests > >--- > .../Koha/REST/Plugin/PluginRoutes.t | 52 ++++++++++++++++++- > 1 file changed, 51 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/REST/Plugin/PluginRoutes.t b/t/db_dependent/Koha/REST/Plugin/PluginRoutes.t >index 6ebe67b27a..d722707bc4 100644 >--- a/t/db_dependent/Koha/REST/Plugin/PluginRoutes.t >+++ b/t/db_dependent/Koha/REST/Plugin/PluginRoutes.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 2; >+use Test::More tests => 3; > use Test::Mojo; > use Test::Warn; > >@@ -118,6 +118,56 @@ subtest 'Disabled plugins tests' => sub { > $schema->storage->txn_rollback; > }; > >+subtest 'needs_install use case tests' => sub { >+ >+ plan tests => 2; >+ >+ $schema->storage->txn_begin; >+ >+ # enable plugins >+ t::lib::Mocks::mock_config( 'enable_plugins', 1 ); >+ >+ my $good_plugin; >+ >+ my $plugins = Koha::Plugins->new; >+ $plugins->InstallPlugins; >+ >+ my @plugins = $plugins->GetPlugins( { all => 1 } ); >+ foreach my $plugin (@plugins) { >+ $good_plugin = $plugin >+ if $plugin->{metadata}->{description} eq 'Test plugin'; >+ } >+ >+ # mock Version before initializing the API class >+ t::lib::Mocks::mock_preference('Version', undef); >+ # initialize Koha::REST::V1 after mocking >+ my $t = Test::Mojo->new('Koha::REST::V1'); >+ my $routes = get_defined_routes($t); >+ >+ # Support placeholders () and <> (latter style used starting with Mojolicious::Plugin::OpenAPI@1.28) >+ # TODO: remove () if minimum version is bumped to at least 1.28. >+ ok( >+ !exists $routes->{'/contrib/testplugin/patrons/(:patron_id)/bother'} >+ && !exists $routes->{'/contrib/testplugin/patrons/<:patron_id>/bother'}, >+ 'Plugin enabled, route not defined as C4::Context->needs_install is true' >+ ); >+ >+ t::lib::Mocks::mock_preference('Version', '3.0.0'); >+ # re-initialize Koha::REST::V1 after mocking >+ $t = Test::Mojo->new('Koha::REST::V1'); >+ $routes = get_defined_routes($t); >+ >+ # Support placeholders () and <> (latter style used starting with Mojolicious::Plugin::OpenAPI@1.28) >+ # TODO: remove () if minimum version is bumped to at least 1.28. >+ ok( >+ exists $routes->{'/contrib/testplugin/patrons/(:patron_id)/bother'} >+ || exists $routes->{'/contrib/testplugin/patrons/<:patron_id>/bother'}, >+ 'Plugin enabled, route defined as C4::Context->needs_install is false' >+ ); >+ >+ $schema->storage->txn_rollback; >+}; >+ > sub get_defined_routes { > my ($t) = @_; > my $routes = {}; >-- >2.26.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25131
:
102941
|
102942
|
102943
|
102989
|
102990
|
102991
|
102995
|
102996
|
102997
|
103015
|
104003