Lines 208-214
subtest 'in_transit tests' => sub {
Link Here
|
208 |
}; |
208 |
}; |
209 |
|
209 |
|
210 |
subtest 'cancel tests' => sub { |
210 |
subtest 'cancel tests' => sub { |
211 |
plan tests => 5; |
211 |
plan tests => 7; |
212 |
|
212 |
|
213 |
$schema->storage->txn_begin; |
213 |
$schema->storage->txn_begin; |
214 |
|
214 |
|
Lines 245-259
subtest 'cancel tests' => sub {
Link Here
|
245 |
'Exception thrown if a reason is not passed to cancel'; |
245 |
'Exception thrown if a reason is not passed to cancel'; |
246 |
|
246 |
|
247 |
# Item in transit should result in failure |
247 |
# Item in transit should result in failure |
248 |
throws_ok { $transfer->cancel($cancellation_reason) } |
248 |
throws_ok { $transfer->cancel({ reason => $cancellation_reason }) } |
249 |
'Koha::Exceptions::Item::Transfer::Transit', |
249 |
'Koha::Exceptions::Item::Transfer::Transit', |
250 |
'Exception thrown if item is in transit'; |
250 |
'Exception thrown if item is in transit'; |
251 |
|
251 |
|
252 |
$transfer->datesent(undef)->store(); |
252 |
$transfer->cancel({ reason => $cancellation_reason, force => 1}); |
|
|
253 |
ok( $transfer->datecancelled, 'Forced cancellation, cancellation date set' ); |
254 |
is( $transfer->cancellation_reason, 'Manual', 'Forced cancellation, cancellation reason is set'); |
255 |
|
256 |
$transfer->datecancelled(undef); |
257 |
$transfer->cancellation_reason(undef); |
258 |
$transfer->datesent(undef); |
253 |
|
259 |
|
254 |
# Transit state unset |
260 |
# Transit state unset |
255 |
$transfer->discard_changes; |
261 |
$transfer->store()->discard_changes; |
256 |
$transfer->cancel($cancellation_reason); |
262 |
$transfer->cancel({ reason => $cancellation_reason }); |
257 |
ok( $transfer->datecancelled, 'Cancellation date set upon call to cancel' ); |
263 |
ok( $transfer->datecancelled, 'Cancellation date set upon call to cancel' ); |
258 |
is( $transfer->cancellation_reason, 'Manual', 'Cancellation reason is set'); |
264 |
is( $transfer->cancellation_reason, 'Manual', 'Cancellation reason is set'); |
259 |
|
265 |
|
260 |
- |
|
|