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

(-)a/t/Calendar.t (-29 / +4 lines)
Lines 207-221 my $holiday_for_another_branch = DateTime->new( Link Here
207
207
208
{    ## 'Datedue' tests
208
{    ## 'Datedue' tests
209
209
210
    $module_context->unmock('preference');
210
    $cal = Koha::Calendar->new( branchcode => 'MPL', days_mode => 'Datedue' );
211
    $module_context->mock(
212
        'preference',
213
        sub {
214
            return 'Datedue';
215
        }
216
    );
217
218
    $cal = Koha::Calendar->new( branchcode => 'MPL' );
219
211
220
    is($cal->addDate( $dt, $one_day_dur, 'days' ), # tuesday
212
    is($cal->addDate( $dt, $one_day_dur, 'days' ), # tuesday
221
        dt_from_string('2012-07-05','iso'),
213
        dt_from_string('2012-07-05','iso'),
Lines 246-260 my $holiday_for_another_branch = DateTime->new( Link Here
246
238
247
{   ## 'Calendar' tests'
239
{   ## 'Calendar' tests'
248
240
249
    $module_context->unmock('preference');
241
    $cal = Koha::Calendar->new( branchcode => 'MPL', days_mode => 'Calendar' );
250
    $module_context->mock(
251
        'preference',
252
        sub {
253
            return 'Calendar';
254
        }
255
    );
256
257
    $cal = Koha::Calendar->new( branchcode => 'MPL' );
258
242
259
    $dt = dt_from_string('2012-07-03','iso');
243
    $dt = dt_from_string('2012-07-03','iso');
260
244
Lines 281-295 my $holiday_for_another_branch = DateTime->new( Link Here
281
265
282
266
283
{   ## 'Days' tests
267
{   ## 'Days' tests
284
    $module_context->unmock('preference');
285
    $module_context->mock(
286
        'preference',
287
        sub {
288
            return 'Days';
289
        }
290
    );
291
268
292
    $cal = Koha::Calendar->new( branchcode => 'MPL' );
269
    $cal = Koha::Calendar->new( branchcode => 'MPL', days_mode => 'Days' );
293
270
294
    $dt = dt_from_string('2012-07-03','iso');
271
    $dt = dt_from_string('2012-07-03','iso');
295
272
Lines 324-334 my $holiday_for_another_branch = DateTime->new( Link Here
324
}
301
}
325
302
326
subtest 'days_mode parameter' => sub {
303
subtest 'days_mode parameter' => sub {
327
    plan tests => 2;
304
    plan tests => 1;
328
305
329
    t::lib::Mocks::mock_preference('useDaysMode', 'Days');
306
    t::lib::Mocks::mock_preference('useDaysMode', 'Days');
330
    my $cal = Koha::Calendar->new( branchcode => 'CPL' );
331
    is( $cal->{days_mode}, 'Days', q|If not set, days_mode defaults to syspref's value|);
332
307
333
    $cal = Koha::Calendar->new( branchcode => 'CPL', days_mode => 'Calendar' );
308
    $cal = Koha::Calendar->new( branchcode => 'CPL', days_mode => 'Calendar' );
334
    is( $cal->{days_mode}, 'Calendar', q|If set, days_mode is correctly set|);
309
    is( $cal->{days_mode}, 'Calendar', q|If set, days_mode is correctly set|);
(-)a/t/db_dependent/Calendar.t (-2 / +1 lines)
Lines 52-58 my $holiday = $builder->build( Link Here
52
    }
52
    }
53
);
53
);
54
54
55
my $calendar = Koha::Calendar->new( branchcode => $library->branchcode );
55
my $calendar = Koha::Calendar->new( branchcode => $library->branchcode, days_mode => 'Calendar' );
56
56
57
subtest 'days_forward' => sub {
57
subtest 'days_forward' => sub {
58
58
59
- 

Return to bug 24159