Bugzilla – Attachment 59481 Details for
Bug 17970
GetPreparedLetter does not warn when expected
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17970: Add tests to highlight the problem
Bug-17970-Add-tests-to-highlight-the-problem.patch (text/plain), 2.30 KB, created by
Mark Tompsett
on 2017-01-24 03:32:03 UTC
(
hide
)
Description:
Bug 17970: Add tests to highlight the problem
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2017-01-24 03:32:03 UTC
Size:
2.30 KB
patch
obsolete
>From 9622772478077803f29c41b319bf2a0100fec78d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sat, 21 Jan 2017 14:13:36 +0100 >Subject: [PATCH] Bug 17970: Add tests to highlight the problem > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >--- > t/db_dependent/Letters.t | 41 ++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 40 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t >index 8219e5b..cb8e6ca 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 => 79; >+use Test::More tests => 80; > use Test::MockModule; > use Test::Warn; > >@@ -47,6 +47,7 @@ use Koha::Acquisition::Order; > use Koha::Acquisition::Booksellers; > use Koha::Acquisition::Bookseller::Contacts; > use Koha::Libraries; >+use Koha::Notice::Templates; > my $schema = Koha::Database->schema; > $schema->storage->txn_begin(); > >@@ -439,6 +440,44 @@ warning_like { > is($err->{'error'}, 'no_letter', "No TESTACQORDER letter was defined."); > } > >+subtest 'GetPreparedLetter' => sub { >+ plan tests => 4; >+ >+ Koha::Notice::Template->new( >+ { >+ module => 'test', >+ code => 'test', >+ branchcode => '', >+ message_transport_type => 'email' >+ } >+ )->store; >+ my $letter; >+ warning_like { >+ $letter = C4::Letters::GetPreparedLetter( >+ module => 'test', >+ letter_code => 'test', >+ ); >+ } >+ qr{^ERROR: nothing to substitute}, >+'GetPreparedLetter should warn if tables, substiture and repeat are not set'; >+ is( $letter, undef, >+'No letter should be returned by GetPreparedLetter if something went wrong' >+ ); >+ >+ warning_like { >+ $letter = C4::Letters::GetPreparedLetter( >+ module => 'test', >+ letter_code => 'test', >+ substitute => {} >+ ); >+ } >+ qr{^ERROR: nothing to substitute}, >+'GetPreparedLetter should warn if tables, substiture and repeat are not set, even if the key is passed'; >+ is( $letter, undef, >+'No letter should be returned by GetPreparedLetter if something went wrong' >+ ); >+ >+}; > > { > warning_is { >-- >2.1.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 17970
:
59422
|
59423
|
59424
|
59425
|
59481
|
59482
|
60976
|
60977