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

(-)a/t/db_dependent/Koha/CirculationRules.t (-2 / +91 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 4;
22
use Test::More tests => 5;
23
use Test::Exception;
23
use Test::Exception;
24
24
25
use Koha::CirculationRules;
25
use Koha::CirculationRules;
Lines 297-302 subtest 'get_effective_daysmode' => sub { Link Here
297
    $schema->storage->txn_rollback;
297
    $schema->storage->txn_rollback;
298
};
298
};
299
299
300
subtest 'get_effective_expire_reserves_charge' => sub {
301
    plan tests => 4;
302
303
    $schema->storage->txn_begin;
304
305
    t::lib::Mocks::mock_preference( 'ExpireReservesMaxPickUpDelayCharge', 10 );
306
307
    is(
308
        Koha::CirculationRules->get_effective_expire_reserves_charge(
309
            {
310
                itemtype     => undef,
311
                branchcode   => undef,
312
                categorycode => undef,
313
            }
314
        ),
315
        '10',
316
        'use the default pref value as the circ rule does not exist'
317
    );
318
319
    Koha::CirculationRules->set_rule(
320
        {
321
            branchcode   => '*',
322
            categorycode => '*',
323
            itemtype     => '*',
324
            rule_name    => 'expire_reserves_charge',
325
            rule_value   => '20'
326
        }
327
    );
328
329
    is(
330
        Koha::CirculationRules->get_effective_expire_reserves_charge(
331
            {
332
                categorycode => undef,
333
                itemtype     => undef,
334
                branchcode   => undef
335
            }
336
        ),
337
        '20',
338
        "use the value from the circ rules"
339
    );
340
341
    t::lib::Mocks::mock_preference( 'ExpireReservesMaxPickUpDelayCharge', 30 );
342
343
    Koha::CirculationRules->set_rule(
344
        {
345
            branchcode   => '*',
346
            categorycode => '*',
347
            itemtype     => '*',
348
            rule_name    => 'expire_reserves_charge',
349
            rule_value   => undef
350
        }
351
    );
352
353
    is(
354
        Koha::CirculationRules->get_effective_expire_reserves_charge(
355
            {
356
                categorycode => undef,
357
                itemtype     => undef,
358
                branchcode   => undef
359
            }
360
        ),
361
        '30',
362
        "use the default pref value for as the circ rule has undefined value"
363
    );
364
365
    Koha::CirculationRules->set_rule(
366
        {
367
            branchcode   => '*',
368
            categorycode => '*',
369
            itemtype     => '*',
370
            rule_name    => 'expire_reserves_charge',
371
            rule_value   => '0'
372
        }
373
    );
374
375
    is(
376
        Koha::CirculationRules->get_effective_expire_reserves_charge(
377
            {
378
                categorycode => undef,
379
                itemtype     => undef,
380
                branchcode   => undef
381
            }
382
        ),
383
        '0',
384
        "use the value from the circ rules for even though it's 0"
385
    );
386
387
    $schema->storage->txn_rollback;
388
};
389
300
subtest 'get_lostreturn_policy() tests' => sub {
390
subtest 'get_lostreturn_policy() tests' => sub {
301
    plan tests => 7;
391
    plan tests => 7;
302
392
303
- 

Return to bug 25711