Bugzilla – Attachment 193532 Details for
Bug 41818
SIP2 message in AF field should be stripped of newlines and carriage returns
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41818: Add unit tests
2e158b8.patch (text/plain), 1.86 KB, created by
Kyle M Hall (khall)
on 2026-02-20 12:18:56 UTC
(
hide
)
Description:
Bug 41818: Add unit tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2026-02-20 12:18:56 UTC
Size:
1.86 KB
patch
obsolete
>From 2e158b836cd0daf23c7b510ca70199206e1c7c8e Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 20 Feb 2026 07:11:54 -0500 >Subject: [PATCH] Bug 41818: Add unit tests > >--- > t/db_dependent/Koha/Patron/Messages.t | 28 ++++++++++++++++++++++++++- > 1 file changed, 27 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Patron/Messages.t b/t/db_dependent/Koha/Patron/Messages.t >index b8a948dc273..6002691404b 100755 >--- a/t/db_dependent/Koha/Patron/Messages.t >+++ b/t/db_dependent/Koha/Patron/Messages.t >@@ -20,7 +20,7 @@ > use Modern::Perl; > > use Test::NoWarnings; >-use Test::More tests => 15; >+use Test::More tests => 16; > > use C4::Context; > use Koha::ActionLogs; >@@ -140,6 +140,32 @@ is( > "One message has been marked as read" > ); > >+subtest 'message_without_newlines' => sub { >+ plan tests => 6; >+ >+ my $message = Koha::Patron::Message->new( { message => " Line 1\nLine 2\r\nLine 3 \n " } ); >+ >+ is( >+ $message->message_without_newlines, 'Line 1 Line 2 Line 3', >+ 'Newlines and carriage returns removed, collapsed and trimmed' >+ ); >+ >+ $message->message("Multiple spaces stay collapsed"); >+ is( $message->message_without_newlines, 'Multiple spaces stay collapsed', 'Multiple spaces collapsed' ); >+ >+ $message->message("\n\nOnly\nNewlines\n\n"); >+ is( $message->message_without_newlines, 'Only Newlines', 'Only newlines handled correctly' ); >+ >+ $message->message("Already clean"); >+ is( $message->message_without_newlines, 'Already clean', 'Clean string returns as is' ); >+ >+ $message->message(q{}); >+ is( $message->message_without_newlines, undef, 'Empty string returns undef' ); >+ >+ $message->message(undef); >+ is( $message->message_without_newlines, undef, 'Undef message returns undef' ); >+}; >+ > $schema->storage->txn_rollback; > > sub get_nb_of_logactions { >-- >2.50.1 (Apple Git-155) >
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 41818
:
192982
|
193285
|
193530
| 193532