Bugzilla – Attachment 71151 Details for
Bug 20119
Ability to print claims for late orders
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20119 - Add unit tests
Bug-20119---Add-unit-tests.patch (text/plain), 3.46 KB, created by
Alex Arnaud
on 2018-02-02 14:13:53 UTC
(
hide
)
Description:
Bug 20119 - Add unit tests
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2018-02-02 14:13:53 UTC
Size:
3.46 KB
patch
obsolete
>From 36ca93791099ea9f55ee4a0eb8af02e824fe5129 Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >Date: Fri, 2 Feb 2018 13:54:18 +0000 >Subject: [PATCH] Bug 20119 - Add unit tests > >--- > C4/Installer/PerlDependencies.pm | 5 ++++ > C4/Letters.pm | 1 + > t/db_dependent/Letters.t | 59 +++++++++++++++++++++++++++++++++++++++- > 3 files changed, 64 insertions(+), 1 deletion(-) > >diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm >index 84ba74d..6c5d7db 100644 >--- a/C4/Installer/PerlDependencies.pm >+++ b/C4/Installer/PerlDependencies.pm >@@ -867,6 +867,11 @@ our $PERL_DEPS = { > 'required' => '0', > 'min_ver' => '0.17', > }, >+ 'CAM::PDF' => { >+ 'usage' => 'Tests', >+ 'required' => 0, >+ 'min_ver' => '1.60', >+ }, > }; > > 1; >diff --git a/C4/Letters.pm b/C4/Letters.pm >index efa74ac..a54760a 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -26,6 +26,7 @@ use Encode; > use Carp; > use Template; > use Module::Load::Conditional qw(can_load); >+use PDF::FromHTML; > > use C4::Members; > use C4::Members::Attributes qw(GetBorrowerAttributes); >diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t >index e20cefb..ead9409 100644 >--- a/t/db_dependent/Letters.t >+++ b/t/db_dependent/Letters.t >@@ -18,7 +18,7 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 77; >+use Test::More tests => 78; > use Test::MockModule; > use Test::Warn; > >@@ -743,3 +743,60 @@ subtest 'Test limit parameter for SendQueuedMessages' => sub { > is( $messages_processed, 2, > 'Processed 2 message with limit of 3 and 2 unprocessed messages' ); > }; >+ >+subtest 'PrintClaimOrderNotice' => sub { >+ plan tests => 6; >+ >+ my $bookseller = $builder->build({ source => 'Aqbookseller' }); >+ >+ my $basket = $builder->build({ >+ source => 'Aqbasket', >+ value => { >+ booksellerid => $bookseller->{id} >+ } >+ }); >+ >+ my $biblio = $builder->build({ >+ source => 'Biblio', >+ value => { >+ title => 'Surprise' >+ } >+ }); >+ >+ my $order = $builder->build({ >+ source => 'Aqorder', >+ value => { >+ basketno => $basket->{basketno}, >+ biblionumber => $biblio->{biblionumber} >+ } >+ }); >+ >+ my $letter_code = 'ACQCLAIM'; >+ my $content = 'Title: <<biblio.title>>'; >+ >+ $dbh->do(qq{ >+ INSERT INTO letter >+ (module, code, name, is_html, title, content, message_transport_type) >+ VALUES >+ ('claimacquisition', '$letter_code', 'Claim', 1, 'Claim', '$content', 'print') >+ }); >+ >+ my @orderids = ( $order->{ordernumber} ); >+ is(C4::Letters::PrintClaimOrderNotice(), undef, 'returns undef with no args'); >+ is(C4::Letters::PrintClaimOrderNotice(\@orderids), undef, 'returns undef with no letter code'); >+ is(C4::Letters::PrintClaimOrderNotice(undef, $letter_code), undef, 'returns undef with no serial ids'); >+ is(C4::Letters::PrintClaimOrderNotice([], $letter_code), undef, 'returns undef with no serial ids'); >+ >+ my $pdf = C4::Letters::PrintClaimOrderNotice(\@orderids, $letter_code); >+ is(substr($pdf, 0, 4), '%PDF', 'output is a PDF'); >+ >+ SKIP: { >+ eval { require CAM::PDF }; >+ >+ skip "CAM::PDF is not installed", 1 if $@; >+ >+ my $cam = CAM::PDF->new($pdf); >+ my $text = $cam->getPageContent(1); >+ like($text, qr/Title: Surprise/, 'PDF contains Title: Surprise'); >+ } >+}; >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20119
:
71106
|
71107
|
71150
|
71151
|
72928
|
72929
|
72944
|
72945
|
125823
|
125824
|
125825