From af97397dca3dbc2a4ed8b0312db7958b12a96ad3 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 2 May 2019 15:51:17 -0300 Subject: [PATCH] Bug 22834: Add tests for Koha::Plugins::Base->bundle_path --- t/db_dependent/Plugins.t | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Plugins.t b/t/db_dependent/Plugins.t index 34764214c6..061fce53e1 100755 --- a/t/db_dependent/Plugins.t +++ b/t/db_dependent/Plugins.t @@ -18,12 +18,14 @@ use Modern::Perl; use Archive::Extract; use CGI; +use Cwd qw(abs_path); use File::Basename; +use File::Spec; use File::Temp qw( tempdir tempfile ); use FindBin qw($Bin); use Module::Load::Conditional qw(can_load); use Test::MockModule; -use Test::More tests => 41; +use Test::More tests => 42; use C4::Context; use Koha::Database; @@ -222,3 +224,21 @@ subtest 'Test _version_compare' => sub { is( Koha::Plugins::Base::_version_compare( '1', '1.0.0' ), 0, "1 is equal to 1.0.0" ); is( Koha::Plugins::Base::_version_compare( '1.0', '1.0.0' ), 0, "1.0 is equal to 1.0.0" ); }; + +subtest 'bundle_path() tests' => sub { + + plan tests => 1; + + t::lib::Mocks::mock_config( 'enable_plugins', 1 ); + + my @current_dir = File::Spec->splitdir(abs_path(__FILE__)); + # remote Plugins.t + pop @current_dir; + # remove db_dependent + pop @current_dir; + + my $plugin = Koha::Plugin::Test->new; + + is( $plugin->bundle_path, File::Spec->catdir(@current_dir) . '/lib/Koha/Plugin/Test' ); + +}; -- 2.21.0