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

(-)a/t/db_dependent/Koha/Libraries.t (-3 / +26 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 7;
22
use Test::More tests => 8;
23
23
24
use C4::Biblio;
24
use C4::Biblio;
25
use C4::Context;
25
use C4::Context;
Lines 35-40 use Koha::Database; Link Here
35
use t::lib::Mocks;
35
use t::lib::Mocks;
36
use t::lib::TestBuilder;
36
use t::lib::TestBuilder;
37
37
38
use_ok('Koha::Template::Plugin::Branches');
39
38
my $schema = Koha::Database->new->schema;
40
my $schema = Koha::Database->new->schema;
39
$schema->storage->txn_begin;
41
$schema->storage->txn_begin;
40
42
Lines 115-121 subtest 'pickup_locations' => sub { Link Here
115
    my $itemtype = $biblio->itemtype;
117
    my $itemtype = $biblio->itemtype;
116
118
117
    subtest 'UseBranchTransferLimits = OFF' => sub {
119
    subtest 'UseBranchTransferLimits = OFF' => sub {
118
        plan tests => 5;
120
        plan tests => 10;
119
121
120
        t::lib::Mocks::mock_preference('UseBranchTransferLimits', 0);
122
        t::lib::Mocks::mock_preference('UseBranchTransferLimits', 0);
121
        t::lib::Mocks::mock_preference('BranchTransferLimitsType', 'itemtype');
123
        t::lib::Mocks::mock_preference('BranchTransferLimitsType', 'itemtype');
Lines 148-153 subtest 'pickup_locations' => sub { Link Here
148
        $pickup = Koha::Libraries->pickup_locations({ biblio => $bibnum });
150
        $pickup = Koha::Libraries->pickup_locations({ biblio => $bibnum });
149
        is(@{$pickup}, $total_pickup, '...as well as when '
151
        is(@{$pickup}, $total_pickup, '...as well as when '
150
           .'BranchTransferLimitsType = ccode');
152
           .'BranchTransferLimitsType = ccode');
153
154
        # Test TT plugin
155
        $pickup = Koha::Template::Plugin::Branches::pickup_locations({ biblio => $bibnum });
156
        is(C4::Context->preference('UseBranchTransferLimits'), 0, 'Given system '
157
           .'preference UseBranchTransferLimits is switched OFF,');
158
        is(@{$pickup}, $total_pickup, 'Then the total number of pickup locations '
159
           .'equal number of libraries with pickup_location => 1');
160
161
        t::lib::Mocks::mock_preference('BranchTransferLimitsType', 'itemtype');
162
        t::lib::Mocks::mock_preference('item-level_itypes', 1);
163
        $pickup = Koha::Template::Plugin::Branches::pickup_locations({ biblio => $bibnum });
164
        is(@{$pickup}, $total_pickup, '...when '
165
           .'BranchTransferLimitsType = itemtype and item-level_itypes = 1');
166
        t::lib::Mocks::mock_preference('item-level_itypes', 0);
167
        $pickup = Koha::Template::Plugin::Branches::pickup_locations({ biblio => $bibnum });
168
        is(@{$pickup}, $total_pickup, '...as well as when '
169
           .'BranchTransferLimitsType = itemtype and item-level_itypes = 0');
170
        t::lib::Mocks::mock_preference('BranchTransferLimitsType', 'ccode');
171
        $pickup = Koha::Template::Plugin::Branches::pickup_locations({ biblio => $bibnum });
172
        is(@{$pickup}, $total_pickup, '...as well as when '
173
           .'BranchTransferLimitsType = ccode');
174
151
        t::lib::Mocks::mock_preference('item-level_itypes', 1);
175
        t::lib::Mocks::mock_preference('item-level_itypes', 1);
152
    };
176
    };
153
177
154
- 

Return to bug 22688