Browse Source

Bug 8486 - Follow up making the tests db independent

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Makes the test db independant by specifying the date format. Thus, there is no call to ->preference() that retrieve a systempreference
3.10.x
Chris Cormack 12 years ago
committed by Paul Poulain
parent
commit
d434be61e2
  1. 28
      t/Calendar.t

28
t/Calendar.t

@ -106,24 +106,24 @@ $cal->set_daysmode('Calendar');
# example tests for bug report
$cal->clear_weekly_closed_days();
$daycount = $cal->days_between( dt_from_string('2012-01-10'),
dt_from_string("2012-05-05") )->in_units('days');
$daycount = $cal->days_between( dt_from_string('2012-01-10','iso'),
dt_from_string("2012-05-05",'iso') )->in_units('days');
cmp_ok( $daycount, '==', 116, 'test larger intervals' );
$daycount = $cal->days_between( dt_from_string("2012-01-01"),
dt_from_string("2012-05-05") )->in_units('days');
$daycount = $cal->days_between( dt_from_string("2012-01-01",'iso'),
dt_from_string("2012-05-05",'iso') )->in_units('days');
cmp_ok( $daycount, '==', 125, 'test positive intervals' );
my $daycount2 = $cal->days_between( dt_from_string("2012-05-05"),
dt_from_string("2012-01-01") )->in_units('days');
my $daycount2 = $cal->days_between( dt_from_string("2012-05-05",'iso'),
dt_from_string("2012-01-01",'iso') )->in_units('days');
cmp_ok( $daycount2, '==', $daycount, 'test parameter order not relevant' );
$daycount = $cal->days_between( dt_from_string("2012-07-01"),
dt_from_string("2012-07-15") )->in_units('days');
$daycount = $cal->days_between( dt_from_string("2012-07-01",'iso'),
dt_from_string("2012-07-15",'iso') )->in_units('days');
cmp_ok( $daycount, '==', 14, 'days_between calculates correctly' );
$cal->add_holiday( dt_from_string('2012-07-06') );
$daycount = $cal->days_between( dt_from_string("2012-07-01"),
dt_from_string("2012-07-15") )->in_units('days');
$cal->add_holiday( dt_from_string('2012-07-06','iso') );
$daycount = $cal->days_between( dt_from_string("2012-07-01",'iso'),
dt_from_string("2012-07-15",'iso') )->in_units('days');
cmp_ok( $daycount, '==', 13, 'holiday correctly recognized' );
$cal->add_holiday( dt_from_string('2012-07-07') );
$daycount = $cal->days_between( dt_from_string("2012-07-01"),
dt_from_string("2012-07-15") )->in_units('days');
$cal->add_holiday( dt_from_string('2012-07-07','iso') );
$daycount = $cal->days_between( dt_from_string("2012-07-01",'iso'),
dt_from_string("2012-07-15",'iso') )->in_units('days');
cmp_ok( $daycount, '==', 12, 'multiple holidays correctly recognized' );

Loading…
Cancel
Save