|
Lines 18-24
Link Here
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
use utf8; |
19 |
use utf8; |
| 20 |
|
20 |
|
| 21 |
use Test::More tests => 63; |
21 |
use Test::More tests => 67; |
| 22 |
use Test::Exception; |
22 |
use Test::Exception; |
| 23 |
use Test::MockModule; |
23 |
use Test::MockModule; |
| 24 |
use Test::Deep qw( cmp_deeply ); |
24 |
use Test::Deep qw( cmp_deeply ); |
|
Lines 5693-5698
subtest "GetSoonestRenewDate tests" => sub {
Link Here
|
| 5693 |
); |
5693 |
); |
| 5694 |
}; |
5694 |
}; |
| 5695 |
|
5695 |
|
|
|
5696 |
subtest "CanBookBeIssued + needsconfirmation message" => sub { |
| 5697 |
plan tests => 4; |
| 5698 |
|
| 5699 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
| 5700 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
| 5701 |
my $biblio = $builder->build_object({ class => 'Koha::Biblios' }); |
| 5702 |
my $biblioitem = $builder->build_object({ class => 'Koha::Biblioitems', value => { biblionumber => $biblio->biblionumber }}); |
| 5703 |
my $item = $builder->build_object({ class => 'Koha::Items' , value => { biblionumber => $biblio->biblionumber }}); |
| 5704 |
|
| 5705 |
my $hold = $builder->build_object({ class => 'Koha::Holds', value => { |
| 5706 |
biblionumber => $item->biblionumber, |
| 5707 |
branchcode => $library->branchcode, |
| 5708 |
itemnumber => undef, |
| 5709 |
itemtype => undef, |
| 5710 |
priority => 1, |
| 5711 |
found => undef, |
| 5712 |
suspend => 0, |
| 5713 |
item_group_id => $item->item_group |
| 5714 |
}}); |
| 5715 |
|
| 5716 |
my ( $error, $needsconfirmation, $alerts, $messages ); |
| 5717 |
|
| 5718 |
( $error, $needsconfirmation, $alerts, $messages ) = CanBookBeIssued( $patron, $item->barcode ); |
| 5719 |
is($needsconfirmation->{resbranchcode}, $hold->branchcode, "Branchcodes match when hold exists."); |
| 5720 |
|
| 5721 |
$hold->priority(0)->store(); |
| 5722 |
|
| 5723 |
$hold->found("W")->store(); |
| 5724 |
( $error, $needsconfirmation, $alerts, $messages ) = CanBookBeIssued( $patron, $item->barcode ); |
| 5725 |
is($needsconfirmation->{resbranchcode}, $hold->branchcode, "Branchcodes match when hold is waiting."); |
| 5726 |
|
| 5727 |
$hold->found("T")->store(); |
| 5728 |
( $error, $needsconfirmation, $alerts, $messages ) = CanBookBeIssued( $patron, $item->barcode ); |
| 5729 |
is($needsconfirmation->{resbranchcode}, $hold->branchcode, "Branchcodes match when hold is being transferred."); |
| 5730 |
|
| 5731 |
$hold->found("P")->store(); |
| 5732 |
( $error, $needsconfirmation, $alerts, $messages ) = CanBookBeIssued( $patron, $item->barcode ); |
| 5733 |
is($needsconfirmation->{resbranchcode}, $hold->branchcode, "Branchcodes match when hold is being processed."); |
| 5734 |
}; |
| 5735 |
|
| 5696 |
$schema->storage->txn_rollback; |
5736 |
$schema->storage->txn_rollback; |
| 5697 |
C4::Context->clear_syspref_cache(); |
5737 |
C4::Context->clear_syspref_cache(); |
| 5698 |
$branches = Koha::Libraries->search(); |
5738 |
$branches = Koha::Libraries->search(); |
| 5699 |
- |
|
|