ok($ret = $ENV{$_}, "ENV{$_} = $ret");
}
use_ok('C4::Context');
- use_ok('C4::Utils', qw/ :all /);
}
ok($koha = C4::Context->new, 'C4::Context->new');
ok($dbh = C4::Context->dbh(), 'Getting dbh from C4::Context');
ok($ret = C4::Context->KOHAVERSION, ' (function) KOHAVERSION = ' . ($ret||''));
ok($ret = $koha->KOHAVERSION, ' $koha->KOHAVERSION = ' . ($ret||''));
+ok(
+ TransformVersionToNum( C4::Context->final_linear_version ) <=
+ TransformVersionToNum( C4::Context->KOHAVERSION ),
+ 'Final linear version is less than or equal to kohaversion.pl'
+);
my @keys = keys %$koha;
diag("Number of keys in \%\$koha: " . scalar @keys);
-our $width = 0;
+my $width = 0;
if (ok(@keys)) {
- $width = maxwidth(@keys);
- $debug and diag "widest key is $width";
+ $width = (sort {$a <=> $b} map {length} @keys)[-1];
+ $debug and diag "widest key is $width";
}
foreach (sort @keys) {
ok(exists $koha->{$_},
. ((defined $koha->{$_}) ? "and is defined." : "but is not defined.")
);
}
-diag "Examining defined key values.";
-foreach (grep {defined $koha->{$_}} sort @keys) {
- print "\n";
- hashdump('$koha->{' . sprintf('%' . $width . 's', $_) . '}', $koha->{$_});
-}
ok($config = $koha->{config}, 'Getting $koha->{config} ');
diag "Testing syspref caching.";
done_testing();
+sub TransformVersionToNum {
+ my $version = shift;
+
+ # remove the 3 last . to have a Perl number
+ $version =~ s/(.*\..*)\.(.*)\.(.*)/$1$2$3/;
+
+ # three X's at the end indicate that you are testing patch with dbrev
+ # change it into 999
+ # prevents error on a < comparison between strings (should be: lt)
+ $version =~ s/XXX$/999/;
+ return $version;
+}
1;