|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 70; |
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 61-67
my $builder = t::lib::TestBuilder->new;
Link Here
|
| 61 |
|
61 |
|
| 62 |
my $frameworkcode = q//; |
62 |
my $frameworkcode = q//; |
| 63 |
|
63 |
|
| 64 |
t::lib::Mocks::mock_preference( 'ReservesNeedReturns', 1 ); |
64 |
|
|
|
65 |
t::lib::Mocks::mock_preference('ReservesNeedReturns', 1); |
| 66 |
t::lib::Mocks::mock_preference( 'IndependentBranchesTransfers', 0 ); |
| 65 |
|
67 |
|
| 66 |
# Somewhat arbitrary field chosen for age restriction unit tests. Must be added to db before the framework is cached |
68 |
# Somewhat arbitrary field chosen for age restriction unit tests. Must be added to db before the framework is cached |
| 67 |
$dbh->do( |
69 |
$dbh->do( |
|
Lines 132-137
ok( exists( $reserve->{reserve_id} ), 'CheckReserves() include reserve_id in its
Link Here
|
| 132 |
( $status, $reserve, $all_reserves ) = CheckReserves($item); |
134 |
( $status, $reserve, $all_reserves ) = CheckReserves($item); |
| 133 |
is( $status, "Reserved", "CheckReserves Test 2" ); |
135 |
is( $status, "Reserved", "CheckReserves Test 2" ); |
| 134 |
|
136 |
|
|
|
137 |
# Set the preference 'IndependentBranchesTransfers' is set to 'yes' |
| 138 |
# the userenv branch and the branche code are not the same holds should be filtered |
| 139 |
t::lib::Mocks::mock_preference( 'IndependentBranchesTransfers', 1 ); |
| 140 |
($status, $reserve, $all_reserves) = CheckReserves( $item ); |
| 141 |
is( $status, "", 'Reserves is filtered'); |
| 142 |
|
| 143 |
# Set the userenv branchcode to be the same to the item branchcode. |
| 144 |
t::lib::Mocks::mock_userenv({ branchcode => $branchcode }); |
| 145 |
($status, $reserve, $all_reserves) = CheckReserves( $item ); |
| 146 |
is( $status, "Reserved", 'Reserves should not be filtered'); |
| 147 |
|
| 148 |
t::lib::Mocks::mock_userenv({ branchcode => $branch_1 }); |
| 149 |
t::lib::Mocks::mock_preference( 'IndependentBranchesTransfers', 0 ); |
| 150 |
my $ReservesControlBranch = C4::Context->preference('ReservesControlBranch'); |
| 151 |
t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'ItemHomeLibrary' ); |
| 152 |
ok( |
| 153 |
$item->homebranch eq Koha::Policy::Holds->holds_control_library( $item, $patron ), |
| 154 |
"Koha::Policy::Holds->holds_control_library returns item home branch when set to ItemHomeLibrary" |
| 155 |
); |
| 156 |
t::lib::Mocks::mock_preference( 'ReservesControlBranch', 'PatronLibrary' ); |
| 157 |
ok( |
| 158 |
$patron->branchcode eq Koha::Policy::Holds->holds_control_library( $item, $patron ), |
| 159 |
"Koha::Policy::Holds->holds_control_library returns patron home branch when set to PatronLibrary" |
| 160 |
); |
| 161 |
t::lib::Mocks::mock_preference( 'ReservesControlBranch', $ReservesControlBranch ); |
| 162 |
|
| 135 |
### |
163 |
### |
| 136 |
### Regression test for bug 10272 |
164 |
### Regression test for bug 10272 |
| 137 |
### |
165 |
### |
|
Lines 1533-1539
sub count_hold_print_messages {
Link Here
|
| 1533 |
q{ |
1561 |
q{ |
| 1534 |
SELECT COUNT(*) |
1562 |
SELECT COUNT(*) |
| 1535 |
FROM message_queue |
1563 |
FROM message_queue |
| 1536 |
WHERE letter_code = 'HOLD' |
1564 |
WHERE letter_code = 'HOLD' |
| 1537 |
AND message_transport_type = 'print' |
1565 |
AND message_transport_type = 'print' |
| 1538 |
} |
1566 |
} |
| 1539 |
); |
1567 |
); |
| 1540 |
- |
|
|