View | Details | Raw Unified | Return to bug 16539
Collapse All | Expand All

(-)a/t/Calendar.t (-2 / +15 lines)
Lines 29-35 use Module::Load::Conditional qw/check_install/; Link Here
29
29
30
BEGIN {
30
BEGIN {
31
    if ( check_install( module => 'Test::DBIx::Class' ) ) {
31
    if ( check_install( module => 'Test::DBIx::Class' ) ) {
32
        plan tests => 35;
32
        plan tests => 38;
33
    } else {
33
    } else {
34
        plan skip_all => "Need Test::DBIx::Class"
34
        plan skip_all => "Need Test::DBIx::Class"
35
    }
35
    }
Lines 85-90 fixtures_ok [ Link Here
85
        [ 'MPL', 11, 11, 2012, '', '', 1 ],    # sunday exception
85
        [ 'MPL', 11, 11, 2012, '', '', 1 ],    # sunday exception
86
        [ 'MPL', 1,  6,  2011, '', '', 0 ],
86
        [ 'MPL', 1,  6,  2011, '', '', 0 ],
87
        [ 'MPL', 4,  7,  2012, '', '', 0 ],
87
        [ 'MPL', 4,  7,  2012, '', '', 0 ],
88
        [ 'CPL', 6,  8,  2012, '', '', 0 ],
88
      ],
89
      ],
89
], "add fixtures";
90
], "add fixtures";
90
91
Lines 144-149 my $day_after_christmas = DateTime->new( Link Here
144
    day     => 26
145
    day     => 26
145
);  # for testing negative addDate
146
);  # for testing negative addDate
146
147
148
my $holiday_for_another_branch = DateTime->new(
149
    year => 2012,
150
    month => 8,
151
    day => 6, # This is a monday
152
);
153
147
{   # Syspref-agnostic tests
154
{   # Syspref-agnostic tests
148
    is ( $saturday->day_of_week, 6, '\'$saturday\' is actually a saturday (6th day of week)');
155
    is ( $saturday->day_of_week, 6, '\'$saturday\' is actually a saturday (6th day of week)');
149
    is ( $sunday->day_of_week, 7, '\'$sunday\' is actually a sunday (7th day of week)');
156
    is ( $sunday->day_of_week, 7, '\'$sunday\' is actually a sunday (7th day of week)');
Lines 155-160 my $day_after_christmas = DateTime->new( Link Here
155
    is ( $cal->is_holiday($single_holiday), 1, 'Single holiday closed day test' );
162
    is ( $cal->is_holiday($single_holiday), 1, 'Single holiday closed day test' );
156
    is ( $cal->is_holiday($notspecial), 0, 'Fixed single date that is not a holiday test' );
163
    is ( $cal->is_holiday($notspecial), 0, 'Fixed single date that is not a holiday test' );
157
    is ( $cal->is_holiday($sunday_exception), 0, 'Exception holiday is not a closed day test' );
164
    is ( $cal->is_holiday($sunday_exception), 0, 'Exception holiday is not a closed day test' );
165
    is ( $cal->is_holiday($holiday_for_another_branch), 0, 'Holiday defined for another branch should not be defined as an holiday' );
158
}
166
}
159
167
160
{   # Bugzilla #8966 - is_holiday truncates referenced date
168
{   # Bugzilla #8966 - is_holiday truncates referenced date
Lines 321-324 my $day_after_christmas = DateTime->new( Link Here
321
329
322
}
330
}
323
331
332
{
333
    $cal = Koha::Calendar->new( branchcode => 'CPL' );
334
    is ( $cal->is_holiday($single_holiday), 0, 'Single holiday for MPL, not CPL' );
335
    is ( $cal->is_holiday($holiday_for_another_branch), 1, 'Holiday defined for CPL should be defined as an holiday' );
336
}
337
324
1;
338
1;
325
- 

Return to bug 16539