From a58392f15fec998957969f40ecd235845a0dbb3d 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 7ae6664664..f995c86de1 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 => 55; +use Test::More tests => 56; use C4::Context; use Koha::Database; @@ -358,4 +358,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.32.0