|
Lines 18-24
Link Here
|
| 18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
use Test::More tests => 83; |
21 |
use Test::More tests => 84; |
| 22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
| 23 |
use Test::Warn; |
23 |
use Test::Warn; |
| 24 |
use Test::Exception; |
24 |
use Test::Exception; |
|
Lines 968-970
subtest 'Test message_id parameter for SendQueuedMessages' => sub {
Link Here
|
| 968 |
is( $message_1->{status}, 'failed', 'Message 1 status is unchanged' ); |
968 |
is( $message_1->{status}, 'failed', 'Message 1 status is unchanged' ); |
| 969 |
is( $message_2->{status}, 'sent', 'Valid from_address => status sent' ); |
969 |
is( $message_2->{status}, 'sent', 'Valid from_address => status sent' ); |
| 970 |
}; |
970 |
}; |
| 971 |
- |
971 |
|
|
|
972 |
subtest 'PrintClaimOrderNotice' => sub { |
| 973 |
plan tests => 6; |
| 974 |
|
| 975 |
my $bookseller = $builder->build({ source => 'Aqbookseller' }); |
| 976 |
|
| 977 |
my $basket = $builder->build({ |
| 978 |
source => 'Aqbasket', |
| 979 |
value => { |
| 980 |
booksellerid => $bookseller->{id} |
| 981 |
} |
| 982 |
}); |
| 983 |
|
| 984 |
my $biblio = $builder->build({ |
| 985 |
source => 'Biblio', |
| 986 |
value => { |
| 987 |
title => 'Surprise' |
| 988 |
} |
| 989 |
}); |
| 990 |
|
| 991 |
my $order = $builder->build({ |
| 992 |
source => 'Aqorder', |
| 993 |
value => { |
| 994 |
basketno => $basket->{basketno}, |
| 995 |
biblionumber => $biblio->{biblionumber} |
| 996 |
} |
| 997 |
}); |
| 998 |
|
| 999 |
my $letter_code = 'ACQCLAIM'; |
| 1000 |
my $content = 'Title: <<biblio.title>>'; |
| 1001 |
|
| 1002 |
$dbh->do(qq{ |
| 1003 |
INSERT INTO letter |
| 1004 |
(module, code, name, is_html, title, content, message_transport_type) |
| 1005 |
VALUES |
| 1006 |
('claimacquisition', '$letter_code', 'Claim', 1, 'Claim', '$content', 'print') |
| 1007 |
}); |
| 1008 |
|
| 1009 |
my @orderids = ( $order->{ordernumber} ); |
| 1010 |
is(C4::Letters::PrintClaimOrderNotice(), undef, 'returns undef with no args'); |
| 1011 |
is(C4::Letters::PrintClaimOrderNotice(\@orderids), undef, 'returns undef with no letter code'); |
| 1012 |
is(C4::Letters::PrintClaimOrderNotice(undef, $letter_code), undef, 'returns undef with no serial ids'); |
| 1013 |
is(C4::Letters::PrintClaimOrderNotice([], $letter_code), undef, 'returns undef with no serial ids'); |
| 1014 |
|
| 1015 |
my $pdf = C4::Letters::PrintClaimOrderNotice(\@orderids, $letter_code); |
| 1016 |
is(substr($pdf, 0, 4), '%PDF', 'output is a PDF'); |
| 1017 |
|
| 1018 |
SKIP: { |
| 1019 |
eval { require CAM::PDF }; |
| 1020 |
|
| 1021 |
skip "CAM::PDF is not installed", 1 if $@; |
| 1022 |
|
| 1023 |
my $cam = CAM::PDF->new($pdf); |
| 1024 |
my $text = $cam->getPageContent(1); |
| 1025 |
like($text, qr/Title: Surprise/, 'PDF contains Title: Surprise'); |
| 1026 |
} |
| 1027 |
}; |