Bugzilla – Attachment 166694 Details for
Bug 36815
Add the option to 'Reset to default' in the notices editor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36815: Unit tests
Bug-36815-Unit-tests.patch (text/plain), 2.61 KB, created by
Martin Renvoize
on 2024-05-14 16:21:11 UTC
(
hide
)
Description:
Bug 36815: Unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2024-05-14 16:21:11 UTC
Size:
2.61 KB
patch
obsolete
>From 5e92b7812d83a7e48ae4400a9ac46df510a157e3 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 14 May 2024 13:50:29 +0100 >Subject: [PATCH] Bug 36815: Unit tests > >Add a pretty sparse integration test that relies on the default shipped >sample_notices.yaml. This should catch if the format of that file >changes, but it doesn't test any more than that. >--- > t/db_dependent/Koha/Notice/Template.t | 65 +++++++++++++++++++++++++++ > 1 file changed, 65 insertions(+) > create mode 100755 t/db_dependent/Koha/Notice/Template.t > >diff --git a/t/db_dependent/Koha/Notice/Template.t b/t/db_dependent/Koha/Notice/Template.t >new file mode 100755 >index 00000000000..32c11e5c62f >--- /dev/null >+++ b/t/db_dependent/Koha/Notice/Template.t >@@ -0,0 +1,65 @@ >+#!/usr/bin/perl >+ >+# Copyright 2024 Koha Development team >+# >+# This file is part of Koha >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses> >+ >+use Modern::Perl; >+ >+use Test::More tests => 2; >+ >+use_ok('Koha::Notice::Template'); >+ >+subtest 'get_default() tests' => sub { >+ plan tests => 1; >+ >+ my $module = 'circulation'; >+ my $code = 'CHECKINSLIP'; >+ my $mtt = 'print'; >+ my $lang = 'en'; >+ >+ my $template = Koha::Notice::Template->new( >+ { >+ module => $module, >+ code => $code, >+ message_transport_type => $mtt, >+ lang => $lang >+ } >+ ); >+ >+ my $sample = $template->get_default; >+ >+ # Expected content >+ my $expected_sample = '<h3>[% branch.branchname %]</h3> >+Checked in items for [% borrower.title %] [% borrower.firstname %] [% borrower.initials %] [% borrower.surname %] <br> >+([% borrower.cardnumber %]) <br> >+<br> >+[% today | $KohaDates %]<br> >+<br> >+<h4>Checked in today</h4> >+[% FOREACH checkin IN old_checkouts %] >+[% SET item = checkin.item %] >+<p> >+[% item.biblio.title %] <br> >+Barcode: [% item.barcode %] <br> >+</p> >+[% END %]'; >+ $expected_sample =~ s/\n/\r\n/g; >+ >+ is( $sample, $expected_sample, "Content retrieved correctly" ); >+}; >+ >+1; >-- >2.45.0
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 36815
:
166429
|
166430
|
166449
|
166450
|
166475
|
166476
|
166535
|
166678
|
166679
|
166680
|
166684
|
166685
|
166686
|
166689
|
166693
|
166694
|
166695
|
166696
|
166763
|
166764
|
166765
|
166766
|
168190
|
168191
|
168192
|
168193
|
168194