|
Lines 10-15
use t::lib::Mocks;
Link Here
|
| 10 |
|
10 |
|
| 11 |
BEGIN { use_ok('Koha::DateUtils'); } |
11 |
BEGIN { use_ok('Koha::DateUtils'); } |
| 12 |
|
12 |
|
|
|
13 |
t::lib::Mocks::mock_preference('dateformat', 'us'); |
| 14 |
t::lib::Mocks::mock_preference('TimeFormat', 'This_is_not_used_but_called'); |
| 15 |
|
| 13 |
my $tz = C4::Context->tz; |
16 |
my $tz = C4::Context->tz; |
| 14 |
|
17 |
|
| 15 |
isa_ok( $tz, 'DateTime::TimeZone', 'Context returns timezone object' ); |
18 |
isa_ok( $tz, 'DateTime::TimeZone', 'Context returns timezone object' ); |
|
Lines 26-35
$dt->set_minute(0);
Link Here
|
| 26 |
|
29 |
|
| 27 |
my $date_string; |
30 |
my $date_string; |
| 28 |
|
31 |
|
| 29 |
my $module_context = new Test::MockModule('C4::Context'); |
|
|
| 30 |
|
| 31 |
t::lib::Mocks::mock_preference('dateformat', 'us'); |
| 32 |
|
| 33 |
my $dateformat = C4::Context->preference('dateformat'); |
32 |
my $dateformat = C4::Context->preference('dateformat'); |
| 34 |
cmp_ok output_pref({ dt => $dt, dateformat => $dateformat }), |
33 |
cmp_ok output_pref({ dt => $dt, dateformat => $dateformat }), |
| 35 |
'eq', |
34 |
'eq', |
|
Lines 160-165
cmp_ok $date_string, 'eq', '12/11/2013 06:35 PM', 'as_due_date with hours and ti
Link Here
|
| 160 |
my $now = DateTime->now; |
159 |
my $now = DateTime->now; |
| 161 |
is( dt_from_string, $now, "Without parameter, dt_from_string should return today" ); |
160 |
is( dt_from_string, $now, "Without parameter, dt_from_string should return today" ); |
| 162 |
|
161 |
|
|
|
162 |
my $module_context = new Test::MockModule('C4::Context'); |
| 163 |
$module_context->mock( |
163 |
$module_context->mock( |
| 164 |
'tz', |
164 |
'tz', |
| 165 |
sub { |
165 |
sub { |
| 166 |
- |
|
|