|
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 => 82; |
21 |
use Test::More tests => 83; |
| 22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
| 23 |
use Test::Warn; |
23 |
use Test::Warn; |
| 24 |
|
24 |
|
|
Lines 45-50
use Koha::Database;
Link Here
|
| 45 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
45 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
| 46 |
use Koha::Acquisition::Order; |
46 |
use Koha::Acquisition::Order; |
| 47 |
use Koha::Acquisition::Booksellers; |
47 |
use Koha::Acquisition::Booksellers; |
|
|
48 |
use Koha::Acquisition::Bookseller; |
| 48 |
use Koha::Acquisition::Bookseller::Contacts; |
49 |
use Koha::Acquisition::Bookseller::Contacts; |
| 49 |
use Koha::Libraries; |
50 |
use Koha::Libraries; |
| 50 |
use Koha::Notice::Templates; |
51 |
use Koha::Notice::Templates; |
|
Lines 628-630
subtest 'SendQueuedMessages' => sub {
Link Here
|
| 628 |
is( $sms_message_address, '5555555555@kidclamp.rocks', 'SendQueuedMessages populates the to address correctly for SMS by email' ); |
629 |
is( $sms_message_address, '5555555555@kidclamp.rocks', 'SendQueuedMessages populates the to address correctly for SMS by email' ); |
| 629 |
|
630 |
|
| 630 |
}; |
631 |
}; |
| 631 |
- |
632 |
|
|
|
633 |
subtest 'PrintClaimIssueNotice' => sub { |
| 634 |
plan tests => 6; |
| 635 |
|
| 636 |
my $bookseller = Koha::Acquisition::Bookseller->new()->store(); |
| 637 |
my $subscriptionid = NewSubscription(undef, "", $bookseller->id, 0, undef, |
| 638 |
$biblionumber, '2013-01-01', 1, undef, undef, undef, undef, undef, |
| 639 |
undef, undef, undef, undef, 1, undef, undef, '2013-01-01', undef, 1, |
| 640 |
undef, undef, 0, undef, 0, undef, undef, 0, undef, '2013-12-31', 0); |
| 641 |
my ($serials_count, @serials) = GetSerials($subscriptionid); |
| 642 |
|
| 643 |
my $letter = 'CLAIMSERIAL'; |
| 644 |
my $content = 'Date:<<subscription.firstacquidate>>'; |
| 645 |
$dbh->do(qq{ |
| 646 |
INSERT INTO letter |
| 647 |
(module, code, name, is_html, title, content, message_transport_type) |
| 648 |
VALUES |
| 649 |
('claimissues', '$letter', 'Claim', 1, 'Claim', '$content', 'print') |
| 650 |
}); |
| 651 |
|
| 652 |
my @serialids = map { $_->{serialid} } @serials; |
| 653 |
is(C4::Letters::PrintClaimIssueNotice(), undef, 'returns undef with no args'); |
| 654 |
is(C4::Letters::PrintClaimIssueNotice(\@serialids), undef, 'returns undef with no letter code'); |
| 655 |
is(C4::Letters::PrintClaimIssueNotice(undef, $letter), undef, 'returns undef with no serial ids'); |
| 656 |
is(C4::Letters::PrintClaimIssueNotice([], $letter), undef, 'returns undef with no serial ids'); |
| 657 |
|
| 658 |
my $pdf = C4::Letters::PrintClaimIssueNotice(\@serialids, $letter); |
| 659 |
is(substr($pdf, 0, 4), '%PDF', 'output is a PDF'); |
| 660 |
|
| 661 |
SKIP: { |
| 662 |
eval { require CAM::PDF }; |
| 663 |
|
| 664 |
skip "CAM::PDF is not installed", 1 if $@; |
| 665 |
|
| 666 |
my $cam = CAM::PDF->new($pdf); |
| 667 |
my $text = $cam->getPageContent(1); |
| 668 |
like($text, qr/Date:2013-01-01/, 'PDF contains Date:2013-01-01'); |
| 669 |
} |
| 670 |
}; |