Bugzilla – Attachment 160216 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 REST/Plugin/Query tests
Bug-30645-Add-RESTPluginQuery-tests.patch (text/plain), 3.88 KB, created by
David Nind
on 2023-12-21 20:18:13 UTC
(
hide
)
Description:
Bug 30645: Add REST/Plugin/Query tests
Filename:
MIME Type:
Creator:
David Nind
Created:
2023-12-21 20:18:13 UTC
Size:
3.88 KB
patch
obsolete
>From 5c710332de6db1e3471d857418b10654e327209f Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Thu, 21 Dec 2023 16:06:41 +0000 >Subject: [PATCH] Bug 30645: Add REST/Plugin/Query tests > >prove t/Koha/REST/Plugin/Query.t > >Signed-off-by: David Nind <david@davidnind.com> >--- > t/Koha/REST/Plugin/Query.t | 93 +++++++++++++++++++++++++++++++++++++- > 1 file changed, 92 insertions(+), 1 deletion(-) > >diff --git a/t/Koha/REST/Plugin/Query.t b/t/Koha/REST/Plugin/Query.t >index 4087feaba1..2f816f4f14 100755 >--- a/t/Koha/REST/Plugin/Query.t >+++ b/t/Koha/REST/Plugin/Query.t >@@ -285,6 +285,49 @@ get '/stash_overrides' => sub { > ); > }; > >+get '/dbic_extended_attributes_join' => sub { >+ my ( $c, $args ) = @_; >+ >+ my $filtered_params = [ >+ { >+ '-and' => [ >+ [ >+ { >+ 'extended_attributes.attribute' => { 'like' => 'abc%' }, >+ 'extended_attributes.code' => [ >+ [ >+ 'test1', >+ 'test2' >+ ] >+ ] >+ } >+ ], >+ [ >+ { >+ 'extended_attributes.code' => [ >+ [ >+ 'test1', >+ 'test2' >+ ] >+ ], >+ 'extended_attributes.attribute' => { 'like' => '123%' } >+ } >+ ] >+ ] >+ } >+ ]; >+ my $attributes = { 'prefetch' => ['extended_attributes'] }; >+ >+ $c->dbic_extended_attributes_join( >+ { >+ 'filtered_params' => $filtered_params, >+ 'attributes' => $attributes >+ } >+ ); >+ >+ $c->render( json => { 'attributes' => $attributes, 'filtered_params' => $filtered_params }, status => 200 ); >+}; >+ > sub to_model { > my ($args) = @_; > $args->{three} = delete $args->{tres} >@@ -294,7 +337,7 @@ sub to_model { > > # The tests > >-use Test::More tests => 7; >+use Test::More tests => 8; > use Test::Mojo; > > subtest 'extract_reserved_params() tests' => sub { >@@ -543,3 +586,51 @@ subtest 'stash_overrides() tests' => sub { > ->json_is( {} ); # x-koha-ovverride not passed is skipped > > }; >+ >+subtest 'dbic_extended_attributes_join() tests' => sub { >+ >+ plan tests => 4; >+ >+ my $t = Test::Mojo->new; >+ >+ $t->get_ok( '/dbic_extended_attributes_join' => { 'x-koha-embed' => 'extended_attributes' } )->json_has( >+ '/attributes' => { >+ 'join' => [ >+ 'extended_attributes', >+ 'extended_attributes' >+ ], >+ 'prefetch' => ['extended_attributes'] >+ } >+ ); >+ >+ $t->get_ok( '/dbic_extended_attributes_join' => { 'x-koha-embed' => 'extended_attributes' } )->json_has( >+ '/filtered_params' => [ >+ { >+ '-and' => [ >+ [ >+ { >+ 'extended_attributes.code' => [ >+ [ >+ 'test1', >+ 'test2' >+ ] >+ ], >+ 'extended_attributes.attribute' => { 'like' => 'abc%' } >+ } >+ ], >+ [ >+ { >+ 'extended_attributes_2.attribute' => { 'like' => '123%' }, >+ 'extended_attributes_2.code' => [ >+ [ >+ 'test1', >+ 'test2' >+ ] >+ ] >+ } >+ ] >+ ] >+ } >+ ] >+ ); >+}; >-- >2.30.2
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