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

(-)a/t/db_dependent/Reserves.t (-3 / +28 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 81;
20
use Test::More tests => 73;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Warn;
22
use Test::Warn;
23
23
Lines 155-160 ok( Link Here
155
);
155
);
156
t::lib::Mocks::mock_preference( 'ReservesControlBranch', $ReservesControlBranch );
156
t::lib::Mocks::mock_preference( 'ReservesControlBranch', $ReservesControlBranch );
157
157
158
# Set the preference 'IndependentBranchesTransfers' is set to 'yes'
159
# the userenv branch and the branche code are not the same holds should be filtered
160
t::lib::Mocks::mock_preference( 'IndependentBranchesTransfers', 1 );
161
($status, $reserve, $all_reserves) = CheckReserves( $item );
162
is( $status, "", 'Reserves is filtered');
163
164
# Set the userenv branchcode to be the same to the item branchcode.
165
t::lib::Mocks::mock_userenv({ branchcode => $branchcode });
166
($status, $reserve, $all_reserves) = CheckReserves( $item );
167
is( $status, "Reserved", 'Reserves should not be filtered');
168
169
t::lib::Mocks::mock_userenv({ branchcode => $branch_1 });
170
t::lib::Mocks::mock_preference( 'IndependentBranchesTransfers', 0 );
171
my $ReservesControlBranch = C4::Context->preference('ReservesControlBranch');
172
t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'ItemHomeLibrary' );
173
ok(
174
	$item->homebranch eq Koha::Policy::Holds->holds_control_library( $item, $patron	),
175
    "Koha::Policy::Holds->holds_control_library returns item home branch when set to ItemHomeLibrary"
176
);
177
t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'PatronLibrary' );
178
ok(
179
	$patron->branchcode eq Koha::Policy::Holds->holds_control_library( $item, $patron ),
180
    "Koha::Policy::Holds->holds_control_library returns patron home branch when set to PatronLibrary"
181
);
182
t::lib::Mocks::mock_preference( 'ReservesControlBranch', $ReservesControlBranch );
183
158
###
184
###
159
### Regression test for bug 10272
185
### Regression test for bug 10272
160
###
186
###
Lines 1450-1456 sub count_hold_print_messages { Link Here
1450
    my $message_count = $dbh->selectall_arrayref(q{
1476
    my $message_count = $dbh->selectall_arrayref(q{
1451
        SELECT COUNT(*)
1477
        SELECT COUNT(*)
1452
        FROM message_queue
1478
        FROM message_queue
1453
        WHERE letter_code = 'HOLD' 
1479
        WHERE letter_code = 'HOLD'
1454
        AND   message_transport_type = 'print'
1480
        AND   message_transport_type = 'print'
1455
    });
1481
    });
1456
    return $message_count->[0]->[0];
1482
    return $message_count->[0]->[0];
1457
- 

Return to bug 33200