|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 70; |
20 |
use Test::More tests => 68; |
| 21 |
use Test::NoWarnings; |
21 |
use Test::NoWarnings; |
| 22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
| 23 |
use Test::Warn; |
23 |
use Test::Warn; |
|
Lines 425-440
is(
Link Here
|
| 425 |
|
425 |
|
| 426 |
# End of tests for bug 9761 (ConfirmFutureHolds) |
426 |
# End of tests for bug 9761 (ConfirmFutureHolds) |
| 427 |
|
427 |
|
| 428 |
# test marking a hold as captured |
|
|
| 429 |
my $hold_notice_count = count_hold_print_messages(); |
| 430 |
ModReserveAffect( $item->itemnumber, $requesters{$branch_1}->borrowernumber, 0 ); |
428 |
ModReserveAffect( $item->itemnumber, $requesters{$branch_1}->borrowernumber, 0 ); |
| 431 |
my $new_count = count_hold_print_messages(); |
|
|
| 432 |
is( $new_count, $hold_notice_count + 1, 'patron notified when item set to waiting' ); |
| 433 |
|
| 434 |
# test that duplicate notices aren't generated |
| 435 |
ModReserveAffect( $item->itemnumber, $requesters{$branch_1}->borrowernumber, 0 ); |
| 436 |
$new_count = count_hold_print_messages(); |
| 437 |
is( $new_count, $hold_notice_count + 1, 'patron not notified a second time (bug 11445)' ); |
| 438 |
|
429 |
|
| 439 |
# avoiding the not_same_branch error |
430 |
# avoiding the not_same_branch error |
| 440 |
t::lib::Mocks::mock_preference( 'IndependentBranches', 0 ); |
431 |
t::lib::Mocks::mock_preference( 'IndependentBranches', 0 ); |
|
Lines 791-797
$cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode");
Link Here
|
| 791 |
|
782 |
|
| 792 |
subtest '_koha_notify_reserve() tests' => sub { |
783 |
subtest '_koha_notify_reserve() tests' => sub { |
| 793 |
|
784 |
|
| 794 |
plan tests => 4; |
785 |
plan tests => 6; |
| 795 |
|
786 |
|
| 796 |
my $branch = $builder->build_object( |
787 |
my $branch = $builder->build_object( |
| 797 |
{ |
788 |
{ |
|
Lines 809-814
subtest '_koha_notify_reserve() tests' => sub {
Link Here
|
| 809 |
holdingbranch => $branch->branchcode |
800 |
holdingbranch => $branch->branchcode |
| 810 |
} |
801 |
} |
| 811 |
); |
802 |
); |
|
|
803 |
my $item2 = $builder->build_sample_item( |
| 804 |
{ |
| 805 |
homebranch => $branch->branchcode, |
| 806 |
holdingbranch => $branch->branchcode |
| 807 |
} |
| 808 |
); |
| 812 |
|
809 |
|
| 813 |
my $wants_hold_and_email = { |
810 |
my $wants_hold_and_email = { |
| 814 |
wants_digest => '0', |
811 |
wants_digest => '0', |
|
Lines 851-856
subtest '_koha_notify_reserve() tests' => sub {
Link Here
|
| 851 |
} |
848 |
} |
| 852 |
); |
849 |
); |
| 853 |
|
850 |
|
|
|
851 |
my $print_hold_notice = $builder->build( |
| 852 |
{ |
| 853 |
source => 'Letter', |
| 854 |
value => { |
| 855 |
message_transport_type => 'print', |
| 856 |
branchcode => '', |
| 857 |
code => 'HOLD', |
| 858 |
module => 'reserves', |
| 859 |
lang => 'default', |
| 860 |
} |
| 861 |
} |
| 862 |
); |
| 863 |
|
| 854 |
my $hold_borrower = $builder->build( |
864 |
my $hold_borrower = $builder->build( |
| 855 |
{ |
865 |
{ |
| 856 |
source => 'Borrower', |
866 |
source => 'Borrower', |
|
Lines 868-873
subtest '_koha_notify_reserve() tests' => sub {
Link Here
|
| 868 |
biblionumber => $item->biblionumber, |
878 |
biblionumber => $item->biblionumber, |
| 869 |
} |
879 |
} |
| 870 |
); |
880 |
); |
|
|
881 |
C4::Reserves::AddReserve( |
| 882 |
{ |
| 883 |
branchcode => $item->homebranch, |
| 884 |
borrowernumber => $hold_borrower, |
| 885 |
biblionumber => $item2->biblionumber, |
| 886 |
} |
| 887 |
); |
| 871 |
|
888 |
|
| 872 |
ModReserveAffect( $item->itemnumber, $hold_borrower, 0 ); |
889 |
ModReserveAffect( $item->itemnumber, $hold_borrower, 0 ); |
| 873 |
my $sms_message_address = $schema->resultset('MessageQueue')->search( |
890 |
my $sms_message_address = $schema->resultset('MessageQueue')->search( |
|
Lines 896-901
subtest '_koha_notify_reserve() tests' => sub {
Link Here
|
| 896 |
my $email_reply_address = $email->reply_address(); |
913 |
my $email_reply_address = $email->reply_address(); |
| 897 |
is( $email_reply_address, 'branch@reply.to', "Library's reply address is used for reply" ); |
914 |
is( $email_reply_address, 'branch@reply.to', "Library's reply address is used for reply" ); |
| 898 |
|
915 |
|
|
|
916 |
$wants_hold_and_email = { |
| 917 |
wants_digest => '0', |
| 918 |
transports => {}, |
| 919 |
letter_code => 'HOLD' |
| 920 |
}; |
| 921 |
$mp = Test::MockModule->new('C4::Members::Messaging'); |
| 922 |
$mp->mock( "GetMessagingPreferences", $wants_hold_and_email ); |
| 923 |
|
| 924 |
my $hold_notice_count = count_hold_print_messages(); |
| 925 |
ModReserveAffect( $item2->itemnumber, $hold_borrower ); |
| 926 |
my $new_count = count_hold_print_messages(); |
| 927 |
is( $new_count, $hold_notice_count, 'patron not notified if no messaging preference is specified' ); |
| 928 |
|
| 929 |
$hold_notice_count = count_hold_print_messages(); |
| 930 |
ModReserveAffect( $item2->itemnumber, $hold_borrower, 0 ); |
| 931 |
$new_count = count_hold_print_messages(); |
| 932 |
is( $new_count, $hold_notice_count, 'patron not notified a second time (bug 11445)' ); |
| 899 |
}; |
933 |
}; |
| 900 |
|
934 |
|
| 901 |
subtest 'ReservesNeedReturns' => sub { |
935 |
subtest 'ReservesNeedReturns' => sub { |
| 902 |
- |
|
|