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

(-)a/t/db_dependent/Koha/IssuingRules.t (-2 / +17 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 2;
22
use Test::More tests => 3;
23
23
24
use Benchmark;
24
use Benchmark;
25
25
Lines 290-295 subtest 'get_opacitemholds_policy' => sub { Link Here
290
    $patron->delete;
290
    $patron->delete;
291
};
291
};
292
292
293
subtest 'get_onshelfholds_policy' => sub {
294
    plan tests => 3;
295
296
    t::lib::Mocks::mock_preference('item-level_itypes', 1);
297
    Koha::IssuingRules->delete;
298
299
    my $patron = $builder->build_object({ class => 'Koha::Patrons' });
300
    my $item = $builder->build_object({ class => 'Koha::Items' });
301
302
    is( Koha::IssuingRules->get_onshelfholds_policy({ item => $item, patron => $patron }), undef, 'Should return undef when no rules can be found' );
303
    Koha::IssuingRule->new({ categorycode => $patron->categorycode, itemtype => $item->itype, branchcode => '*', onshelfholds => "0" })->store;
304
    is( Koha::IssuingRules->get_onshelfholds_policy({ item => $item, patron => $patron }), 0, 'Should be zero' );
305
    Koha::IssuingRule->new({ categorycode => $patron->categorycode, itemtype => $item->itype, branchcode => $item->holdingbranch, onshelfholds => "2" })->store;
306
    is( Koha::IssuingRules->get_onshelfholds_policy({ item => $item, patron => $patron }), 2, 'Should be two now' );
307
};
308
293
sub _row_match {
309
sub _row_match {
294
    my ($rule, $branchcode, $categorycode, $itemtype) = @_;
310
    my ($rule, $branchcode, $categorycode, $itemtype) = @_;
295
311
296
- 

Return to bug 19301