Lines 180-185
subtest '_status' => sub {
Link Here
|
180 |
} |
180 |
} |
181 |
|
181 |
|
182 |
t::lib::Mocks::mock_preference( 'UseRecalls', 0 ); |
182 |
t::lib::Mocks::mock_preference( 'UseRecalls', 0 ); |
|
|
183 |
$schema->storage->txn_rollback; |
184 |
}; |
185 |
|
186 |
subtest 'store PreventWithDrawingItemsStatus' => sub { |
187 |
plan tests => 2; |
188 |
$schema->storage->txn_begin; |
189 |
|
190 |
t::lib::Mocks::mock_preference( 'PreventWithDrawingItemsStatus', 'intransit,checkedout' ); |
191 |
my $library_1 = $builder->build( { source => 'Branch' } ); |
192 |
my $library_2 = $builder->build( { source => 'Branch' } ); |
193 |
|
194 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
195 |
t::lib::Mocks::mock_userenv( { branchcode => $patron->branchcode } ); |
196 |
|
197 |
my $item = $builder->build_sample_item( |
198 |
{ |
199 |
withdrawn => 0, |
200 |
} |
201 |
); |
202 |
|
203 |
#Check item out |
204 |
C4::Circulation::AddIssue( $patron, $item->barcode ); |
205 |
|
206 |
throws_ok { $item->withdrawn('1')->store } |
207 |
'Koha::Exceptions::Item::Transfer::OnLoan', |
208 |
'Exception thrown when trying to withdraw checked-out item'; |
209 |
|
210 |
my $item_2 = $builder->build_sample_item( |
211 |
{ |
212 |
withdrawn => 0, |
213 |
} |
214 |
); |
215 |
|
216 |
#set in_transit |
217 |
my $transfer_1 = $builder->build_object( |
218 |
{ |
219 |
class => 'Koha::Item::Transfers', |
220 |
value => { |
221 |
itemnumber => $item_2->itemnumber, |
222 |
frombranch => $library_1->{branchcode}, |
223 |
tobranch => $library_2->{branchcode}, |
224 |
datesent => '1999-12-31', |
225 |
} |
226 |
} |
227 |
); |
228 |
|
229 |
throws_ok { $item_2->withdrawn('1')->store } |
230 |
'Koha::Exceptions::Item::Transfer::InTransit', |
231 |
'Exception thrown when trying to withdraw item in transit'; |
232 |
|
233 |
t::lib::Mocks::mock_preference( 'PreventWithDrawingItemsStatus', '' ); |
183 |
|
234 |
|
184 |
$schema->storage->txn_rollback; |
235 |
$schema->storage->txn_rollback; |
185 |
}; |
236 |
}; |
Lines 189-195
subtest 'z3950_status' => sub {
Link Here
|
189 |
|
240 |
|
190 |
$schema->storage->txn_begin; |
241 |
$schema->storage->txn_begin; |
191 |
t::lib::Mocks::mock_preference( 'z3950Status', '' ); |
242 |
t::lib::Mocks::mock_preference( 'z3950Status', '' ); |
192 |
|
|
|
193 |
my $itemtype = $builder->build_object( { class => "Koha::ItemTypes" } ); |
243 |
my $itemtype = $builder->build_object( { class => "Koha::ItemTypes" } ); |
194 |
my $item = $builder->build_sample_item( |
244 |
my $item = $builder->build_sample_item( |
195 |
{ |
245 |
{ |
196 |
- |
|
|