From f3a400fffeac7861e9b9b656981e48984f04f3fd Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Mon, 13 Sep 2021 23:21:55 -1000 Subject: [PATCH] Bug 29008: Add unit test --- t/db_dependent/Koha/Plugins/Plugins.t | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Plugins/Plugins.t b/t/db_dependent/Koha/Plugins/Plugins.t index 0360a8ab87..17b018603b 100755 --- a/t/db_dependent/Koha/Plugins/Plugins.t +++ b/t/db_dependent/Koha/Plugins/Plugins.t @@ -25,7 +25,7 @@ use File::Temp qw( tempdir tempfile ); use FindBin qw($Bin); use Module::Load::Conditional qw(can_load); use Test::MockModule; -use Test::More tests => 61; +use Test::More tests => 62; use Test::Warn; use C4::Context; @@ -409,4 +409,15 @@ subtest 'new() tests' => sub { is( ref($result), 'Koha::Plugins', 'calling new with enable_plugins makes it override the config' ); }; +subtest '_version_to_number() tests' => sub { + + plan tests => 5; + + is( Koha::Plugins::Base::_version_to_number(undef), 0, '_version_to_number(undef) returns 0' ); + is( Koha::Plugins::Base::_version_to_number('0'), 0, '_version_to_number(0) returns 0' ); + is( Koha::Plugins::Base::_version_to_number('18.11'), 18.11, '_version_to_number(18.11) returns 18.11' ); + is( Koha::Plugins::Base::_version_to_number('18.11.23'), 18.1123, '_version_to_number(18.11.23) returns 18.1123' ); + is( Koha::Plugins::Base::_version_to_number('18.11.23.456'), 18.1123456, '_version_to_number(18.11.23.456) returns 18.1123456' ); +}; + Koha::Plugins::Methods->delete; -- 2.35.4