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 => 77; |
21 |
use Test::More tests => 78; |
22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
|
24 |
|
Lines 743-745
subtest 'Test limit parameter for SendQueuedMessages' => sub {
Link Here
|
743 |
is( $messages_processed, 2, |
743 |
is( $messages_processed, 2, |
744 |
'Processed 2 message with limit of 3 and 2 unprocessed messages' ); |
744 |
'Processed 2 message with limit of 3 and 2 unprocessed messages' ); |
745 |
}; |
745 |
}; |
746 |
- |
746 |
|
|
|
747 |
subtest 'PrintClaimOrderNotice' => sub { |
748 |
plan tests => 6; |
749 |
|
750 |
my $bookseller = $builder->build({ source => 'Aqbookseller' }); |
751 |
|
752 |
my $basket = $builder->build({ |
753 |
source => 'Aqbasket', |
754 |
value => { |
755 |
booksellerid => $bookseller->{id} |
756 |
} |
757 |
}); |
758 |
|
759 |
my $biblio = $builder->build({ |
760 |
source => 'Biblio', |
761 |
value => { |
762 |
title => 'Surprise' |
763 |
} |
764 |
}); |
765 |
|
766 |
my $order = $builder->build({ |
767 |
source => 'Aqorder', |
768 |
value => { |
769 |
basketno => $basket->{basketno}, |
770 |
biblionumber => $biblio->{biblionumber} |
771 |
} |
772 |
}); |
773 |
|
774 |
my $letter_code = 'ACQCLAIM'; |
775 |
my $content = 'Title: <<biblio.title>>'; |
776 |
|
777 |
$dbh->do(qq{ |
778 |
INSERT INTO letter |
779 |
(module, code, name, is_html, title, content, message_transport_type) |
780 |
VALUES |
781 |
('claimacquisition', '$letter_code', 'Claim', 1, 'Claim', '$content', 'print') |
782 |
}); |
783 |
|
784 |
my @orderids = ( $order->{ordernumber} ); |
785 |
is(C4::Letters::PrintClaimOrderNotice(), undef, 'returns undef with no args'); |
786 |
is(C4::Letters::PrintClaimOrderNotice(\@orderids), undef, 'returns undef with no letter code'); |
787 |
is(C4::Letters::PrintClaimOrderNotice(undef, $letter_code), undef, 'returns undef with no serial ids'); |
788 |
is(C4::Letters::PrintClaimOrderNotice([], $letter_code), undef, 'returns undef with no serial ids'); |
789 |
|
790 |
my $pdf = C4::Letters::PrintClaimOrderNotice(\@orderids, $letter_code); |
791 |
is(substr($pdf, 0, 4), '%PDF', 'output is a PDF'); |
792 |
|
793 |
SKIP: { |
794 |
eval { require CAM::PDF }; |
795 |
|
796 |
skip "CAM::PDF is not installed", 1 if $@; |
797 |
|
798 |
my $cam = CAM::PDF->new($pdf); |
799 |
my $text = $cam->getPageContent(1); |
800 |
like($text, qr/Title: Surprise/, 'PDF contains Title: Surprise'); |
801 |
} |
802 |
}; |