Add 20.11 release team
[koha.git] / t / Installer_PerlModules.t
blobea1002b9bbdf1067bbcc80b5ecc74be748a6e9e7
1 #!/usr/bin/perl
3 # This Koha test module is a stub!
4 # Add more tests here!!!
6 use Modern::Perl;
8 use Test::More tests => 6;
10 BEGIN {
11 use_ok('C4::Installer::PerlModules');
14 my $modules;
15 ok ($modules = C4::Installer::PerlModules->new(), 'Tests modules object');
16 my $prereq_pm = $modules->prereq_pm();
17 ok (exists($prereq_pm->{"DBI"}), 'DBI required for installer to run');
18 ok (exists($prereq_pm->{"CGI"}), 'CGI required for installer to run' );
19 ok (exists($prereq_pm->{"YAML"}), 'YAML required for installer to run');
21 subtest 'versions_info' => sub {
22 plan tests => 4;
23 my $modules = C4::Installer::PerlModules->new;
24 $modules->versions_info;
25 ok( exists $modules->{missing_pm}, 'versions_info fills the missing_pm key' );
26 ok( exists $modules->{upgrade_pm}, 'versions_info fills the upgrade_pm key' );
27 ok( exists $modules->{current_pm}, 'versions_info fills the current_pm key' );
28 my $missing_modules = $modules->get_attr( 'missing_pm' );
29 my $upgrade_modules = $modules->get_attr( 'upgrade_pm' );
30 my $current_modules = $modules->get_attr( 'current_pm' );
31 my $dbi_is_missing = grep { exists $_->{DBI} ? 1 : () } @$missing_modules;
32 my $dbi_is_upgrade = grep { exists $_->{DBI} ? 1 : () } @$upgrade_modules;
33 my $dbi_is_current = grep { exists $_->{DBI} ? 1 : () } @$current_modules;
34 ok( $dbi_is_missing || $dbi_is_upgrade || $dbi_is_current, 'DBI should either be missing, upgrade or current' );