Add and change preferences, change tab names in sysprefs editor
[koha.git] / t / db_dependent / Context.t
blob31b06843496ba3910a3f721206e7dc3a28315465
1 #!/usr/bin/perl
4 use strict;
5 use warnings;
7 use Test::More tests => 91;
8 use vars qw($debug $koha $dbh $config $ret);
10 BEGIN {
11 $debug = $ENV{DEBUG} || 0;
12 diag("Note: The overall number of tests may vary by configuration.");
13 diag("First we need to check your environmental variables");
14 for (qw(KOHA_CONF PERL5LIB)) {
15 ok($ret = $ENV{$_}, "ENV{$_} = $ret");
17 use_ok('C4::Context');
18 use_ok('C4::Utils', qw/ :all /);
21 ok($koha = C4::Context->new, 'C4::Context->new');
22 ok($dbh = C4::Context->dbh(), 'Getting dbh from C4::Context');
23 ok($ret = C4::Context->KOHAVERSION, ' (function) KOHAVERSION = ' . ($ret||''));
24 ok($ret = $koha->KOHAVERSION, ' $koha->KOHAVERSION = ' . ($ret||''));
25 my @keys = keys %$koha;
26 diag("Number of keys in \%\$koha: " . scalar @keys);
27 our $width = 0;
28 if (ok(@keys)) {
29 $width = maxwidth(@keys);
30 $debug and diag "widest key is $width";
32 foreach (sort @keys) {
33 ok(exists $koha->{$_},
34 '$koha->{' . sprintf('%' . $width . 's', $_) . '} exists '
35 . ((defined $koha->{$_}) ? "and is defined." : "but is not defined.")
38 diag "Examining defined key values.";
39 foreach (grep {defined $koha->{$_}} sort @keys) {
40 print "\n";
41 hashdump('$koha->{' . sprintf('%' . $width . 's', $_) . '}', $koha->{$_});
43 ok($config = $koha->{config}, 'Getting $koha->{config} ');
45 # diag("Examining configuration.");
46 diag("Note: The overall number of tests may vary by configuration. Disregard the projected number.");
48 __END__