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