Bugzilla – Attachment 154949 Details for
Bug 30645
Generated DBIC query incorrect for API searches across joined extended attributes when several terms are passed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30645: Add tests
Bug-30645-Add-tests.patch (text/plain), 3.62 KB, created by
Jonathan Druart
on 2023-08-30 11:15:01 UTC
(
hide
)
Description:
Bug 30645: Add tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-08-30 11:15:01 UTC
Size:
3.62 KB
patch
obsolete
>From 97d7745795cc6a1a59582a38b8e0d07a133e65bf Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 28 Apr 2022 15:13:17 +0200 >Subject: [PATCH] Bug 30645: Add tests > >to highlight the problem >--- > t/db_dependent/selenium/patrons_search.t | 30 ++++++++++++++++++++---- > 1 file changed, 25 insertions(+), 5 deletions(-) > >diff --git a/t/db_dependent/selenium/patrons_search.t b/t/db_dependent/selenium/patrons_search.t >index d52e614447f..d9f67e37ca0 100755 >--- a/t/db_dependent/selenium/patrons_search.t >+++ b/t/db_dependent/selenium/patrons_search.t >@@ -60,7 +60,7 @@ my $builder = t::lib::TestBuilder->new; > my $schema = Koha::Database->schema; > > subtest 'Search patrons' => sub { >- plan tests => 26; >+ plan tests => 27; > > if ( Koha::Patrons->search({surname => {-like => "test_patron_%"}})->count ) { > BAIL_OUT("Cannot run this test, data we need to create already exist in the DB"); >@@ -141,7 +141,7 @@ subtest 'Search patrons' => sub { > description => 'my description1', > } > )->store; >- my $attribute_type_searchable = Koha::Patron::Attribute::Type->new( >+ my $attribute_type_searchable_1 = Koha::Patron::Attribute::Type->new( > { > code => 'my code2', > description => 'my description2', >@@ -149,13 +149,24 @@ subtest 'Search patrons' => sub { > staff_searchable => 1 > } > )->store; >+ my $attribute_type_searchable_2 = Koha::Patron::Attribute::Type->new( >+ { >+ code => 'my code3', >+ description => 'my description3', >+ opac_display => 1, >+ staff_searchable => 1 >+ } >+ )->store; >+ > $patrons[0]->extended_attributes([ > { code => $attribute_type->code, attribute => 'test_attr_1' }, >- { code => $attribute_type_searchable->code, attribute => 'test_attr_2'}, >+ { code => $attribute_type_searchable_1->code, attribute => 'test_attr_2'}, >+ { code => $attribute_type_searchable_2->code, attribute => 'yyy'}, > ]); > $patrons[1]->extended_attributes([ > { code => $attribute_type->code, attribute => 'test_attr_1' }, >- { code => $attribute_type_searchable->code, attribute => 'test_attr_2'}, >+ { code => $attribute_type_searchable_1->code, attribute => 'test_attr_2'}, >+ { code => $attribute_type_searchable_2->code, attribute => 'yyy'}, > ]); > > my $total_number_of_patrons = Koha::Patrons->search->count; >@@ -269,6 +280,15 @@ subtest 'Search patrons' => sub { > # clear form > $driver->find_element('//form[@id="patron_search_form"]//*[@id="clear_search"]')->click(); > >+ $s->fill_form( { search_patron_filter => 'test_attr yyy' } ); # Terms must be split >+ $s->submit_form; >+ $s->wait_for_ajax; >+ >+ is( $driver->find_element('//div[@id="'.$table_id.'_info"]')->get_text, sprintf('Showing 1 to %s of %s entries (filtered from %s total entries)', 2, 2, $total_number_of_patrons), 'Searching on a searchable attribute returns correct results' ); >+ >+ # clear form >+ $driver->find_element('//form[@id="patron_search_form"]//*[@id="clear_search"]')->click(); >+ > # Search on searchable attribute, we expect 2 patrons > $s->fill_form( { search_patron_filter => 'test_attr_2' } ); > $s->submit_form; >@@ -395,7 +415,7 @@ subtest 'Search patrons' => sub { > push @cleanup, $library; > push @cleanup, $library_2; > push @cleanup, $patron_category; >- push @cleanup, $attribute_type, $attribute_type_searchable; >+ push @cleanup, $attribute_type, $attribute_type_searchable_1, $attribute_type_searchable_2; > > $driver->quit(); > }; >-- >2.25.1
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 30645
:
134253
|
154949
|
159414
|
159450
|
159651
|
159652
|
159675
|
159676
|
160208
|
160216
|
161495
|
161528
|
164982
|
165009
|
165010
|
165011