|
Lines 7-14
use Test::More;
Link Here
|
| 7 |
use Test::MockModule; |
7 |
use Test::MockModule; |
| 8 |
use vars qw($debug $koha $dbh $config $ret); |
8 |
use vars qw($debug $koha $dbh $config $ret); |
| 9 |
use t::lib::Mocks; |
9 |
use t::lib::Mocks; |
| 10 |
|
10 |
use Test::More tests => 41; |
| 11 |
use Koha::Database; |
11 |
use Koha::Database; |
|
|
12 |
use DateTime; |
| 12 |
|
13 |
|
| 13 |
BEGIN { |
14 |
BEGIN { |
| 14 |
$debug = $ENV{DEBUG} || 0; |
15 |
$debug = $ENV{DEBUG} || 0; |
|
Lines 135-140
C4::Context->set_preference('AutoEmailOpacUser', '');
Link Here
|
| 135 |
my $yesno_pref = Koha::Config::SysPrefs->find('AutoEmailOpacUser'); |
136 |
my $yesno_pref = Koha::Config::SysPrefs->find('AutoEmailOpacUser'); |
| 136 |
is( $yesno_pref->value(), 0, 'set_preference should have set the value to 0, instead of an empty string' ); |
137 |
is( $yesno_pref->value(), 0, 'set_preference should have set the value to 0, instead of an empty string' ); |
| 137 |
|
138 |
|
|
|
139 |
|
| 140 |
sub get_env_variables { |
| 141 |
my $sth = $dbh->prepare("SHOW VARIABLES LIKE 'time_zone'"); |
| 142 |
$sth->execute(); |
| 143 |
return $sth->rows; |
| 144 |
} |
| 145 |
my $env_var = get_env_variables(); |
| 146 |
is($env_var, 1, "correct number of variables like time_zone"); |
| 147 |
|
| 148 |
sub get_current_time { |
| 149 |
my $sth = $dbh->prepare("SELECT now()"); |
| 150 |
$sth->execute(); |
| 151 |
return $sth->fetchrow_array;# Return a time value rather than hash value |
| 152 |
} |
| 153 |
my $datetime = DateTime->now; |
| 154 |
my $date = $datetime->ymd; |
| 155 |
my $time = $datetime->hms; |
| 156 |
my $compardt = "$date $time"; |
| 157 |
|
| 158 |
my $current_time = get_current_time(); |
| 159 |
is($current_time, $compardt, "Correct time"); |
| 160 |
|
| 138 |
done_testing(); |
161 |
done_testing(); |
| 139 |
|
162 |
|
| 140 |
sub TransformVersionToNum { |
163 |
sub TransformVersionToNum { |
| 141 |
- |
|
|