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 52-57
use t::lib::TestBuilder;
Link Here
|
52 |
use Koha::Database; |
52 |
use Koha::Database; |
53 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
53 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
54 |
use Koha::Acquisition::Booksellers; |
54 |
use Koha::Acquisition::Booksellers; |
|
|
55 |
use Koha::Acquisition::Bookseller; |
55 |
use Koha::Acquisition::Bookseller::Contacts; |
56 |
use Koha::Acquisition::Bookseller::Contacts; |
56 |
use Koha::Acquisition::Orders; |
57 |
use Koha::Acquisition::Orders; |
57 |
use Koha::Libraries; |
58 |
use Koha::Libraries; |
Lines 970-972
subtest 'Test message_id parameter for SendQueuedMessages' => sub {
Link Here
|
970 |
is( $message_1->{status}, 'pending', 'Message 1 status is unchanged' ); # Must be 'failed' |
971 |
is( $message_1->{status}, 'pending', 'Message 1 status is unchanged' ); # Must be 'failed' |
971 |
is( $message_2->{status}, 'sent', 'Valid KohaAdminEmailAddress => status sent' ); |
972 |
is( $message_2->{status}, 'sent', 'Valid KohaAdminEmailAddress => status sent' ); |
972 |
}; |
973 |
}; |
973 |
- |
974 |
|
|
|
975 |
subtest 'PrintClaimIssueNotice' => sub { |
976 |
plan tests => 6; |
977 |
|
978 |
my $bookseller = Koha::Acquisition::Bookseller->new({ name => 'Bookie' })->store(); |
979 |
my $subscriptionid = NewSubscription(undef, "", $bookseller->id, 0, undef, |
980 |
$biblionumber, '2013-01-01', 1, undef, undef, undef, undef, undef, |
981 |
undef, undef, undef, undef, 1, undef, undef, '2013-01-01', undef, 1, |
982 |
undef, undef, 0, undef, 0, undef, undef, 0, undef, '2013-12-31', 0); |
983 |
my ($serials_count, @serials) = GetSerials($subscriptionid); |
984 |
|
985 |
my $letter = 'CLAIMSERIAL'; |
986 |
my $content = 'Date:<<subscription.firstacquidate>>'; |
987 |
$dbh->do(qq{ |
988 |
INSERT INTO letter |
989 |
(module, code, name, is_html, title, content, message_transport_type) |
990 |
VALUES |
991 |
('claimissues', '$letter', 'Claim', 1, 'Claim', '$content', 'print') |
992 |
}); |
993 |
|
994 |
my @serialids = map { $_->{serialid} } @serials; |
995 |
is(C4::Letters::PrintClaimIssueNotice(), undef, 'returns undef with no args'); |
996 |
is(C4::Letters::PrintClaimIssueNotice(\@serialids), undef, 'returns undef with no letter code'); |
997 |
is(C4::Letters::PrintClaimIssueNotice(undef, $letter), undef, 'returns undef with no serial ids'); |
998 |
is(C4::Letters::PrintClaimIssueNotice([], $letter), undef, 'returns undef with no serial ids'); |
999 |
|
1000 |
my $pdf = C4::Letters::PrintClaimIssueNotice(\@serialids, $letter); |
1001 |
is(substr($pdf, 0, 4), '%PDF', 'output is a PDF'); |
1002 |
|
1003 |
SKIP: { |
1004 |
eval { require CAM::PDF }; |
1005 |
|
1006 |
skip "CAM::PDF is not installed", 1 if $@; |
1007 |
|
1008 |
my $cam = CAM::PDF->new($pdf); |
1009 |
my $text = $cam->getPageContent(1); |
1010 |
like($text, qr/Date:2013-01-01/, 'PDF contains Date:2013-01-01'); |
1011 |
} |
1012 |
}; |