Bugzilla – Attachment 183131 Details for
Bug 39427
Searching lists table by owner can only enter firstname or surname
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39427: Unit tests
Bug-39427-Unit-tests.patch (text/plain), 3.94 KB, created by
Laura Escamilla
on 2025-06-10 13:21:00 UTC
(
hide
)
Description:
Bug 39427: Unit tests
Filename:
MIME Type:
Creator:
Laura Escamilla
Created:
2025-06-10 13:21:00 UTC
Size:
3.94 KB
patch
obsolete
>From 98422a49908230ac81d33451550f814e17523c36 Mon Sep 17 00:00:00 2001 >From: Laura_Escamilla <laura.escamilla@bywatersolutions.com> >Date: Mon, 9 Jun 2025 13:29:35 +0000 >Subject: [PATCH] Bug 39427: Unit tests >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >To test: >1. Ensure that the virtual shelves system preference is enabled >2. Create one or two lists using a patron that has both a first and last name. You donât have to add items to the list, the list itself is enough. >3. Under the Owner column in the Lists table, search using the patronâs first name. Note that the name is properly filtered. >4. Next, try to search by the last name. It is also properly filtered. >5. Now search using both the first name and the last name together. Note that the results come up empty. >6. Apply the patch. >7. Repeat steps 3â5. Note that the patron shows in the results with just the first name, the last name, and the full name.â¨7.1. Additionally, try searching with extra spaces (e.g., ' Firstname Surname ' or 'Firstname Surname'). Confirm that results are still correctly shown. >8. Run t/db_dependent/Virtualshelves.t >9. Sign off and have a great day! :D >--- > t/db_dependent/Virtualshelves.t | 29 ++++++++++++++++++++++++++++- > 1 file changed, 28 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Virtualshelves.t b/t/db_dependent/Virtualshelves.t >index 0d37775c37..95eae94fe8 100755 >--- a/t/db_dependent/Virtualshelves.t >+++ b/t/db_dependent/Virtualshelves.t >@@ -130,7 +130,7 @@ subtest 'CRUD' => sub { > }; > > subtest 'Owner filter logic' => sub { >- plan tests => 6; >+ plan tests => 16; > > my ( @where_strs, @args ); > >@@ -138,7 +138,13 @@ subtest 'Owner filter logic' => sub { > my ($owner) = @_; > @where_strs = (); > @args = (); >+ > if ( defined $owner and $owner ne '' ) { >+ $owner =~ s/^\s+|\s+$//g; # Trim leading/trailing spaces >+ $owner =~ s/\s+/ /g; # Normalize internal whitespace >+ >+ return ( [], [] ) if $owner eq ''; >+ > my @name_parts = split ' ', $owner; > > if ( @name_parts == 2 ) { >@@ -149,6 +155,7 @@ subtest 'Owner filter logic' => sub { > push @args, "%$owner%", "%$owner%"; > } > } >+ > return ( \@where_strs, \@args ); > }; > >@@ -165,6 +172,26 @@ subtest 'Owner filter logic' => sub { > ( $where, $args ) = $test_logic->('John Smith'); > is_deeply( $where, ['( bo.firstname LIKE ? AND bo.surname LIKE ? )'], 'AND clause for two name parts' ); > is_deeply( $args, [ '%John%', '%Smith%' ], 'Args match both names' ); >+ >+ ( $where, $args ) = $test_logic->(' John Smith '); >+ is_deeply( $where, ['( bo.firstname LIKE ? AND bo.surname LIKE ? )'], 'Trimmed whitespace around two name parts' ); >+ is_deeply( $args, [ '%John%', '%Smith%' ], 'Args match trimmed names' ); >+ >+ ( $where, $args ) = $test_logic->('John Smith'); >+ is_deeply( $where, ['( bo.firstname LIKE ? AND bo.surname LIKE ? )'], 'Normalized internal whitespace' ); >+ is_deeply( $args, [ '%John%', '%Smith%' ], 'Args match normalized names' ); >+ >+ ( $where, $args ) = $test_logic->('John '); >+ is_deeply( $where, ['(bo.firstname LIKE ? OR bo.surname LIKE ?)'], 'Single name with trailing space' ); >+ is_deeply( $args, [ '%John%', '%John%' ], 'Args match single name trimmed' ); >+ >+ ( $where, $args ) = $test_logic->(' '); >+ is_deeply( $where, [], 'No where clause when owner is only whitespace' ); >+ is_deeply( $args, [], 'No args when owner is only whitespace' ); >+ >+ ( $where, $args ) = $test_logic->(' John '); >+ is_deeply( $where, ['(bo.firstname LIKE ? OR bo.surname LIKE ?)'], 'Single name with leading/trailing spaces' ); >+ is_deeply( $args, [ '%John%', '%John%' ], 'Args match cleaned single name' ); > }; > > subtest 'Sharing' => sub { >-- >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 39427
:
182674
|
182675
|
183097
|
183130
|
183131
|
183455
|
183456
|
183465
|
183466