Bugzilla – Attachment 182672 Details for
Bug 39944
Metadata should be trimmed before creating an ILL request
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39944: Add tests
Bug-39944-Add-tests.patch (text/plain), 1.70 KB, created by
Pedro Amorim
on 2025-05-20 13:06:50 UTC
(
hide
)
Description:
Bug 39944: Add tests
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2025-05-20 13:06:50 UTC
Size:
1.70 KB
patch
obsolete
>From 457b24f5a826d3432a852a479dd7f64c9daa1288 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Tue, 20 May 2025 12:37:23 +0000 >Subject: [PATCH] Bug 39944: Add tests > >prove t/db_dependent/Koha/ILL/Request.t >--- > t/db_dependent/Koha/ILL/Request.t | 42 ++++++++++++++++++++++++++++++- > 1 file changed, 41 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/ILL/Request.t b/t/db_dependent/Koha/ILL/Request.t >index bc0b2fb9647..b7956b0686a 100755 >--- a/t/db_dependent/Koha/ILL/Request.t >+++ b/t/db_dependent/Koha/ILL/Request.t >@@ -20,7 +20,7 @@ > use Modern::Perl; > > use Test::NoWarnings; >-use Test::More tests => 6; >+use Test::More tests => 7; > use Test::MockModule; > > use Koha::ILL::Requests; >@@ -197,3 +197,43 @@ subtest 'get_backend_plugin() tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'trim_form_params() tests' => sub { >+ >+ plan tests => 4; >+ >+ $schema->storage->txn_begin; >+ >+ my $request = $builder->build_sample_ill_request(); >+ >+ my $params = { >+ 'pubmedid' => '', >+ 'doi' => ' abc', >+ 'type' => 'article', >+ 'backend' => 'Standard', >+ }; >+ >+ my $trimmed_params = $request->trim_form_params($params); >+ >+ is( >+ $trimmed_params->{doi}, 'abc', >+ 'param with leading white space is correctly trimmed' >+ ); >+ >+ is( >+ $trimmed_params->{pubmedid}, '', >+ 'empty param remains empty' >+ ); >+ >+ is( >+ $trimmed_params->{nonexistent}, undef, >+ 'undef param remains undef' >+ ); >+ >+ is( >+ $trimmed_params->{type}, $trimmed_params->{type}, >+ 'already trimmed param remains unchanged' >+ ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.39.5
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 39944
:
182668
|
182669
| 182672 |
182673