From eb70d77900ff679c702ba7faa28b66cd26fcd4ed Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Tue, 13 Feb 2018 18:50:02 +0000 Subject: [PATCH] Bug 20181: (follow-up) Ensure test runs 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 Signed-off-by: Katrin Fischer --- t/Koha_Template_Plugin_KohaPlugins.t | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/t/Koha_Template_Plugin_KohaPlugins.t b/t/Koha_Template_Plugin_KohaPlugins.t index 8100a63..723f07c 100755 --- a/t/Koha_Template_Plugin_KohaPlugins.t +++ b/t/Koha_Template_Plugin_KohaPlugins.t @@ -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' ); -- 2.1.4