Bug 20181: (follow-up) Ensure test runs
authorMark Tompsett <mtompset@hotmail.com>
Tue, 13 Feb 2018 18:50:02 +0000 (18:50 +0000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Fri, 19 Oct 2018 07:36:22 +0000 (09:36 +0200)
If EnablePlugins was 0, this test before this patch fails.
After this patch, it passes.

TEST PLAN
---------
1) Apply all but this patch
2) Run the following commands
    kshell
    prove t/Koha_Template_Plugin_KohaPlugins.t
   -- two tests fail, if you have the conf or syspref set to 0.
3) Apply this patch
4) Repeat step 2.
   -- all tests pass, including the positive and negative case checks.
5) run koha qa test tools

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

(cherry picked from commit 9755c34938c42411e4a7e5d897af7335eca6bc13)

Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

t/Koha_Template_Plugin_KohaPlugins.t

index 8100a63..723f07c 100755 (executable)
@@ -2,7 +2,7 @@
 
 use Modern::Perl;
 
-use Test::More tests => 8;
+use Test::More tests => 10;
 use CGI;
 use File::Basename;
 use File::Spec;
@@ -36,6 +36,12 @@ use_ok( 'Koha::Template::Plugin::KohaPlugins', 'Can use Koha::Template::Plugin::
 
 ok( my $plugin = Koha::Template::Plugin::KohaPlugins->new(), 'Able to instantiate template plugin' );
 
+t::lib::Mocks::mock_preference('UseKohaPlugins',1);
+t::lib::Mocks::mock_config('enable_plugins',1);
 ok( index( $plugin->get_plugins_opac_js, 'Koha::Plugin::Test::opac_js' ) != -1, 'Test plugin opac_js return value is part of code returned by get_plugins_opac_js' );
-
 ok( index( $plugin->get_plugins_opac_head, 'Koha::Plugin::Test::opac_head' ) != -1, 'Test plugin opac_head return value is part of code returned by get_plugins_opac_head' );
+
+t::lib::Mocks::mock_preference('UseKohaPlugins',0);
+t::lib::Mocks::mock_config('enable_plugins',0);
+is( $plugin->get_plugins_opac_js, q{}, 'Test plugin opac_js return value is empty' );
+is( $plugin->get_plugins_opac_head, q{}, 'Test plugin opac_head return value is empty' );