|
Lines 4-14
Link Here
|
| 4 |
# Current state is very rudimentary. Please help to extend it! |
4 |
# Current state is very rudimentary. Please help to extend it! |
| 5 |
|
5 |
|
| 6 |
use Modern::Perl; |
6 |
use Modern::Perl; |
| 7 |
use Test::More tests => 8; |
7 |
use Test::More tests => 10; |
| 8 |
|
8 |
|
| 9 |
use Koha::Database; |
9 |
use Koha::Database; |
| 10 |
use t::lib::TestBuilder; |
10 |
use t::lib::TestBuilder; |
| 11 |
use t::lib::Mocks; |
11 |
use t::lib::Mocks; |
|
|
12 |
use C4::SIP::ILS; |
| 12 |
use C4::SIP::ILS::Patron; |
13 |
use C4::SIP::ILS::Patron; |
| 13 |
use C4::SIP::ILS::Transaction::RenewAll; |
14 |
use C4::SIP::ILS::Transaction::RenewAll; |
| 14 |
use C4::SIP::ILS::Transaction::Checkout; |
15 |
use C4::SIP::ILS::Transaction::Checkout; |
|
Lines 318-321
subtest do_checkin => sub {
Link Here
|
| 318 |
is( $patron->checkouts->count, 0, 'Checkin should have been done successfully'); |
319 |
is( $patron->checkouts->count, 0, 'Checkin should have been done successfully'); |
| 319 |
}; |
320 |
}; |
| 320 |
|
321 |
|
|
|
322 |
subtest checkin_lost => sub { |
| 323 |
plan tests => 2; |
| 324 |
|
| 325 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 326 |
|
| 327 |
t::lib::Mocks::mock_userenv( |
| 328 |
{ branchcode => $library->branchcode, flags => 1 } ); |
| 329 |
|
| 330 |
my $item = $builder->build_sample_item( |
| 331 |
{ |
| 332 |
library => $library->branchcode, |
| 333 |
} |
| 334 |
); |
| 335 |
|
| 336 |
$item->itemlost(1)->itemlost_on(dt_from_string)->store(); |
| 337 |
|
| 338 |
my $instituation = { |
| 339 |
id => $library->id, |
| 340 |
implementation => "ILS", |
| 341 |
policy => { |
| 342 |
checkin => "true", |
| 343 |
renewal => "true", |
| 344 |
checkout => "true", |
| 345 |
timeout => 100, |
| 346 |
retries => 5, |
| 347 |
} |
| 348 |
}; |
| 349 |
my $ils = C4::SIP::ILS->new( $instituation ); |
| 350 |
|
| 351 |
t::lib::Mocks::mock_preference('BlockReturnOfLostItems', '1'); |
| 352 |
my $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp ); |
| 353 |
is( $circ->{screen_msg}, 'Item lost, return not allowed', "Got correct screen message" ); |
| 354 |
|
| 355 |
t::lib::Mocks::mock_preference('BlockReturnOfLostItems', '0'); |
| 356 |
$circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp ); |
| 357 |
is( $circ->{screen_msg}, 'Item not checked out', "Got 'Item not checked out' screen message" ); |
| 358 |
}; |
| 359 |
|
| 360 |
subtest checkin_withdrawn => sub { |
| 361 |
plan tests => 2; |
| 362 |
|
| 363 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 364 |
|
| 365 |
t::lib::Mocks::mock_userenv( |
| 366 |
{ branchcode => $library->branchcode, flags => 1 } ); |
| 367 |
|
| 368 |
my $item = $builder->build_sample_item( |
| 369 |
{ |
| 370 |
library => $library->branchcode, |
| 371 |
} |
| 372 |
); |
| 373 |
|
| 374 |
$item->withdrawn(1)->withdrawn_on(dt_from_string)->store(); |
| 375 |
|
| 376 |
my $instituation = { |
| 377 |
id => $library->id, |
| 378 |
implementation => "ILS", |
| 379 |
policy => { |
| 380 |
checkin => "true", |
| 381 |
renewal => "true", |
| 382 |
checkout => "true", |
| 383 |
timeout => 100, |
| 384 |
retries => 5, |
| 385 |
} |
| 386 |
}; |
| 387 |
my $ils = C4::SIP::ILS->new( $instituation ); |
| 388 |
|
| 389 |
t::lib::Mocks::mock_preference('BlockReturnOfWithdrawnItems', '1'); |
| 390 |
my $circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp ); |
| 391 |
is( $circ->{screen_msg}, 'Item withdrawn, return not allowed', "Got correct screen message" ); |
| 392 |
|
| 393 |
t::lib::Mocks::mock_preference('BlockReturnOfWithdrawnItems', '0'); |
| 394 |
$circ = $ils->checkin( $item->barcode, C4::SIP::Sip::timestamp ); |
| 395 |
is( $circ->{screen_msg}, 'Item not checked out', "Got 'Item not checked out' screen message" ); |
| 396 |
}; |
| 321 |
$schema->storage->txn_rollback; |
397 |
$schema->storage->txn_rollback; |
| 322 |
- |
|
|