|
Lines 4-10
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 => 13; |
7 |
use Test::More tests => 14; |
| 8 |
|
8 |
|
| 9 |
use Koha::Database; |
9 |
use Koha::Database; |
| 10 |
use t::lib::TestBuilder; |
10 |
use t::lib::TestBuilder; |
|
Lines 377-382
subtest do_checkin => sub {
Link Here
|
| 377 |
}; |
377 |
}; |
| 378 |
}; |
378 |
}; |
| 379 |
|
379 |
|
|
|
380 |
subtest do_checkout_with_patron_blocked => sub { |
| 381 |
plan tests => 4; |
| 382 |
|
| 383 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 384 |
my $institution = { |
| 385 |
id => $library->id, |
| 386 |
implementation => "ILS", |
| 387 |
policy => { |
| 388 |
checkin => "true", |
| 389 |
renewal => "true", |
| 390 |
checkout => "true", |
| 391 |
timeout => 100, |
| 392 |
retries => 5, |
| 393 |
} |
| 394 |
}; |
| 395 |
my $ils = C4::SIP::ILS->new($institution); |
| 396 |
my $item = $builder->build_sample_item( |
| 397 |
{ |
| 398 |
library => $library->branchcode, |
| 399 |
} |
| 400 |
); |
| 401 |
|
| 402 |
my $expired_patron = $builder->build_object( |
| 403 |
{ |
| 404 |
class => 'Koha::Patrons', |
| 405 |
value => { |
| 406 |
branchcode => $library->branchcode, |
| 407 |
dateexpiry => '2020/01/01', |
| 408 |
} |
| 409 |
} |
| 410 |
); |
| 411 |
my $circ = $ils->checkout($expired_patron->cardnumber, $item->barcode); |
| 412 |
is( $circ->{screen_msg}, 'Patron expired', "Got correct expired screen message" ); |
| 413 |
|
| 414 |
my $fines_patron = $builder->build_object( |
| 415 |
{ |
| 416 |
class => 'Koha::Patrons', |
| 417 |
value => { |
| 418 |
branchcode => $library->branchcode, |
| 419 |
} |
| 420 |
} |
| 421 |
); |
| 422 |
my $fee1 = $builder->build( |
| 423 |
{ |
| 424 |
source => 'Accountline', |
| 425 |
value => { |
| 426 |
borrowernumber => $fines_patron->borrowernumber, |
| 427 |
amountoutstanding => 10, |
| 428 |
} |
| 429 |
} |
| 430 |
); |
| 431 |
|
| 432 |
my $fines_sip_patron = C4::SIP::ILS::Patron->new( $fines_patron->cardnumber ); |
| 433 |
$circ = $ils->checkout($fines_patron->cardnumber, $item->barcode); |
| 434 |
is( $circ->{screen_msg}, 'Patron has fines', "Got correct fines screen message" ); |
| 435 |
|
| 436 |
my $debarred_patron = $builder->build_object( |
| 437 |
{ |
| 438 |
class => 'Koha::Patrons', |
| 439 |
value => { |
| 440 |
branchcode => $library->branchcode, |
| 441 |
debarred => '9999/01/01', |
| 442 |
} |
| 443 |
} |
| 444 |
); |
| 445 |
my $debarred_sip_patron = C4::SIP::ILS::Patron->new( $debarred_patron->cardnumber ); |
| 446 |
$circ = $ils->checkout($debarred_patron->cardnumber, $item->barcode); |
| 447 |
is( $circ->{screen_msg}, 'Patron debarred', "Got correct debarred screen message" ); |
| 448 |
|
| 449 |
my $overdue_patron = $builder->build_object( |
| 450 |
{ |
| 451 |
class => 'Koha::Patrons', |
| 452 |
value => { |
| 453 |
branchcode => $library->branchcode, |
| 454 |
} |
| 455 |
} |
| 456 |
); |
| 457 |
|
| 458 |
my $odue = $builder->build({ source => 'Issue', value => { |
| 459 |
borrowernumber => $overdue_patron->borrowernumber, |
| 460 |
date_due => '2017-01-01', |
| 461 |
} |
| 462 |
}); |
| 463 |
t::lib::Mocks::mock_preference( 'OverduesBlockCirc', 'block' ); |
| 464 |
my $overdue_sip_patron = C4::SIP::ILS::Patron->new( $overdue_patron->cardnumber ); |
| 465 |
$circ = $ils->checkout($overdue_patron->cardnumber, $item->barcode); |
| 466 |
is( $circ->{screen_msg}, 'Patron blocked', "Got correct blocked screen message" ); |
| 467 |
|
| 468 |
}; |
| 469 |
|
| 380 |
subtest do_checkout_with_holds => sub { |
470 |
subtest do_checkout_with_holds => sub { |
| 381 |
plan tests => 7; |
471 |
plan tests => 7; |
| 382 |
|
472 |
|
| 383 |
- |
|
|