Bugzilla – Attachment 125824 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.58 KB, created by
Alex Arnaud
on 2021-10-06 14:48:15 UTC
(
hide
)
Description:
Bug 20119 - Add unit tests
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2021-10-06 14:48:15 UTC
Size:
3.58 KB
patch
obsolete
>From 5c6542790999499356a23e51f297883cca71c93d 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 >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >[2018-03-15] Rebased-by: Alex Arnaud <alex.arnaud@biblibre.com> > >Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> >--- > C4/Letters.pm | 1 + > cpanfile | 1 + > t/db_dependent/Letters.t | 59 +++++++++++++++++++++++++++++++++++++++++++++++- > 3 files changed, 60 insertions(+), 1 deletion(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index bb6c98d..3a8e1a0 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -25,6 +25,7 @@ use Template; > use Module::Load::Conditional qw( can_load ); > > use Try::Tiny qw( catch try ); >+use PDF::FromHTML; > > use C4::Members; > use C4::Log qw( logaction ); >diff --git a/cpanfile b/cpanfile >index fe14b40..86ea6b5 100644 >--- a/cpanfile >+++ b/cpanfile >@@ -176,3 +176,4 @@ recommends 'Time::Fake', '0.11'; > recommends 'UNIVERSAL::require', '0.13'; > recommends 'WebService::ILS', '0.17'; > recommends 'XML::Writer', '0.614'; >+recommends 'CAM::PDF', '1.60'; >diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t >index 9a37118..db7b33e 100755 >--- 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 => 83; >+use Test::More tests => 84; > use Test::MockModule; > use Test::Warn; > use Test::Exception; >@@ -968,3 +968,60 @@ subtest 'Test message_id parameter for SendQueuedMessages' => sub { > is( $message_1->{status}, 'failed', 'Message 1 status is unchanged' ); > is( $message_2->{status}, 'sent', 'Valid from_address => status sent' ); > }; >+ >+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