Bug 13041: Fix add of basket's manager when name contains a single quote
[koha.git] / t / Installer_PerlModules.t
blob1d5a00c4d4995be0eee42812ce511b0ef2cbafbf
1 #!/usr/bin/perl
3 # This Koha test module is a stub!
4 # Add more tests here!!!
6 use strict;
7 use warnings;
9 use Test::More tests => 17;
11 BEGIN {
12 use_ok('C4::Installer::PerlModules');
15 my $modules;
16 ok ($modules = C4::Installer::PerlModules->new(), 'Tests modules object');
17 my $prereq_pm = $modules->prereq_pm();
18 ok (exists($prereq_pm->{"DBI"}), 'DBI required for installer to run');
19 ok (exists($prereq_pm->{"CGI"}), 'CGI required for installer to run' );
20 ok (exists($prereq_pm->{"YAML"}), 'YAML required for installer to run');
21 is ($modules->required('module'=>"DBI"),1, 'DBI should return 1 since required');
22 is ($modules->required('module'=>"thisdoesn'texist"),-1, 'string should return -1 since not in hash');
23 my $required = $modules->required('required'=>1);
24 my %params = map { $_ => 1 } @$required;
25 ok (exists($params{"DBI"}), 'DBI required for installer to run');
26 my $optional = $modules->required('optional'=>1);
27 %params = map { $_ => 1 } @$optional;
28 ok (exists($params{"Test::Strict"}), 'test::strict optional for installer to run');
29 is ($optional = $modules->required('spaghetti'=>1),-1, '-1 returned when parsing in unknown parameter');
30 my $version_info = $modules->version_info('module'=>"DBI");
31 ok (exists($version_info->{'DBI'}->{"required"}), 'required exists');
32 ok (exists($version_info->{'DBI'}->{"upgrade"}), 'upgrade exists');
33 is ($modules->version_info('module'=>"thisdoesn'texist"),-1, 'thisdoesntexist should return -1');
34 ok ($modules->module_count() >10 , 'count should be greater than 10');
35 my @module_list = $modules->module_list;
36 %params = map { $_ => 1 } @module_list;
37 ok (exists($params{"DBI"}), 'DBI exists in array');
38 is ($modules->required('module'=>"String::Random"),1, 'String::Random should return 1 since required');
39 ok (!$modules->version_info(), "Testing empty modules");