From 328cad99f583b65aea8d68e171bd92ec4df90aa2 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 11 May 2022 14:35:18 +0000 Subject: [PATCH] Bug 30731: Unit tests Installer_pm.t can safely be discarded, having Installer_PerlModules.t. Note: Without the second patch, the test about versions_info being silent might fail. With the second patch, it should pass. Note that since the order of requiring the cpan modules varies (without the second patch), the results (potential warnings) vary too. Test plan: Run t/Installer_PerlModules.t Signed-off-by: Marcel de Rooy Signed-off-by: David Nind --- t/Installer_PerlModules.t | 21 ++++++++++++--------- t/Installer_pm.t | 15 --------------- 2 files changed, 12 insertions(+), 24 deletions(-) delete mode 100755 t/Installer_pm.t diff --git a/t/Installer_PerlModules.t b/t/Installer_PerlModules.t index 61d9bc22f5..0a81da024d 100755 --- a/t/Installer_PerlModules.t +++ b/t/Installer_PerlModules.t @@ -5,23 +5,26 @@ use Modern::Perl; -use Test::More tests => 6; +use Test::More tests => 3; +use Test::Warn; BEGIN { use_ok('C4::Installer::PerlModules'); } -my $modules; -ok ($modules = C4::Installer::PerlModules->new(), 'Tests modules object'); -my $prereq_pm = $modules->prereq_pm(); -ok (exists($prereq_pm->{"DBI"}), 'DBI required for installer to run'); -ok (exists($prereq_pm->{"CGI"}), 'CGI required for installer to run' ); -ok (exists($prereq_pm->{"YAML::XS"}), 'YAML::XS required for installer to run'); +subtest 'prereq_pm' => sub { + my $modules; + ok ($modules = C4::Installer::PerlModules->new(), 'Tests modules object'); + my $prereq_pm = $modules->prereq_pm(); + ok (exists($prereq_pm->{"DBI"}), 'DBI required for installer to run'); + ok (exists($prereq_pm->{"CGI"}), 'CGI required for installer to run' ); + ok (exists($prereq_pm->{"YAML::XS"}), 'YAML::XS required for installer to run'); +}; subtest 'versions_info' => sub { - plan tests => 4; + plan tests => 5; my $modules = C4::Installer::PerlModules->new; - $modules->versions_info; + warning_is { $modules->versions_info } undef, 'No warnings from versions_info'; ok( exists $modules->{missing_pm}, 'versions_info fills the missing_pm key' ); ok( exists $modules->{upgrade_pm}, 'versions_info fills the upgrade_pm key' ); ok( exists $modules->{current_pm}, 'versions_info fills the current_pm key' ); diff --git a/t/Installer_pm.t b/t/Installer_pm.t deleted file mode 100755 index 0ed28ee0e5..0000000000 --- a/t/Installer_pm.t +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/perl -# -use strict; -use warnings; - -use Test::More tests => 2; -use Data::Dumper; - -BEGIN { - use_ok('C4::Installer::PerlModules'); -} - -my $obj = C4::Installer::PerlModules->new; - -isa_ok($obj,'C4::Installer::PerlModules'); -- 2.30.2