Lines 4-10
use strict;
Link Here
|
4 |
use warnings; |
4 |
use warnings; |
5 |
use DateTime; |
5 |
use DateTime; |
6 |
use DateTime::Duration; |
6 |
use DateTime::Duration; |
7 |
use Test::More tests => 22; |
7 |
use Test::More tests => 26; |
8 |
use Koha::DateUtils; |
8 |
use Koha::DateUtils; |
9 |
|
9 |
|
10 |
BEGIN { |
10 |
BEGIN { |
Lines 127-135
my $one_day_dur = DateTime::Duration->new( days => 1 );
Link Here
|
127 |
my $two_day_dur = DateTime::Duration->new( days => 2 ); |
127 |
my $two_day_dur = DateTime::Duration->new( days => 2 ); |
128 |
my $seven_day_dur = DateTime::Duration->new( days => 7 ); |
128 |
my $seven_day_dur = DateTime::Duration->new( days => 7 ); |
129 |
|
129 |
|
130 |
subtest '\'Datedue\' tests' => sub { |
130 |
## 'Datedue' tests |
131 |
my $cal = Koha::Calendar->new( TEST_MODE => 1 , |
131 |
$cal = Koha::Calendar->new( TEST_MODE => 1 , |
132 |
days_mode => 'Datedue'); |
132 |
days_mode => 'Datedue'); |
133 |
|
133 |
|
134 |
$cal->add_holiday( dt_from_string('2012-07-04','iso') ); |
134 |
$cal->add_holiday( dt_from_string('2012-07-04','iso') ); |
135 |
$dt = dt_from_string( '2012-07-03','iso' ); |
135 |
$dt = dt_from_string( '2012-07-03','iso' ); |
Lines 145-156
subtest '\'Datedue\' tests' => sub {
Link Here
|
145 |
cmp_ok($cal->addDate( $test_dt, $seven_day_dur, 'days' ), 'eq', |
145 |
cmp_ok($cal->addDate( $test_dt, $seven_day_dur, 'days' ), 'eq', |
146 |
'2012-07-30T11:53:00', |
146 |
'2012-07-30T11:53:00', |
147 |
'Add 7 days (Datedue)' ); |
147 |
'Add 7 days (Datedue)' ); |
148 |
}; |
|
|
149 |
|
148 |
|
150 |
|
149 |
|
151 |
subtest '\'Calendar\' tests' => sub { |
150 |
|
152 |
my $cal = Koha::Calendar->new( TEST_MODE => 1, |
151 |
## 'Calendar' tests' |
153 |
days_mode => 'Calendar' ); |
152 |
$cal = Koha::Calendar->new( TEST_MODE => 1, |
|
|
153 |
days_mode => 'Calendar' ); |
154 |
|
154 |
|
155 |
$cal->add_holiday( dt_from_string('2012-07-04','iso') ); |
155 |
$cal->add_holiday( dt_from_string('2012-07-04','iso') ); |
156 |
$dt = dt_from_string('2012-07-03','iso'); |
156 |
$dt = dt_from_string('2012-07-03','iso'); |
Lines 162-173
subtest '\'Calendar\' tests' => sub {
Link Here
|
162 |
cmp_ok($cal->addDate( $test_dt, $seven_day_dur, 'days' ), 'eq', |
162 |
cmp_ok($cal->addDate( $test_dt, $seven_day_dur, 'days' ), 'eq', |
163 |
'2012-07-31T11:53:00', |
163 |
'2012-07-31T11:53:00', |
164 |
'Add 7 days (Calendar)' ); |
164 |
'Add 7 days (Calendar)' ); |
165 |
}; |
|
|
166 |
|
165 |
|
167 |
|
166 |
|
168 |
subtest '\'Days\' tests' => sub { |
167 |
|
169 |
my $cal = Koha::Calendar->new( TEST_MODE => 1, |
168 |
## 'Days' tests |
170 |
days_mode => 'Days' ); |
169 |
$cal = Koha::Calendar->new( TEST_MODE => 1, |
|
|
170 |
days_mode => 'Days' ); |
171 |
|
171 |
|
172 |
$cal->add_holiday( dt_from_string('2012-07-04','iso') ); |
172 |
$cal->add_holiday( dt_from_string('2012-07-04','iso') ); |
173 |
$dt = dt_from_string('2012-07-03','iso'); |
173 |
$dt = dt_from_string('2012-07-03','iso'); |
Lines 179-182
subtest '\'Days\' tests' => sub {
Link Here
|
179 |
cmp_ok($cal->addDate( $test_dt, $seven_day_dur, 'days' ),'eq', |
179 |
cmp_ok($cal->addDate( $test_dt, $seven_day_dur, 'days' ),'eq', |
180 |
'2012-07-30T11:53:00', |
180 |
'2012-07-30T11:53:00', |
181 |
'Add 7 days (Days)' ); |
181 |
'Add 7 days (Days)' ); |
182 |
}; |
|
|
183 |
- |